Chu
08/03/2022, 3:13 PMMyParams = Parameter('My_Param', default="my_input")
, in Prefect UI we can input some parameters to overwrite the default at run time, my question is: is there a way to get the run time parameter input (not the MyParams object, but the actual input)?
In our case, the default
is a list (where we pass a list of ids), we need to customize the flow run name by extracting each id from MyParams
and formalizing a new list (child flow run name) for map
function to work.
From what I understand and tested, MyParams
is a serialized object, to access its input first needs to deserialize it or using another way, we cannot just loop over it using [i+'_customzied_string' for i in MyParams]
Anna Geller
08/03/2022, 4:12 PMBlake Enyart
08/03/2022, 8:13 PMprefect.context.parameters.get("<parameter name>")
. However, when I try to use that syntax (in a flow which is triggered by the Prefect UI and run via a Universal Run agent) I am getting the error that the .parameters
attribute is not found as part of the .context
module.
I see the documentation which indicates it should be there on the context at runtime, but here is a screenshot attached to this message that shows the intellisense code completion options I have in VS Code with the parameters function missing.
Is there something I and @Chu might be missing in all this where the goal is to directly access the list used in the run in the rest of the code (i.e. if I run the flow with the defaults it grabs that and uses it in the rest of the code, but if I pass in a different value at runtime to the Prefect flow it will use the updated values in the rest of the code instead of the default values)Chu
08/03/2022, 8:18 PMAnna Geller
08/03/2022, 8:36 PMBlake Enyart
08/03/2022, 8:50 PMtableau_online_datasources
do I do tableau_online_datasources.result.value
?Anna Geller
08/04/2022, 9:35 AMChu
08/04/2022, 12:08 PMwith Flow("My flow") as flow:
urls = Parameter("urls", default=['url1', 'url2', 'url3'])
result = [url+'_string' for url in urls]
This behavior will give an error said, Task is not iterable.. I understand urls is a serialized Object, is there a way to diseralize it to retrieve the run time value (which maybe something different than default)Anna Geller
08/04/2022, 12:11 PMChu
08/04/2022, 12:26 PMBlake Enyart
08/04/2022, 5:25 PMAnna Geller
08/04/2022, 5:33 PMBlake Enyart
08/04/2022, 5:43 PM