Skip to content
Snippets Groups Projects
Commit 764e2a58 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

compute plot in parallel

parent 407d3a7a
No related branches found
No related tags found
1 merge request!59Compute plot in parallel
......@@ -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
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment