#!/usr/bin/python # coding: utf-8 import sys sys.path.insert(0,"/s/apps/lin/vfx_test_apps/OpenRenderManagement/Puli/src") from puliclient import Task, Graph # command = "nuke -x -F %%MI_FRAME%% ma_comp.nk" # command = "nuke -x -F %%MI_START%%-%%MI_END%% ma_comp.nk" # command = "echo currFrame=%%MI_FRAME%% in [%%MI_START%%-%%MI_END%%]" command = "sleep %%MI_FRAME%%s" arguments={ 'cmd':command, 'start':1, 'end':50 , 'packetSize':10} tags = { "prod":"test", "shot":"test" } graph = Graph('Testing DefaultRunner', tags=tags, poolName='default' ) task1 = graph.addNewTask( "TASK_1", tags=tags, arguments=arguments ) graph.submit( "puliserver", 8004) # # Pour une execution en local # #graph.execute()
'proj': mayaProjPath, 'scene': mayaScenePath, 's': startFrame, 'e': endFrame, 'packetSize': packetSize, 'framesList': framesList, 'rx': resX, 'ry': resY, 'cam': camera, 'as': '1', 'o': outFileFormat, 'pad': paddingSize, 'f': renderDirPath, 'p': outFileNamePrefix } tags = { "prod":"test", "shot":"test" } decomposer='puliclient.contrib.puliDbg.mtoa.MtoaDecomposer' graph = Graph('mtoa_graph', tags=tags, poolName='default' ) graph.addNewTask( "mtoa_task", tags=tags, arguments=arguments, decomposer=decomposer, lic="shave&mtoa" ) graph.submit("vfxpc64", 8004) # graph.execute()
if __name__ == "__main__": # # Submission script # tags = { "prod": "prod_name", "shot": "shot_code", # Add any valuable info relative to the job here: type, step, version, iteration... } # First we create a graph # Added to the graph is a dict of tags that will be used to clarify the job process graph = Graph("simple job", tags=tags) # To define a Task, we need 3 arguments : # - its name # - a runner is a python class that defines the workflow execution for a given job type. # Here, we will use MyRunner which has been declared previously # - an arguments dict name = "wait 10s" runner = "example.MyRunner" arguments = {"wait": 10} # Then add a new task to the graph graph.addNewTask(name, runner=runner, arguments=arguments) # Finally submit the graph to the server graph.submit("pulitest", 8004)
if __name__ == "__main__": # # Submission script # tags = { "prod": "prod_name", "shot": "shot_code", # Add any valuable info relative to the job here: type, step, version, iteration... } # First we create a graph # Added to the graph is a dict of tags that will be used to clarify the job process graph = Graph('simple job', tags=tags) # To define a Task, we need 3 arguments : # - its name # - a runner is a python class that defines the workflow execution for a given job type. # Here, we will use MyRunner which has been declared previously # - an arguments dict name = "wait 10s" runner = "example.MyRunner" arguments = {"wait": 10} # Then add a new task to the graph graph.addNewTask(name, runner=runner, arguments=arguments) # Finally submit the graph to the server graph.submit("pulitest", 8004)
- A chain of dependencies is added to the graph, the default end status is [DONE] task1 > task4 > task3 > task2 > task5 > task6 - Classic submission """ from puliclient import Task, TaskGroup, Graph, DONE if __name__ == '__main__': args = { "cmd":"sleep 30", "start":1, "end":10, "packetSize":1 } tags = { "prod":"test", "shot":"test" } decomposer = "puliclient.contrib.generic.GenericDecomposer" graph = Graph('simpleGraph', tags=tags) task1 = graph.addNewTask(name="task1", arguments=args, tags=tags) task2 = graph.addNewTask(name="task2", arguments=args, tags=tags) task3 = graph.addNewTask(name="task3", arguments=args, tags=tags) task4 = graph.addNewTask(name="task4", arguments=args, tags=tags) task5 = graph.addNewTask(name="task5", arguments=args, tags=tags) task6 = graph.addNewTask(name="task6", arguments=args, tags=tags) # Create a chain of dependencies, execution order will be: # task1 > task4 > task3 > task2 > task5 > task6 graph.addChain( [task1, task4, task3, task2, task5, task6] ) graph.submit(host="vfxpc64") # PREVIOUS METHOD (still valid) # task1 = Task(name="task1", arguments=args, decomposer=decomposer)
# Added to the graph is a dict of tags that will be used to clarify the job process graph = Graph("simple_job", tags=tags) # In this example we will create 2 tasks with multiple frames # The first task executes one process per command, the second will group several processes by commands # We still need to define its name and arguments dict # The default runner automatically handles the following arguments: # - cmd: a string representing the command to start # - start: start frame number # - end: end frame number # First task name = "multiple commands" arguments = {"cmd": "sleep %%MI_FRAME%%", "start": 1, "end": 10} graph.addNewTask(name, arguments=arguments) # Second task name = "multiple commands grouped by packet size" # To handle several processes in a command, we add the following arg: # - packetSize: number of frames to run in the same command arguments = {"cmd": "sleep %%MI_FRAME%%", "start": 1, "end": 10, "packetSize": 3} graph.addNewTask(name, arguments=arguments) # Finally submit the graph to the server graph.submit("vfxpc64", 8004)
#!/usr/bin/python # coding: utf-8 import sys sys.path.insert(0,"/s/apps/lin/vfx_test_apps/OpenRenderManagement/Puli/src") from puliclient import Task, Graph tags = { "prod":"test", "shot":"test" } arguments={ 'cmd':'echo RUUUUUNN !!!' } graph = Graph('debug', tags=tags, poolName='default' ) graph.addNewTask( "DO_SOMETHING", tags=tags, arguments=arguments ) # graph.submit("puliserver", 8004) graph.execute()
# The default runner automatically handles the following arguments: # - cmd: a string representing the command to start # - start: start frame number # - end: end frame number # First task name = "multiple commands" arguments = { "cmd": "sleep %%MI_FRAME%%", "start": 1, "end": 10, } graph.addNewTask(name, arguments=arguments) # Second task name = "multiple commands grouped by packet size" # To handle several processes in a command, we add the following arg: # - packetSize: number of frames to run in the same command arguments = { "cmd": "sleep %%MI_FRAME%%", "start": 1, "end": 10, "packetSize": 3 } graph.addNewTask(name, arguments=arguments)
from puliclient import Task, Graph, GraphDumper if __name__ == '__main__': args = { "cmd":"sleep 30", "start":1, "end":10, "packetSize":1 } tags = { "prod":"test", "shot":"test" } decomposer = "puliclient.contrib.generic.GenericDecomposer" # # 1. a task waits the end of a taskgroup # graph = Graph('1st case', tags=tags) tg1 = graph.addNewTaskGroup( name="TG1" ) tg1.addNewTask( name="task1", arguments=args, tags=tags, decomposer=decomposer ) tg1.addNewTask( name="task2", arguments=args, tags=tags, decomposer=decomposer ) task3 = graph.addNewTask( name="task3", arguments=args, tags=tags, decomposer=decomposer ) graph.addEdges( [(tg1, task3)] ) graph.submit("pulitest", 8004) # # 2. a taskgroup waits the end of a task # graph = Graph('2nd case', tags=tags) tg1 = graph.addNewTaskGroup( name="TG1" ) tg1.addNewTask( name="task1", arguments=args, tags=tags, decomposer=decomposer ) tg1.addNewTask( name="task2", arguments=args, tags=tags, decomposer=decomposer ) task3 = graph.addNewTask( name="task3", arguments=args, tags=tags, decomposer=decomposer ) task4 = graph.addNewTask( name="task4", arguments=args, tags=tags, decomposer=decomposer ) graph.addEdges( [(task3, tg1), (task4, tg1)] )