Changing task_runner in prefect deployment

Is there a way to change the task_runner within a prefect deployment?

It seems to me that non, I tried with

deployment_main_flow = Deployment.build_from_flow(

I succeed only to change flow name on deployment.

Solution to my problem was posted here:

Permanent fix:

Hi Aleksandr,

A TaskRunner is a parameter on the flow class.

A deployment does not “configure” the flow behavior, but the location, the infrastructure, the scheduling, the overrides, the storage.

As Piotr posted (thank you Piotr!) you can set a conditional within the flow definition to determine which task runner to use (which can be passed as either parameters on run, or within infra overrides / env settings in deployment definition).

1 Like