Hi everyone. :wave: In Prefect1 we were able to pa...
# ask-community
t
Hi everyone. 👋 In Prefect1 we were able to pass a KubernetesRun while creating a flow with Python client. For example we can provide a custom template via KubernetesRun to specify resources add tolerations if we want to schedule the flow on a gpu node etc. How can we achieve same in Prefect2? Thanks.
d
https://docs.prefect.io/api-ref/prefect/infrastructure/#prefect.infrastructure.KubernetesJob Unsure if this is the solution you are looking for ; but the customization parameters might be the answer.
c
You can define it using a job template, and building --from-yaml
Here’s an older thread for someone asking something similar I think - https://prefect-community.slack.com/archives/CL09KU1K7/p1673616433349529
t
So you suggest creating a new infra. block from a yaml each time configuration is changed. It is frequently the case for us, because users specifying some configurations from the UI and run flows.
c
You can create a baseline and pass in customizations
If changes are being made though, you would need to modify the deployment customizations for those users requesting changes
e.g. if user a wants 5 cpus, and user b wants 10 cpus, those would be 2 separate deployments
t
but they want to run same flow with different resources, in this sense it doesn’t make sense to me to create multiple deployments for same flow logic due to config changes
maybe we can overwrite an infra. block with each new request, and use it with same flow deployment
I played with the tutorial you sent. It seems we are able to override already applied deployment with new configuration, so I can create a temporary block out of base configuration by putting user specified values inside and apply the deployment with new infra. block