Hi, Celton.
I am mostly using standard client api of tactic:
server.get_virtual_snapshot_path()
server.get_preallocated_path()
I just tested speed again, and this is my tests on local machine using remote api:
The same code on the server-side:
Obviously there is small gain in speed when doing on server-side, but it is far from 0.03 seconds per iteration.
I am going to add some print statements and timing into tactic source codes to see where is bottleneck, and may be point you in this place.
Custom naming classes should do the trick, but i really don't know how i can do smart caching in my particular situation, will try it sometimes.
Can you provide the source code you wrote to do the test? I could check them on my server.
Did some test with namingUtil:
Time: 0.07758712768554688
Resulting name: 'dolly3d/episodes/Sh01/publish'
Returned path lacks snapshot info and parent
I am mostly using standard client api of tactic:
server.get_virtual_snapshot_path()
server.get_preallocated_path()
I just tested speed again, and this is my tests on local machine using remote api:
Code:
import thlib.tactic_classes as tc
import thlib.global_functions as gf
t = gf.time_it()
server = tc.server_start(project='dolly3d')
preallocated_path = server.get_virtual_snapshot_path('complex/shot?project=dolly3d&code=SHOT00646', 'animation')
print(preallocated_path)
gf.time_it(t)
virtual_snapshot = server.get_preallocated_path('SNAPSHOT00009768', mkdir=False)
print(virtual_snapshot)
gf.time_it(t)
Code:
/home/apache/assets/dolly3d/episodes/EpTEST/animation/versions/EpTEST_Sh01_animation_v001
Code flow running time: 0.378999948502
/home/apache/assets/dolly3d/episodes/EpTEST/EpTEST_Sh01
Code flow running time: 0.662999868393
The same code on the server-side:
Code:
import time
import json
start_time = time.time()
server.set_project('dolly3d')
results_dict = {}
results_list = []
preallocated_path = server.get_virtual_snapshot_path('complex/shot?project=dolly3d&code=SHOT00646', 'animation')
results_dict['preallocated_path'] = time.time() - start_time
results_list.append(preallocated_path)
virtual_snapshot = server.get_preallocated_path('SNAPSHOT00009768', mkdir=False)
results_dict['virtual_snapshot'] = time.time() - start_time
results_list.append(virtual_snapshot)
results_dict['result'] = results_list
return json.dumps(results_dict)
Code:
{u'preallocated_path': 0.33849501609802246,
u'result': [u'/home/apache/assets/dolly3d/episodes/EpTEST/animation/versions/EpTEST_Sh01_animation_v001',
u'/home/apache/assets/dolly3d/episodes/EpTEST/EpTEST_Sh01'],
u'virtual_snapshot': 0.43698716163635254}
Obviously there is small gain in speed when doing on server-side, but it is far from 0.03 seconds per iteration.
I am going to add some print statements and timing into tactic source codes to see where is bottleneck, and may be point you in this place.
(12-13-2019, 01:22 PM)Celton McGrath Wrote: - @PYTHON script - can reference a Python script that does custom caching using the Container.In tactic 4.5 (on which i am now) @PYTHON is really unusable, as it does not provide needed "context", like file, snapshot etc, just main SObject. I know it was expanded in 4.7, but i need 4.5 api by now.
- Custom naming classes - can reference a class that performs custom caching using the Container
Custom naming classes should do the trick, but i really don't know how i can do smart caching in my particular situation, will try it sometimes.
Can you provide the source code you wrote to do the test? I could check them on my server.
Did some test with namingUtil:
Code:
from pyasm.biz.naming import NamingUtil
from pyasm.search import Search
sobject = Search.get_by_search_key('complex/shot?project=dolly3d&code=SHOT00646')
snapshot = Search.get_by_search_key('sthpw/snapshot?code=SNAPSHOT00009768')
server.set_project('dolly3d')
naming = NamingUtil()
template = "{project.code}/episodes/{sobject.name}/{snapshot.process}{@CASE( @GET(file.type) == 'playblast', '/'+'__preview', @GET(file.type) == 'web', '/'+'__preview/web', @GET(file.type) == 'icon', '/'+'__preview/icon')}"
name = naming.naming_to_dir(template, sobject, snapshot)
Time: 0.07758712768554688
Resulting name: 'dolly3d/episodes/Sh01/publish'
Returned path lacks snapshot info and parent