https://prefect.io logo
b

Brandon T. Kowalski

06/29/2022, 6:11 PM
How does one add a new Parameter to an existing Flow? I inherited a Flow from a colleague that has since left and I wish to add a new Parameter
Copy code
with Flow("HathiTrust Deposit (MARCXML)") as flow:    
     deposit = Parameter("deposit", default=False)
This is the existing parameter. I want to add a second so naturally I tried adding another underneath the first like this:
Copy code
with Flow("HathiTrust Deposit (MARCXML)") as flow:  
    deposit = Parameter("deposit", default=False)
    local_test = Parameter("local_test", default=False)
This results in an error:
Copy code
UserWarning: Tasks were created but not added to the flow: {<Parameter: local_test>}. This can occur when `Task` classes, including `Parameters`, are instantiated inside a `with flow
How does one add a parameter to an existing flow?
j

James Sopkin

06/29/2022, 6:31 PM
Hi Brandon, you added the parameter correctly. That warning occurs when you define a parameter, but don't use that parameter in your flow
b

Brandon T. Kowalski

06/29/2022, 6:31 PM
It is in use or do you mean as a parameter to a Task?
j

James Sopkin

06/29/2022, 6:32 PM
If you call a task and pass in the parameter it should resolve that error
b

Brandon T. Kowalski

06/29/2022, 6:32 PM
I'll give that a shot. Thanks!
👍 1
That was it! Thanks James!
🎉 1
4 Views