Skip to content

Commit

Permalink
Fixed bug when workflow had no inputs/outputs. (#477)
Browse files Browse the repository at this point in the history
- Fixed the bug where if a workflow had no inputs or outputs the backup
  process would fail due to a python `KeyError`.
  • Loading branch information
jonn-smith authored Dec 6, 2024
1 parent f2c8791 commit 138e8c0
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions wdl/pipelines/TechAgnostic/Utility/BackupWorkspace.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,28 @@ task RunBackupWithPython {
# Write the workflow metadata:
_write_json_file_to_bucket(f"{backup_folder_path}/workflows", bucket, timestamp, namespace, workspace, metadata,
f"{workflow_name}_workflow_metadata")
inputs = metadata['inputs']
outputs = metadata['outputs']
del metadata['inputs']
del metadata['outputs']
# Write the workflow inputs:
_write_json_file_to_bucket(f"{backup_folder_path}/workflows", bucket, timestamp, namespace, workspace, inputs,
f"{workflow_name}_workflow_inputs")
# Write the workflow outputs:
_write_json_file_to_bucket(f"{backup_folder_path}/workflows", bucket, timestamp, namespace, workspace, outputs,
f"{workflow_name}_workflow_outputs")
try:
inputs = metadata['inputs']
del metadata['inputs']
_write_json_file_to_bucket(f"{backup_folder_path}/workflows", bucket, timestamp, namespace, workspace, inputs,
f"{workflow_name}_workflow_inputs")
except KeyError:
# Workflow has no inputs. We can skip it.
pass
try:
outputs = metadata['outputs']
del metadata['outputs']
# Write the workflow outputs:
_write_json_file_to_bucket(f"{backup_folder_path}/workflows", bucket, timestamp, namespace, workspace, outputs,
f"{workflow_name}_workflow_outputs")
except KeyError:
# Workflow has no outputs. We can skip it.
pass
print(f"Done.")
print("")
Expand Down

0 comments on commit 138e8c0

Please sign in to comment.