Has anyone got an example of python deployments wi...
# prefect-community
r
Has anyone got an example of python deployments with KubernetesJob using infra_overrides - when running the job it keeps telling me "instance of JsonPatch expected", not sure what to pass in, prefect 2.6.2
1
j
not sure if is exactly what you are looking for, but my deployment build command would be something like this:
Copy code
prefect deployment build ./simple_flow.py:simple_flow --name "Simple flow" -i kubernetes-job -sb s3/my_bucket --override image=my-image:latest --override namespace=my-namespace --override image_pull_policy="Always" --override service_account_name=my-service-account
b
Hello, infra_overrides expects a dictionary I believe. There is an example here that you can use. It would look something like this:
Copy code
from my_project.flows import my_flow
from prefect.deployments import Deployment

deployment = Deployment.build_from_flow(
    flow=my_flow,
    name="test",
    work_queue_name="dev",
    infra_overrides=["env.SOME_IMPORTANT_CONFIG=false"],
)

deployment.apply()
Another helpful article you'd may be interested in is this one. It walks you through how to modify base job templates to create customized templates.
r
Thanks, I am trying to add customizations to patch secrets to be read that the flow needs, let me try and use a dict
Finally got this working using the following and passing that into the deployment
🚀 1
1