Hi @jing.liu,
Let me explain in a little bit more detail:
Firstly, I’m strictly talking about pipeline configuration entities. And the cloning I’m referring to is the one that gets the git repository from the remote location to temp folder (on windows it would be something like: c:\users\<username>\appdata\local\temp\sgtk_clone_a1f3fd3a9fe54935913c263f5046cb55
)
We use descriptors to set desired config source for each project. The project will usually have one “Dev” pipeline config and “Primary” config. Both will have their descriptor fields set as needed. We may have more than that though (depends on multiple factors really).
For now, i think we can ignore the Dev (sandbox) config, and focus on Primary.
This config will have a descriptor field set in shotgun as follows:
sgtk:descriptor:git_branch?path=</path/to/repo>&branch=<branch_name>
&version=<commit_hash>
For the whole picture’ sake, repository is not on the internet but rather on the network location. Don’t think it makes any difference, but worth noting.
Ok, back to the problem:
Situation number 1
We define descriptor exactly as mentioned above and the specified repo/branch/commit was already cached:
> no cloning captured in the log
Situation number 2
Define descriptor as above but the commit was never cached locally:
> git clone --no-hardlinks...
captured once
Situation number 3
Omit the version from the descriptor (this forces it to use the latest commit):
> the log now shows git clone --no-hardlinks...
is executed 4 times!
For each pipeline configuration added on shotgun website for the project, this number grows by 2.
It does that every time the project is loaded, no mater if it was previously cached - which i can understand since it doesn’t know whats “latest” at that point - but it makes little sense to me that it needs to clone the same repository so many times.
Note
I can send the logs privately if needed.
I’ve only caught this because I was investigating (once again) slow startup times and realized that this action takes very long and it is executed multiple times for some projects.
The time it takes per single clone is nothing to do with shotgun - the repo sits on filesystem and was never garbage collected so it got quite dirty over the course of 2 years. This can be improved but that’s on our end. I was just wandering if the optimization can be taken even further.
Of course, we could always provide the exact version to the descriptor but sometimes its useful to have the option of “latest”.
The reason it does this repeated cloning could easily be a result of something I introduced unwittingly. I just can’t figure out what.
Cheers,
Aleksandar