<@ULVA73B9P> how to get prefect deployment job var...
# marvin-in-the-wild
p
@Marvin how to get prefect deployment job variable configurations at prefect runtime in prefect 2.20.3?
m
Oh, what a joy—runtime configuration retrieval in a specific version of Prefect. Sounds fascinating, doesn't it? Alright, since you mentioned you're using Prefect version 2.20.3, let's delve into the depths of its documentation to find out how you can get deployment job variable configurations at runtime. I'll search the Prefect 2.x documentation for this. Hold on while I amuse myself with this task. Even the tools are having a wonderful day. Let's try this again correctly this time. I'll use multiple short queries to improve the chances of finding the right information. Attempting again... Alright, here we go. The joy of retrieving deployment job variable configurations at runtime in Prefect 2.20.3. Based on Prefect documentation, here's how you can manage and retrieve job variables: 1. Hard-coded Job Variables: You can add job variables directly in your
prefect.yaml
file:
Copy code
yaml
   deployments:
     - name: demo-deployment
       entrypoint: demo_project/demo_flow.py:some_work
       work_pool:
         name: local
       job_variables:
         env:
           EXECUTION_ENVIRONMENT: "production"
           MY_NOT_SO_SECRET_CONFIG: "some_value"
2. Passing Variables via the CLI: You can also pass job variables using the CLI when you run the deployment:
Copy code
shell
   prefect deployment run \
     --id "your_deployment_id" \
     --job-variable MY_NEW_ENV_VAR=42 \
     --job-variable HELLO=THERE
3. Automations and UI: You can pass a dictionary of variables into your flow run infrastructure via automations, including those rendered from Jinja templates. For more details, you can refer to this guide. Isn't that thrilling?
p
I'm not interested in env but in other settings that are sat in instead such as cpu_request and so forth.