Pedro Machado
12/08/2021, 6:37 PMAnna Geller
from prefect.tasks.prefect import create_flow_run
create_flow_run(flow_name="child-flow", parameters=dict(key="your_value"))
Pedro Machado
12/08/2021, 6:58 PMAnna Geller
Pedro Machado
12/08/2021, 7:02 PMKevin Kho
Pedro Machado
12/09/2021, 1:13 PMAnna Geller
Pedro Machado
12/09/2021, 7:58 PMCreated flow run 'carrot-firefly-ml_flow-model_prep.py': <https://cloud.prefect.io/fmpm-intelligence/flow-run/8cfddfe6-dcf7-4f17-80be-5ffe92fd943f>
CloudTaskRunner
Task 'run_ml_flow model_prep.py': Exception encountered during task execution!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/prefect/engine/task_runner.py", line 880, in get_task_run_state
logger=self.logger,
File "/usr/local/lib/python3.7/site-packages/prefect/utilities/executors.py", line 454, in run_task_with_timeout
return task.run(*args, **kwargs) # type: ignore
File "/home/pedro/clients/corrigo/ORCHESTRATION_PREFECT/flows/master_flow_monthly.py", line 128, in run_ml_flow
File "/home/pedro/.pyenv/versions/miniconda3-latest/envs/corrigo-prefect/lib/python3.7/site-packages/prefect/tasks/prefect/flow_run.py", line 223, in get_task_run_result
File "/usr/local/lib/python3.7/site-packages/prefect/backend/task_run.py", line 77, in get_result
self._assert_result_type_is_okay()
File "/usr/local/lib/python3.7/site-packages/prefect/backend/task_run.py", line 165, in _assert_result_type_is_okay
"The task result has no `location` so the result cannot be loaded. "
ValueError: The task result has no `location` so the result cannot be loaded. This often means that your task result has not been configured or has been configured incorrectly.
I am using PrefectResult()
at the flow level.Kevin Kho
Pedro Machado
12/09/2021, 8:07 PMKevin Kho
Pedro Machado
12/10/2021, 3:52 PMDBTCLOUD_JOB_ID
that needs to vary by environment. I am using a secret called PRODUCTION-DBTCLOUD_JOB_ID
. However, the team would like to be able to see and edit the default values in the UI.
What would be a good pattern to have different sets of default parameters that can be set upon flow registration but that an operator could override in the UI (not for an adhoc flow run but for all future scheduled job runs)? ThanksKevin Kho
Kevin Kho
Pedro Machado
12/10/2021, 4:15 PMregister the same Flow twice with different defaults
Kevin Kho
python myflow.py -p param1=2
I think you’d have to move away from the CLI, unless you do something like editing your Python file with the default before registrationPedro Machado
12/10/2021, 6:35 PMPedro Machado
12/10/2021, 6:37 PMKevin Kho
Kevin Kho
from prefect import Client
client = Client()
response = client.graphql("""
mutation($flow_group_id: UUID!, $params: JSON!) {
set_flow_group_default_parameters (input: {
flow_group_id: $flow_group_id,
parameters: $params}) {
success
error
}
}
""",
variables={"flow_group_id": "3dc62fc4-5685-410f-843a-e73f673f063c", "params": {"x": 1}})
print(response)
Pedro Machado
12/10/2021, 7:08 PMKevin Kho
Kevin Kho
flow.register()
returns the flow id but you want the flow group id