Farm submissions on a distributed config

Hello,

Its been a while since I’ve looked into this I was reading through the original post and was considering writing a separate engine for Mayabatch to be able to bootstrap and run processes headless, since as far as I remember tk-maya did not allow for this.

Just mainly wondering if this would be an App or an Engine. though I’m pretty sure this would be writing an engine.

4 Likes

Hi @Dfulton1

Its been a while, but I’m pretty sure you can bootstrap the standard tk-maya engine in Mayabatch?

You may want to write your own bootstrap script that starts the engine on launch of Mayabatch but I don’t think you would need a custom engine.

2 Likes

I actually just tested and I was able to run a bootstrap script with MayaBatch, by adding the bootstrap logic to a userSetup.py whose parent folder was set on the PYTHONPATH env var.

2 Likes

Thank you for the reply I’m gonna take some time to look into it

2 Likes

Just a little confused am I then editing a version of tk-maya to edit the userSetup.py located in

C:\Users\user\AppData\Roaming\Shotgun\bundle_cache\app_store\tk-maya\v0.9.7\startup

in order to bootstrap the tk-shell using mayabatch? Or am I bootstraping tk-maya and running mayabatch through that.

1 Like

I wouldn’t edit the engine’s userSetup.py, I would create my own userSetup.py which bootstrapped the engine. Thats what I did in my test anyway. The userSetup.py on the engine is intended to be used in conjunction with launching Maya with the tk-multi-launchapp.

So your process would be:

  1. Set PYTHONPATH to point to your bootstrap script, along with any other variables that might be needed for bootstrapping such as what project id to bootstrap.
  2. Run the MayaBatch
  3. That will execute your bootstrap script and start the integration.

Here is our Bootstrap guide.

2 Likes

Though if you were trying to use the launch app to launch MayaBatch, I would have thought that would work too (assuming you changed the software args/path to launch the batch version of Maya), I can’t remember if I’ve tested that in the past.

1 Like

If I remember correctly Ive tried in the past to passs args in during the launch app process but maya was the only software that would not allow dynamic args and had to be put in the args path on the website.

1 Like

So the PYTHONPATH should point to the new userSetup.py script?
and running MayaBatch like
subprocess.Popen([mayabatch, '-command', 'python "farm_submit(args)"])
will make it bootstrap as long as the bootstrap info is in the userSetup.py?

1 Like

If I launch this through a python console is this using my sand-box config and pulling my code repo to set all my env variables or is it only pull from our primary config?

looks like in the sgtk.bootstrap.ToolkitManager() you can make a call for base_configuration

tank.bootstrap.errors.TankBootstrapError: No config descriptor specified - Cannot create a configuration object.
it doesn’t look like you are able to set any kinda of pipeline_configuration I’ve tried a bunch of different ways to use the same descriptor as my sandbox but it either only defaults back to the primary or give me this error.

It looks like if you want to use a pipeline_configuration you need to use an the id of the configuration. so that is sorted out now.

Hello,
Just wondering is the before_app_launch supposed to run with this?
because it does not appear to run at all

Hi David

Sorry for not getting back to you sooner.
The before_app_launch hook would only run if you are running the tk-multi-launchapp to launch Maya. If you are launching it with your script with your own bootstrap then the hook won’t be called.
If the hook logic needs to be called in both situations, I would move to logic out into a python module somewhere else which you could import from both the hook and your custom launch code.

I also just tested on my side with duplicating the Maya Software entity for Maya, and setting it up to use batch:

And when I launched it from Shotgun Desktop , I got the following output to the tk-maya.log

2020-04-22 09:17:51,148 [61355 INFO sgtk.ext.no_current_bundle.test] doing some Shotgun stuff

What approach you take is up to you and depends on your set up, but if it was me I would have a custom bootstrap script that gets called when Maya launches, and let the farm software handle the launching of Maya.

1 Like