Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jass
Manage
Activity
Members
Labels
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Statistical-Genetics
jass
Commits
764e2a58
Commit
764e2a58
authored
2 years ago
by
Bryan BRANCOTTE
Browse files
Options
Downloads
Patches
Plain Diff
compute plot in parallel
parent
407d3a7a
No related branches found
No related tags found
1 merge request
!59
Compute plot in parallel
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jass/tasks.py
+13
-6
13 additions, 6 deletions
jass/tasks.py
with
13 additions
and
6 deletions
jass/tasks.py
+
13
−
6
View file @
764e2a58
...
...
@@ -74,31 +74,38 @@ def create_project_csv_file(project_id):
return
project
.
create_csv_file
()
@celery.task
def
dummy_task
():
print
(
"
This task to nothing, but help the chain to have a valid status
"
)
def
run_project_analysis_if_needed
(
project
):
if
project
.
has_computation_going_on
():
return
tasks
=
[]
post_worktable_tasks
=
[]
if
not
os
.
path
.
exists
(
project
.
get_worktable_path
()):
tasks
.
append
(
create_project_worktable
.
si
(
project
.
id
))
if
project
.
get_global_manhattan_plot_path
()
and
not
os
.
path
.
exists
(
project
.
get_global_manhattan_plot_path
()):
tasks
.
append
(
create_project_global_plot
.
si
(
project
.
id
))
post_worktable_
tasks
.
append
(
create_project_global_plot
.
si
(
project
.
id
))
if
project
.
get_quadrant_plot_path
()
and
not
os
.
path
.
exists
(
project
.
get_quadrant_plot_path
()):
tasks
.
append
(
create_project_quadrant_plot
.
si
(
project
.
id
))
post_worktable_
tasks
.
append
(
create_project_quadrant_plot
.
si
(
project
.
id
))
if
project
.
get_qq_plot_path
()
and
not
os
.
path
.
exists
(
project
.
get_qq_plot_path
()):
tasks
.
append
(
create_project_qq_plot
.
si
(
project
.
id
))
post_worktable_
tasks
.
append
(
create_project_qq_plot
.
si
(
project
.
id
))
if
project
.
get_csv_path
()
and
not
os
.
path
.
exists
(
project
.
get_csv_path
()):
tasks
.
append
(
create_project_csv_file
.
si
(
project
.
id
))
post_worktable_
tasks
.
append
(
create_project_csv_file
.
si
(
project
.
id
))
if
len
(
tasks
)
==
0
:
if
len
(
tasks
)
+
len
(
post_worktable_tasks
)
==
0
:
return
main_wf
=
chain
(
*
tasks
,
group
(
post_worktable_tasks
),
# it is mandatory to add a task that do nothing if group is used in order to have a success/failure status
#
dummy_task.si(),
dummy_task
.
si
(),
)
task
=
main_wf
.
delay
()
project
.
celery_id
=
task
.
id
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment