alvin goh

    2 years ago
    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 = f.run(x={'d': 7})
    print(flow_state) # success
    # create new flow and copy old flow
    new_flow = Flow(name = "Test")
    flow_state2 = new_flow.run(x={'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/runner.py", line 48, in inner
        new_state = method(self, state, *args, **kwargs)
      File "/opt/conda/envs/pipeline/lib/python3.6/site-packages/prefect/engine/task_runner.py", line 869, in get_task_run_state
        self.task.run, timeout=self.task.timeout, **raw_inputs
      File "/opt/conda/envs/pipeline/lib/python3.6/site-packages/prefect/utilities/executors.py", 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

    Chris White

    2 years ago
    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

    2 years ago
    That was fast! Thanks! 😃