Skip to content

Commit

Permalink
Return None rather than raise an exception for Gantt chart of 0 tasks (
Browse files Browse the repository at this point in the history
…#3253)

Prior to this PR, visualizing a workflow with no tasks in it would cause
an HTTP 500 server error, caused by an exception raised in the gantt
generation code.

However, a workflow with no tasks is a legitimate workflow.

This PR makes task_gantt_plot return None, rather than attempting a plot,
which then places no Gantt chart in workflow visualization, rather than
breaking.

This bug was exposed through PR 3121 which sometimes (as a legitimate part of
that test) results in a monitoring DB with a workflow with no tasks (but not
always - that test is testing shutdown behaviour, not database contents).
  • Loading branch information
benclifford authored Mar 18, 2024
1 parent 15c16b9 commit e0f3f69
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

def task_gantt_plot(df_task, df_status, time_completed=None):

if df_task.empty:
return None

# if the workflow is not recorded as completed, then assume
# that tasks should continue in their last state until now,
# rather than the workflow end time.
Expand Down

0 comments on commit e0f3f69

Please sign in to comment.