tags = { "prod":"test", "shot":"test", "nbFrames":options.num } # # Create custom graph # simpleTask = Task( name=options.jobname, arguments=args, tags=tags, runner="puliclient.contrib.commandlinerunner.CommandLineRunner", lic="katana" ) # simpleTask = Task( name="T-Generic", arguments=args, tags=tags, runner="puliclient.contrib.debug.WaitRunner" ) graph = Graph( options.jobname, simpleTask, tags=tags, poolName='default' ) # graph.addNewTask( name="T1", arguments={ "args": command, "start":1, "end":5, "packetSize":1 }, tags={ "prod":"test", "shot":"test", "nbFrames":5}, runner=runner ) # # # g1 = graph.addNewTaskGroup( name="group1", tags=tags ) # g1.addTask( simpleTask ) # g1.addNewTask( name="T2", arguments={ "args": command, "start":1, "end":1, "packetSize":1 }, tags={ "prod":"test", "shot":"test", "nbFrames":1}, runner=runner ) # g1.addNewTask( name="T3", arguments={ "args": command, "start":1, "end":1, "packetSize":1 }, tags={ "prod":"test", "shot":"test", "nbFrames":1}, runner=runner ) # # graph.addNewTask( name="T4", arguments={ "args": command, "start":1, "end":10, "packetSize":1 }, tags={ "prod":"test", "shot":"test", "nbFrames":10}, runner=runner ) if options.dump: print graph # # Execute # if options.execute: graph.execute() else: graph.submit(options.hostname, options.port)
# Then we define a task. A task is basically a group of one or several commands all of the same kind. # It means, each command will start the same process but might have different params. For instance you will # create a task to execute a single process or to exec several times the same process like when rendering # an image sequence. # In this example we will create a simple task with only one command # Therefore we need to define only 2 attributes: # - its name # - a dict of its arguments name = "my command" # The arguments dict can handle many arguments. # When creating a classic command (like a shell command) we internally use a "runner" called "CommandLineRunner". # This default runner automatically handles the following arguments: # - cmd: a string representing the command to start # - start: start frame number # - end: end frame number # - packetSize: how many frames to calculate during the same command # Here we only need to define the "cmd" to start a simple shell process # (More information on runners and how to specialize them in documentation) arguments = { "cmd": "sleep 15s" } # Then add a new task to the graph graph.addNewTask(name, arguments=arguments) # Finally submit the graph to the server graph.execute()