prefect.runtime.deployment
Access attributes of the current deployment run dynamically.
Note that if a deployment is not currently being run, all attributes will return empty values.
You can mock the runtime attributes for testing purposes by setting environment variables
prefixed with PREFECT__RUNTIME__DEPLOYMENT
.
Example usage
from prefect.runtime import deployment
def get_task_runner():
task_runner_config = deployment.parameters.get("runner_config", "default config here")
return DummyTaskRunner(task_runner_specs=task_runner_config)
Available attributes
id
: the deployment's unique IDname
: the deployment's nameversion
: the deployment's versionflow_run_id
: the current flow run ID for this deploymentparameters
: the parameters that were passed to this run; note that these do not necessarily include default values set on the flow function, only the parameter values set on the deployment object or those directly provided via API for this run
__getattr__(name)
Attribute accessor for this submodule; note that imports also work with this:
from prefect.runtime.flow_run import id
Source code in src/prefect/runtime/deployment.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|