0

How to setup sgtk for projects which are no on the primary storage location

Hi,

My goal was to use a standard single-root project configuration, but instead of setting up the 'primary' storage location in roots.yml, I'd use another one in order to relocate the entire project.

SGTK configuration supports multiple roots, which would allow part of the project to be located on a different storage location, which made me believe the aforementioned use-case would just work. However, it seems the code is very dependent on a 'primary' storage location to be present. The PipelineConfiguration type for example asserts this explicitly, as seen here: https://github.com/shotgunsoftware/tk-core/blob/master/python/tank/pipelineconfig.py#L1098 .

What seems to work though is to manipulate the roots.yml to have a 'primary' key, which contains the same information as the storage location you actually want to use. That way, roots.yml doesn't match the respective shotgun LocalStorage entities anymore, which for now doesn't seem to be an issue as the cache is always used.

When automating project creation, the current tank implementation requires some monkey-patching to make this work nonetheless. An example can be found here: https://github.com/Byron/btank/blob/master/src/python/btank/commands.py#L81 .

Is there something I am missing ?

Thanks

2 comments

  • 0
    Avatar
    Julien Dubuisson

    Hi Sebastian,

    We discovered that limitation as well a couple of weeks ago and did the exact same thing as you did: having a 'primary' and a 'project' storage that contains the same info + monkey patching on project creation.

    It was working pretty well until we figured out that we lost the publish dependency feature (no Upstream or Downstream links are created).

    The publish process doesn't seem to use the root defined in the config but the first LocalStorage found in Shotgun that matches your root path ('project' storage in our case). Then on publish the util.shotgun.find_publish function search for publishes using the LocalStorage of the project which doesn't match what's in Shotgun.

    Yesterday we found out that adding a second root to roots.yml with the same paths as the primary and rewriting our path_cache using the 'project' root  seems to do the trick. For now. I'm sure we will be bitten again.

     

    It could be really great to be able to use a different root name than primary and that Tank uses the correct Storage when publishing.

     

    Thanks

  • 0
    Avatar
    Sebastian Thiel

    Hi Julien,

    Thanks for the hint, the issue you are mentioned didn't hit us just yet, leaving time to prepare.

    Even though I am using two roots as well, 'primary' and 'other', with both using the same paths, it's likely some search through them in undefined order is likely to find 'primary' first, which will be the wrong one after all.

    It seems like the healthiest solution would be to be able to configure the name of the primary storage location per project, and replacing code using constants.PRIMARY_STORAGE_NAME accordingly.

    To my mind, this constant is only important to serve as default value in templates for example, and there are a few uses of the PipelineConfiguration.get_primary_data_root() method as well.

    Fixing this requires plenty of monkey-patching, or it's done in code with an accompanying pull request.

    Cheers,,

Please sign in to leave a comment.