kevin
09/15/2020, 7:37 PMClient().create_flow_run()
what is the best way to inject some custom context?
Would it be something like this at a high level:
client = Client()
with context(run_id=some_run_id):
client.create_flow_run()
As a follow up, the use case for the above question is that we want to inject a custom run_id into the env variable PREFECT__LOGGING__LOG_ATTRIBUTES="['run_id']"
so that our logger can collect that attribute. Would this be the correct approach?Jim Crist-Harif
09/15/2020, 7:44 PMclient = Client()
client.create_flow_run(context={"run_id": some_run_id})
kevin
09/15/2020, 7:45 PMJim Crist-Harif
09/15/2020, 7:48 PMPREFECT__LOGGING__LOG_ATTRIBUTES
is required for whatever functionality you want here, then yes, that would need to be set in the flow run environment as well. You'd do that when configuring your agent/flow environment statically once, not as part of the call to create_flow_run
.kevin
09/15/2020, 7:59 PM