Core hook override possible for bundle cache location?

Hi Shotgun friends! I am in a situation where we have a number of artists who do not have access to the git repositories where our apps are stored and referenced. In our primary configuration, this is no problem because we include the bundle_cache with the zipped configuration attached to the Pipeline Configuration object.

Because we are awesome developers where I live, we would also like to have a “Beta” configuration which certain artists can access to test out our latest and greatest code. However, because this configuration gets built via a CI runner whenever there is a commit to our development branch, we are trying to avoid the overhead including the bundle cache with the config. I would like to set the SHOTGUN_BUNDLE_CACHE_FALLBACK_PATHS someplace (maybe in a core hook override for instance) such that it would prevent attempts to access the git repos to download any referenced apps or frameworks. I know that you can set this environment variable BEFORE launching shotgun desktop, but then we need to get Systems involved to change everyone’s machine, etc, etc. I also tried adding something in the bootstrap.py core hook, but it seems like that is called too late to have the desired effect.

Just wondering if you guys had any advice.
Thank you!
Justin

3 Likes

Good question!
I’ll have a think, but one quick question I have is, is this “Beta” configuration going to be a project config, or is it a site config (a PipelineConfiguration entity with no project set)?

Here are a couple of hooks that might hold promise:

https://github.com/shotgunsoftware/tk-core/blob/v0.18.172/hooks/cache_location.py#L113 (Edit: I miss read this hook, when an app needs to cache, this hook can provide the path where it can store this temporary data.)
https://github.com/shotgunsoftware/tk-core/blob/v0.18.172/hooks/tank_init.py

I’ve not tried this before so I’m not certain if they happen early enough or if they would need to be set at a site config level in order to be effective. I’ll have a go as well, and get back to you.

Best
Phil

2 Likes

Thank you for the tips, Phil! This is a project configuration. I will try your suggestions.

Justin

1 Like

I’ve realised that the cache_location.py hook was not doing what I initially thought. It is generating a path for an app when the app needs to cache some arbitrary data.

The tank_init.py does appear to run before the bundles are loaded, but at the moment it doesn’t seem to be working for me, and I fear that is because the fallback paths have already been extracted from the environment variable by this point, so setting it is futile.

I’m going to keep looking though.

2 Likes

Setting the SHOTGUN_BUNDLE_CACHE_FALLBACK_PATHS path on the tank_init.py on a site config appears to allow a project config to load correctly using it. Though it probably doesn’t matter too much if it’s the tank_init.py or the engine_init.py on the site config, as both would run before the project was loaded.

I’m still not sure if there is a way of doing it purely from the project config hooks though.

3 Likes