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( flow=main_flow.with_options(name=config.main_flow), apply=True, )
I succeed only to change flow name on deployment.
Solution to my problem was posted here:
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).