I’m using CGRU Afanasy as a render scheduler for Houdini in a project managed with Ayon. However, when submitting a render through Afanasy from a Ayon scene, it launches a new Houdini instance in headless mode, which causes the render to fail . The issue seems to be that Houdini is not picking up the correct Ayon environment or Python modules that would normally be set when launching through Ayon.
For exemple. ModuleNotFoundError: No module named 'ayon_houdini'
Has anyone encountered this before or found a way to get around it? I was hoping that manually setting some environment variables on the fly might work as a quick workaround, but I’m not sure if that’s sufficient.
All that’s really needed is to pass the “AYON environment” to the process launched from AFANASY.
The Deadline implementation has that logic triggered here.
With the job submission, you’ll need to pass some things from your current context, like folder path, task, ayon bundle, etc. and then on the farm retrieve the environment as needed by the worker to have all the right dependencies as configured in AYON.
How this works in AFANASY to allow adding these envs into jobs from that point is mostly about how AFANASY handles that.
Thanks everyone for your help! I’ll try to hack my way around based on the RoyalRender and Deadline implementation your provided. Hopefully just setting the Ayon env will be the solution, because the Afanasy ROP has a tab to set Env variables, so I could easily automate this within Houdini. My only worry is how to make sure Houdini get access to the proper Ayon Python modules because that seemed to be the main issue, would setting PYTHONPATH to the local ayon-core folder might help for exemple?
I’ll keep you updated shortly if I get any success in doing so. I’m not a dev by profession, just have enough knowledge to usually hack my way through, so might be a bit of a quirky solution if I end up succeeding.
Cheers
Looks like it all worked! I did set all the variables shown in the scripts you provided, directly in the Afanasy ROP, and also insured my pythonpath contained all the necessary lib from Afanasy.
I also had to launch the afserver and afrender commands through the Terminal Main of the Ayon task.
I then submit my renders through the Afanasy ROP, and once done I publish using ‘Use exisiting frames (local)’ Render Target.
There is probably a way to automatise all of this, but for now I’ll happily use that!
Cheers!