alvin goh

12/01/2019, 9:14 AM
Hi all, anyone thoroughly used the flow.update() function? Seems like GetItem tasks do not get 'transferred' over to the new flow correctly...
from prefect import Flow, Parameter

with Flow("math") as f:
    x = Parameter("x")
    d = x['d']
    a = d + 1

flow_state ={'d': 7})
print(flow_state) # success
# create new flow and copy old flow
new_flow = Flow(name = "Test")
flow_state2 ={'d': 7})
print(flow_state2) # fails
ERROR - prefect.TaskRunner | Unexpected error: TypeError("run() missing 1 required positional argument: 'key'",)
Traceback (most recent call last):
  File "/opt/conda/envs/pipeline/lib/python3.6/site-packages/prefect/engine/", line 48, in inner
    new_state = method(self, state, *args, **kwargs)
  File "/opt/conda/envs/pipeline/lib/python3.6/site-packages/prefect/engine/", line 869, in get_task_run_state, timeout=self.task.timeout, **raw_inputs
  File "/opt/conda/envs/pipeline/lib/python3.6/site-packages/prefect/utilities/", line 85, in timeout_handler
    return fn(*args, **kwargs)
TypeError: run() missing 1 required positional argument: 'key'
Wrapping the constant strings/numbers in Constant() works... Maybe documentation should be updated to recommend this?

Chris White

12/01/2019, 3:58 PM
Hi @alvin goh - great find! This is actually a subtle bug caused by a recent refactor of how Prefect handles constants. Will fix shortly!

alvin goh

12/02/2019, 12:01 AM
That was fast! Thanks! :)
👍 2