I’m starting a long overdue investigation of our shotgun configuration to optimize the folder creation time which I feel is quite slow.
FYI In our shotgun setup we have two root locations, primary and secondary
I’m testing with these commands :
from pprint import pprint
import time
import sgtk
tk = sgtk.sgtk_from_entity("Shot", 99999)
start = time.perf_counter()
folders_list = tk.preview_filesystem_structure("Shot", [99999])
stop = time.perf_counter()
pprint(folders_list)
print("Duration in sec:{}".format(stop-start))
I get a duration of about 20sec for the preview_filesystem_structure (btw when using the create_filesystem_structure, I also have a duration of about 20s)
722 folders/files are listed
I read the docs : https://developer.shotgridsoftware.com/82ff76f7/#workspaces-and-deferred-folder-creation and consequently made yml files for the static folders containg :
# the type of dynamic content
type: "static"
# defer creation
defer_creation: ["tk-shell", "tk-shotgun"]
I suppose with these modifications, those static folders will still be created upon project creation (using the Advanced Project setup) and/or when doing a ‘Create Folders’ on the website, right ?
Running the script again, this reduced the number of items to 378. I almost halved the number of folders, but unfortunately this only reduced the duration from 20s to 18.5sec. Is it normal that the duration doesn’t drop more ?
I would also like to defer creation of some static files (luts that I want to get copied on project creation, but ignored afterwards for example). I did not see how to defer the creation of individual files in the docs. I can’t defer the creation of the folder containing those static files because that folder also contains folders that references shotgun entities.
Most puzzling to me : I observe that a lot of folders in the ‘folders_list’ are repeated multiple times. For example some of those luts files are repeated 8 times. If I do a python ‘set’ on the list, it shows me that there are only 109 individual folders/files. Why do I have so many repeating items ?
(Note : I have not a single create_with_parent: true
in the whole schema)
Any tips appreciated
Donat