Josh
10/26/2021, 3:51 PMdocker run -env FOO=BAR <my_docker_image>
I would like to be able to execute a flow on this image with a Docker Agent by calling the flow with the parameters
{
"FOO": "BAR"
}
Is this possible with Prefect? Or is there a Prefect idiom for such a concept?
Use cases for changing environment variables on container create/flow execution would be
1. defining which customer code path we want to trigger (database, configs, special methods and permissions)
2. Setting how we want to persist data (which database type to use, how to cache)Zanie
RunConfig
per flow run and it has an environment variables section.Kevin Kho
DockerRun(...,env={"FOO":"BAR"})
Josh
10/26/2021, 5:36 PMZanie
Josh
10/26/2021, 5:37 PMrun_models
flow and I wanted to set the databases used based on the environment variable, I wouldn’t be able to do that with the Prefect Flow Parameters would I?Josh
10/26/2021, 5:37 PMZanie
Josh
10/26/2021, 5:38 PMZanie
Josh
10/26/2021, 5:38 PMJosh
10/26/2021, 5:39 PMSchedule
or by calling the API for ad-hoc runs?Zanie
Zanie
Client.create_flow_run
method takes a run_config
https://docs.prefect.io/api/latest/client/client.html#client-2Zanie
run_config.serialize()
Zanie
Josh
10/26/2021, 5:47 PMZanie
os.environ
based on parameters if it's a Python service.