parser.add_argument('nbTasks', metavar='NB_TASK', type=int, help='Number of task by group.') parser.add_argument('nbCmds', metavar='NB_CMD', type=int, help='Number of commands by task') parser.add_argument('server', metavar='SERVER', type=str, help='Name of the server on which to submit job') parser.add_argument('--sleep', type=int, default=5, help='Sleep duration in s') args = parser.parse_args() # Create graph runner = "puliclient.contrib.generic.GenericRunner" name = "Job_Test" tags = {"prod": "mikros_test", "comment": "JOB TEST", "nbFrames": 1} puliGraph = Graph(name, poolName='mik', tags=tags, maxRN=5) print "NB_GROUP = " + str(args.nbGroups) print "NB_TASK = " + str(args.nbTasks) print "NB_CMD = " + str(args.nbCmds) print "SERVER = " + args.server createFolderNodes(puliGraph, args.nbGroups, args.nbTasks, args.nbCmds, args.sleep) puliGraph.submit(args.server, 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)
def compile(job): g = Graph(job.name, job, username()) from pprint import pprint pprint(g.toRepresentation())
if __name__ == '__main__': # In this example we will create 2 tasks to execute custom callables # Internally we will use a predefined runner: CallableRunner # The function or class method we are asking to execute must be accessible to the render nodes. 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('job with callable', tags=tags) # First task name = "callable function" graph.addNewCallable( myFunction, "callable function", user_args=("param1", "param2"), user_kwargs={"wait": 10}, ) # Second task name = "callable method" graph.addNewCallable(
def submit(job, poolName=None, maxRN=-1): g = Graph(job.name, job, username(), poolName, maxRN) print g.submit(gethost(), getport())