Damien Dee Coureau

02/25/2023, 5:25 AM
Hello, I got a question which I can't seem to be able to find any hint about. I can't tell if it's a weird use case that nobody else cares about or if it's so commun that nobody's talking about it ^^ Please excuse me if it sounds dumb. Can I have tasks in a flow executed on different python interpretors ? (not the whole flow but each task in a single flow) We are using different apps to process different things, and many of those apps embed their own python interpretor to provide functionnalities (as opposed to being a python package you can intall). So we would need flows that jumps from python to let's say Autodesk Maya, then pure python again and then The Foundry's Nuke, for example. How can we achieve that with prefect ?

Christopher Boyd

02/27/2023, 8:16 PM
Each task is a sub-process of the parent flow that returns back, in the same python process. If you want to use different interpreters, you would need to likely use docker images and spawn them as sub-flows, as opposed to tasks
This is not a common scenario

Damien Dee Coureau

02/27/2023, 8:32 PM
Hello Christopher, Thanks a lot for your answer :) I suspected it's not common. Since each task is a subprocess, maybe there a way to customize the subprocess création ? Maybe with a custom TaskRunner or a custom Infrastructure ? I'm not sure where I should start looking for something to hack :p

James Sopkin

02/27/2023, 9:25 PM
Seconding off what Chris mentioned, you could use different sub flows that you kick off with

Damien Dee Coureau

02/28/2023, 2:37 PM
We're indeed evaluating this option, but I get the feeling the UX wouldn't be as good, especially regarding the radar view which wouldn't display our whole flow if it's cut into sub flows. Am I wrong ? Another option would be to run the scpecialized interpreter from the task process and control it with a rpc (we'll need to do this for non-python systems). But it would be so very pleasant to just write plain python directly in the flow.
So if you have an opinion on hacking a TaskRunner or an Infrastructure, I would love to hear it :)