Setting pipeline config via shotgun descriptor

Hello,

I’m trying to bootstrap into our uploaded config on the farm via descriptor but it doesn’t seem to be able to find the config. I’m using something similar to this to try and get this up and running
mgr.pipeline_configuration = "sgtk:descriptor:shotgun?entity_type=PipelineConfiguration&id=##&field=sg_config&version=####"

Just wondering if there is a way to set up the descriptor to pull an uploaded config

I’ve been using this page for the descriptors https://developer.shotgunsoftware.com/tk-core/descriptor.html

2 Likes

Hey @Dfulton1!

Looking at the documentation for ToolkitManager.pipeline_configuration, I believe you’ll want to do things a bit differently. I’m specifically referring to this bit:

Alternatively, you can set this to a specific pipeline configuration. In that case, the Manager will look for a pipeline configuration that matches that name or id and the associated project and plugin id. If such a config cannot be found in Shotgun, it falls back on the base_configuration() .

So, I believe what you’ll want to do is set. up a PipelineConfiguration entity in Shotgun that points to an uploaded config with a shotgun descriptor (if you already haven’t), then set that entity’s name or id as the value of the pipeline_configuration property.

Let us know how it goes!

1 Like

Hey @tannaz

I’m getting an error when running the complete script detailed here:
https://developer.shotgunsoftware.com/3d8cc69a/?title=Bootstrapping%2Band%2Brunning%2Ban%2Bapp#part-5-launching-an-app (except I’m running it for tk-maya instead of tk-shell)

The error is as follows:

engine = mgr.bootstrap_engine("tk-maya", entity=project)
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\manager.py", line 479, in bootstrap_engine
tk = self._bootstrap_sgtk(engine_name, entity)
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\manager.py", line 1063, in _bootstrap_sgtk
config = self._get_updated_configuration(entity, progress_callback)
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\manager.py", line 1008, in _get_updated_configuration
config = self._get_configuration(entity, progress_callback)
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\manager.py", line 981, in _get_configuration
self._sg_user.login
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\resolver.py", line 778, in resolve_shotgun_configuration
return self.resolve_configuration(fallback_config_descriptor, sg_connection)
  File "C:\Users\west\AppData\Roaming\Shotgun\brud\p627c137.basic.shotgun\cfg\install\core\python\tank\bootstrap\resolver.py", line 96, in resolve_configuration
"No config descriptor specified - Cannot create a configuration object."
tank.bootstrap.errors.TankBootstrapError: No config descriptor specified - Cannot create a configuration object.

Is this error related to your last comment re: setting up a pipelineConfigure entity in Shotgun that points to an uploaded config with a shotgun descriptor? If so, why doesn’t it find my primary configuration that all projects are using?

If not, what am I doing wrong?

Hi @Nik

Apologies for the delay here; I had to do a bit of research on this one.

I tested your setup and got the same results. Looking at our docs for the Bootstrap API, there are two properties of ToolkitManager that are relevant here:

  • pipeline_configuration, a property with which you can directly specify which pipeline configuration to bootstrap with, which includes the following:

In this case, it will look at all pipeline configurations stored in Shotgun associated with the project who are associated with the current user. If no user-tagged pipeline configuration exists, it will look for the primary configuration, and in case this is not found, it will fall back on the base_configuration. If you don’t want this check to be carried out in Shotgun, please set do_shotgun_config_lookup() to False.

  • base_configuration, which is a property with which you can specify a fallback configuration

So, it looks like the bootstrap code will automatically fall back to a Primary configuration on the project if none is specified, but it won’t go as far as to fall back to a site config. In order to get your desired behavior, you’d want to set your site config as the value for base_configuration.

There’s an example in the Bootstrap documentation, but it worked for me to simply add a line like this that pointed to the descriptor for my config (in my case, I just used tk-config-basic from the app_store instead of a site config on my site):

mgr.base_configuration = "sgtk:descriptor:app_store?name=tk-config-basic"

Hope that helps! Let us know if you have any other questions.

Thanks for the update. Was able to sort out the descriptor issue. The problem now is that now that I have the shotgun engine started in mayapy, I need to be able to set the context on the engine, ie.

When starting a scene in the gui version of maya via toolkit, if I run the following:
sgtk.platform.current_engine().context

I get a full context that contains the shot, task, step, etc.

But when starting the engine from bootstrap in mayapy, I’m not sure yet how to set the context. It makes sense that it’s empty to begin with because I haven’t started a scene from the task etc like I would in the maya gui version. However, I’m not sure how to set the context attributes in the command line version such that if I were to run

sgtk.platform.current_engine().context

it would return attributes where the Task, Step, Entity, etc is not empty. Is this possible?

Ideally I’d like to open a scene under this context so that I can run my toolkit publish workflow identically to the maya gui version.

I think I found the answer. Generate context then run:

sgtk.platform.change_context(ctx)

correct?