Skip to content

Commit

Permalink
Perform merge of default/new args in PATCH-WorkflowTask endpoint (ref #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tcompa committed Jun 21, 2023
1 parent 1349124 commit ad99ce4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion fractal_server/app/api/v1/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,19 @@ async def update_workflowtask(

for key, value in workflow_task_update.dict(exclude_unset=True).items():
if key == "args":
setattr(db_workflow_task, key, value)

# Get default arguments via a Task property method
default_args = deepcopy(
db_workflow_task.task.default_args_from_args_schema
)
# Override default_args with args value items
actual_args = default_args.copy()
if value is not None:
for k, v in value.items():
actual_args[k] = v
if not actual_args:
actual_args = None
setattr(db_workflow_task, key, actual_args)
elif key == "meta":
current_meta = deepcopy(db_workflow_task.meta) or {}
current_meta.update(value)
Expand Down

0 comments on commit ad99ce4

Please sign in to comment.