Esempio n. 1
0
def main():
    # initialize DrQueue client
    client = DrQueueClient()
    # fetch a list of all jobs
    jobs = client.query_job_list()
        
    # walk through tasks of every job
    for job in jobs:
        tasks = client.query_task_list(job['_id'])
        
        print("\nJob \"%s\" (ID: %s):" % (job['name'], job['_id']))
        print("Overall status: " + client.job_status(job['_id']))
        print("Task id                                 status    owner       completed at")
        
        for task in tasks:
            tmsg_id = task['msg_id']
            theader = task['header']
            username = theader['username']
        
            if task['completed'] == None:
                status = "pending"
                print("%s   %s  %s" % (tmsg_id, string.ljust(status, 8), string.ljust(username, 10)))
            else:
                result_header = task['result_header']
                result_content = task['result_content']
                status = result_header['status']
                cpl = task['completed']
                print("%s   %s  %s  %i-%02i-%02i %02i:%02i:%02i" % (tmsg_id, string.ljust(status, 8), string.ljust(username, 10), cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))

                if result_header['status'] == 'error':
                    print "  Error was: " + result_content['evalue']
Esempio n. 2
0
 def __init__(self, parent = None):
     """Initialize window."""
     super(SendJob, self).__init__(parent)
     # setup user interface
     self.setupUi(self)
     self.setWindowIcon(QtGui.QIcon(os.path.join(icons_path, "main.svg")))
     self.setWindowTitle("drQt - Create New Job")
     # disable all extra options tabs
     self.remove_options_tabs()
     # create client connection
     self.client = DrQueueClient()
     # fill form with default values
     self.set_default_values()
Esempio n. 3
0
def main():
    client = DrQueueClient()
    while True:
        jobs = DrQueueJob.query_job_status('ready')

        if jobs == []:
            print "Not find any jobs in data base!waiting...."
            time.sleep(60)
            continue

        for job in jobs:
            print "Process job %s" % job["name"]
            try:
                #pdb.set_trace()
                job["job_status"] = u'running'
                DrQueueJob.update_db(job)

                client.job_run(job)
                #print job['job_id']
            except ValueError:
                print "Job's name %s " % job['name']
                print("One of your the specified values produced an error:")
Esempio n. 4
0
def main():
    # initialize DrQueue client
    client = DrQueueClient()
    # fetch a list of all jobs
    jobs = client.query_job_list()

    # walk through tasks of every job
    for job in jobs:
        tasks = client.query_task_list(job['_id'])
        meantime, time_left, finish_time = client.job_estimated_finish_time(
            job['_id'])
        frame = job['startframe']

        print("\nJob \"%s\" (ID: %s):" % (job['name'], job['_id']))
        print("Overall status: " + client.job_status(job['_id']))
        print("Enabled: %s" % job['enabled'])
        print("Submit time: " + str(job['submit_time']))
        if job['requeue_time'] != False:
            print("Requeue time: " + str(job['requeue_time']))
        print("Time per task: " + str(meantime))
        if client.query_job_tasks_left(job['_id']) > 0:
            print("Time left: " + str(time_left))
            print("Estimated finish time: " + str(finish_time))
        else:
            print("Finish time: " + str(finish_time))
        if 'pool_name' in job['limits']:
            print("Pool: " + str(job['limits']['pool_name']))
        else:
            print("Pool: Not set.")
        print("Task id\t\t\t\t\tframe\tstatus\towner\tcompleted at")

        for task in tasks:
            tmsg_id = task['msg_id']
            theader = task['header']
            username = theader['username']

            if task['completed'] == None:
                status = "pending"
                print("%s\t%i\t%s\t%s" % (tmsg_id, frame, status, username))
            else:
                result_header = task['result_header']
                result_content = task['result_content']
                print(result_header)
                status = result_content['status']
                cpl = task['completed']
                print("%s\t%i\t%s\t%s\t%i-%02i-%02i %02i:%02i:%02i" %
                      (tmsg_id, frame, status, username, cpl.year, cpl.month,
                       cpl.day, cpl.hour, cpl.minute, cpl.second))

                if result_content['status'] == 'error':
                    print("  Error was: " + result_content['evalue'] + "\n" +
                          str(result_content['traceback']))
            if int(job['blocksize']) > 1:
                frame += int(job['blocksize'])
            else:
                frame += 1
Esempio n. 5
0
def main():
    # initialize DrQueue client
    client = DrQueueClient()
    # fetch a list of all jobs
    jobs = client.query_job_list()
        
    # walk through tasks of every job
    for job in jobs:
        tasks = client.query_task_list(job['_id'])
        meantime, time_left, finish_time = client.job_estimated_finish_time(job['_id'])
        frame = job['startframe']
        
        print("\nJob \"%s\" (ID: %s):" % (job['name'], job['_id']))
        print("Overall status: " + client.job_status(job['_id']))
        print("Enabled: %s" % job['enabled'])
        print("Submit time: " + str(job['submit_time']))
        if job['requeue_time'] != False:
            print("Requeue time: "+ str(job['requeue_time']))
        print("Time per task: " + str(meantime))
        if client.query_job_tasks_left(job['_id']) > 0:
            print("Time left: " + str(time_left))
            print("Estimated finish time: " + str(finish_time))
        else:
            print("Finish time: " + str(finish_time))
        if 'pool_name' in job['limits']:
        	print("Pool: " + str(job['limits']['pool_name']))
        else:
        	print("Pool: Not set.")
        print("Task id\t\t\t\t\tframe\tstatus\towner\tcompleted at")
        
        for task in tasks:
            tmsg_id = task['msg_id']
            theader = task['header']
            username = theader['username']
        
            if task['completed'] == None:
                status = "pending"
                print("%s\t%i\t%s\t%s" % (tmsg_id, frame, status, username))
            else:
                result_header = task['result_header']
                result_content = task['result_content']
                print(result_header)
                status = result_content['status']
                cpl = task['completed']
                print("%s\t%i\t%s\t%s\t%i-%02i-%02i %02i:%02i:%02i" % (tmsg_id, frame, status, username, cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))

                if result_content['status'] == 'error':
                	print("  Error was: " + result_content['evalue'] + "\n" + str(result_content['traceback']))
            if int(job['blocksize']) > 1:
            	frame += int(job['blocksize'])
            else:
            	frame += 1
Esempio n. 6
0
def main():
    client = DrQueueClient()
    while True:
        jobs = DrQueueJob.query_job_status('ready')

        if jobs == []:
            print "Not find any jobs in data base!waiting...."
            time.sleep(60)
            continue

        for job in jobs:
            print "Process job %s" % job["name"]
            try:
                #pdb.set_trace()
                job["job_status"] = u'running'
                DrQueueJob.update_db(job)

                client.job_run(job)
                #print job['job_id']
            except ValueError:
                print "Job's name %s " % job['name']
                print("One of your the specified values produced an error:")
        #time.sleep(10)

            # tasks which have been created
    tasks = client.query_task_list(job['_id'])

    # wait for all tasks of job to finish
    if (tasks == []) and (client.query_computer_list() == []):
        print("Tasks have been sent but no render node is running at the moment.")
        exit(0)

    for task in tasks:
        ar = client.task_wait(task['msg_id'])
        # add some verbose output
        cpl = ar.metadata.completed
        msg_id = ar.metadata.msg_id
        status = ar.status
        engine_id = ar.metadata.engine_id
        print("Task %s finished with status '%s' on engine %i at %i-%02i-%02i %02i:%02i:%02i." % (msg_id, status, engine_id, cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))
        if ar.pyerr != None:
            print(ar.pyerr)


    job['job_status'] = 'completed'
    DrQueueJob.update_db(job)
    print("Job %s finished." % job['name'])
Esempio n. 7
0
def main():
    # initialize DrQueue client
    client = DrQueueClient()
    # fetch a list of all jobs
    jobs = client.query_job_list()
        
    # walk through tasks of every job
    for job in jobs:
        tasks = client.query_task_list(job['_id'])
        meantime, time_left, finish_time = client.job_estimated_finish_time(job['_id'])
        
        print("\nJob \"%s\" (ID: %s):" % (job['name'], job['_id']))
        print("Overall status: " + client.job_status(job['_id']))
        print("Submit time: "+ str(job['submit_time']))
        if job['requeue_time'] != False:
            print("Requeue time: "+ str(job['requeue_time']))
        print("Time per task: " + str(meantime))
        if client.query_job_tasks_left(job['_id']) > 0:
            print("Time left: " + str(time_left))
            print("Estimated finish time: " + str(finish_time))
        else:
            print("Finish time: " + str(finish_time))
        print("Task id                                 status    owner       completed at")
        
        for task in tasks:
            tmsg_id = task['msg_id']
            theader = task['header']
            username = theader['username']
        
            if task['completed'] == None:
                status = "pending"
                print("%s   %s  %s" % (tmsg_id, string.ljust(status, 8), string.ljust(username, 10)))
            else:
                result_header = task['result_header']
                result_content = task['result_content']
                status = result_header['status']
                cpl = task['completed']
                print("%s   %s  %s  %i-%02i-%02i %02i:%02i:%02i" % (tmsg_id, string.ljust(status, 8), string.ljust(username, 10), cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))

                if result_header['status'] == 'error':
                    print("  Error was: " + result_content['evalue'])
Esempio n. 8
0
def main():
    # parse arguments
    parser = OptionParser()
    parser.usage = "%prog [options] -n name -r renderer -f scenefile"
    parser.add_option("-s", "--startframe",
                      dest="startframe", default=1, help="first frame")
    parser.add_option("-e", "--endframe",
                      dest="endframe", default=1, help="last frame")
    parser.add_option("-b", "--blocksize",
                      dest="blocksize", default=1, help="size of block")
    parser.add_option("-n", "--name",
                      dest="name", default=None, help="name of job")
    parser.add_option("-r", "--renderer",
                      dest="renderer", help="render type (maya|blender|mentalray)")
    parser.add_option("-f", "--scenefile",
                      dest="scenefile", default=None, help="path to scenefile")
    parser.add_option("-p", "--pool",
                      dest="pool", default=None, help="pool of computers")
    parser.add_option("-o", "--options",
                      dest="options", default="{}", help="specific options for renderer as Python dict")
    parser.add_option("--retries",
                      dest="retries", default=1, help="number of retries for every task")
    parser.add_option("--owner",
                      dest="owner", default=getpass.getuser(), help="Owner of job. Default is current username.")
    parser.add_option("--os",
                      dest="os", default=None, help="Operating system.")
    parser.add_option("--minram",
                      dest="minram", default=0, help="Minimal RAM in GB.")
    parser.add_option("--mincores",
                      dest="mincores", default=0, help="Minimal CPU cores.")
    parser.add_option("--send-email",
                      action="store_true", dest="send_email", default=False, help="Send notification email when job is finished.")
    parser.add_option("--email-recipients",
                      dest="email_recipients", default=None, help="Recipients for notification email.")
    parser.add_option("-w", "--wait",
                      action="store_true", dest="wait", default=False, help="wait for job to finish")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False, help="verbose output")
    (options, args) = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    # set limits
    limits = dict()
    limits['pool_name'] = options.pool
    limits['os'] = options.os
    limits['minram'] = int(options.minram)
    limits['mincores'] = int(options.mincores)

    options_var = eval(options.options)
    options_var['send_email'] = options.send_email
    options_var['email_recipients'] = options.email_recipients

    # initialize DrQueue job
    job = DrQueueJob(options.name, int(options.startframe), int(options.endframe), int(options.blocksize), options.renderer, options.scenefile, options.retries, options.owner, options_var, "send_job.py", limits)

    # run job with client
    try:
        client.job_run(job)
    except ValueError:
        print("One of your the specified values produced an error:")
        raise
        exit(1)

    # tasks which have been created
    tasks = client.query_task_list(job['_id'])

    # wait for all tasks of job to finish
    if options.wait:
        if (tasks == []) and (client.query_engine_list() == []):
            print("Tasks have been sent but no render node is running at the moment.")
            exit(0)

        for task in tasks:
            ar = client.task_wait(task['msg_id'])
            # add some verbose output
            if options.verbose:
                cpl = ar.metadata.completed
                msg_id = ar.metadata.msg_id
                status = ar.status
                engine_id = ar.metadata.engine_id
                print("Task %s finished with status '%s' on engine %i at %i-%02i-%02i %02i:%02i:%02i." % (msg_id, status, engine_id, cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))
                if ar.pyerr != None:
                    print(ar.pyerr)
        print("Job %s finished." % job['name'])
Esempio n. 9
0
def main():
    # parse arguments
    parser = OptionParser()
    parser.usage = "%prog [options] -n name"
    parser.add_option("-n", "--name ",
                      dest="name", help="name of job")
    parser.add_option("-i", "--id ",
                      dest="id", default=0, help="id of job")
    parser.add_option("-s", "--stop",
                      action="store_true", dest="stop", default=False, help="stop the job")
    parser.add_option("-k", "--kill",
                      action="store_true", dest="kill", default=False, help="stop the job (be careful, running tasks will be killed)")
    parser.add_option("-d", "--delete",
                      action="store_true", dest="delete", default=False, help="delete the job (be careful, no confirmation asked)")
    parser.add_option("-c", "--continue",
                      action="store_true", dest="cont", default=False, help="continue a previously stopped job")
    parser.add_option("-r", "--rerun",
                      action="store_true", dest="rerun", default=False, help="rerun job")
    parser.add_option("-t", "--status",
                      action="store_true", dest="status", default=False, help="show the status of the job")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False, help="verbose output")
    (options, args) = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    # get job information
    if options.id == 0:
        job = DrQueueJob.query_job_by_name(options.name)
        if job == None:
            print("Specified job does not exist.")
            sys.exit(1)
        job_id = job['_id']
        job_name = options.name
    else:
        job_id = options.id
        job = DrQueueJob.query_db(job_id)
        if job == None:
            print("Specified job does not exist.")
            sys.exit(1)
        job_name = job['name']

    # run specified action on job
    if options.stop:
        client.job_stop(job_id)
        print("Job %s has been stopped." % job_name)
        return
    if options.kill:
        client.job_kill(job_id)
        print("Job %s has been killed." % job_name)
        return
    if options.delete:
        client.job_delete(job_id)
        print("Job %s has been deleted." % job_name)
        return
    if options.cont:
        client.job_continue(job_id)
        print("Job %s is running again." % job_name)
        return
    if options.rerun:
        client.job_rerun(job_id)
        print("Job %s is running another time." % job_name)
        return
    if options.status:
        status = client.job_status(job_id)
        print("The status of job %s is \"%s\"" % (job_name, status))
        return
Esempio n. 10
0
def main():
    # parse arguments
    parser = OptionParser()
    parser.usage = "%prog [options] -i id"
    parser.add_option("-i", "--id ",
                      dest="id", default=None, help="id of computer")
    parser.add_option("-a", "--all ",
                      action="store_true", dest="all", default=False, help="use all computers")
    parser.add_option("-s", "--shutdown",
                      action="store_true", dest="shutdown", default=False, help="shutdown computer")
    parser.add_option("-p", "--pools",
                      dest="pools", default=None, help="add computer to one or more pools")
    parser.add_option("--info",
                      action="store_true", dest="info", default=False, help="show information about computer")
    parser.add_option("-t", "--status",
                      action="store_true", dest="status", default=False, help="show status of computer")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False, help="verbose output")
    (options, args) = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    cache_time = 60

    # engines to work on
    if options.id != None:
        computers = []
        computers.append(int(options.id))
    if options.all == True:
        computers = client.ip_client.ids

    # run specified action
    if options.shutdown:
        for computer in computers:
            client.engine_stop(computer)
        print("Computer %s has been shut down." % str(computers))
        return True
    if options.pools:
        for computer in computers:
            DrQueueComputer.set_pools(computer, options.pools.split(","))
            print("Computer %i has been added to pools %s." % (computer, options.pools.split(",")))
        return True
    if options.info:
        for computer in computers:
            print("Engine "+str(computer)+ ":")
            comp = client.identify_computer(computer, cache_time)
            print(" hostname: "+comp['hostname'])
            print(" arch: "+comp['arch'])
            print(" os: "+comp['os'])
            print(" nbits: "+str(comp['nbits']))
            print(" procspeed: "+comp['procspeed'])
            print(" ncpus: "+str(comp['ncpus']))
            print(" ncorescpu: "+str(comp['ncorescpu']))
            print(" memory: "+comp['memory'])
            print(" load: "+comp['load'])
            print(" pools: "+str(DrQueueComputer.get_pools(computer))+"\n")
        return True
    if options.status:
        for computer in computers:
            print("Engine "+str(computer)+ ":")
            status = client.ip_client.queue_status(computer, verbose=True)
            print(" status:")
            print("  in queue: "+str(status['queue']))
            print("  completed: "+str(status['completed']))
            print("  tasks: "+str(status['tasks']))
        return True
Esempio n. 11
0
def main():
    # parse arguments
    parser = OptionParser()
    parser.usage = "%prog [options] -n name -r renderer -f scenefile"
    parser.add_option("-s", "--startframe",
                      dest="startframe", default=1, help="first frame")
    parser.add_option("-e", "--endframe",
                      dest="endframe", default=1, help="last frame")
    parser.add_option("-b", "--blocksize",
                      dest="blocksize", default=1, help="size of block")
    parser.add_option("-n", "--name",
                      dest="name", default=None, help="name of job")
    parser.add_option("-r", "--renderer",
                      dest="renderer", help="render type (maya|blender|mentalray)")
    parser.add_option("-f", "--scenefile",
                      dest="scenefile", default=None, help="path to scenefile")
    parser.add_option("-p", "--pool",
                      dest="pool", default=None, help="pool of computers")
    parser.add_option("-o", "--options",
                      dest="options", default="{}", help="specific options for renderer as Python dict")
    parser.add_option("--retries",
                      dest="retries", default=1, help="number of retries for every task")
    parser.add_option("--owner",
                      dest="owner", default=getpass.getuser(), help="Owner of job. Default is current username.")
    parser.add_option("--os",
                      dest="os", default=None, help="Operating system.")
    parser.add_option("--minram",
                      dest="minram", default=0, help="Minimal RAM in GB.")
    parser.add_option("--mincores",
                      dest="mincores", default=0, help="Minimal CPU cores.")
    parser.add_option("--send-email",
                      action="store_true", dest="send_email", default=False, help="Send notification email when job is finished.")
    parser.add_option("--email-recipients",
                      dest="email_recipients", default=None, help="Recipients for notification email.")
    parser.add_option("-w", "--wait",
                      action="store_true", dest="wait", default=False, help="wait for job to finish")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False, help="verbose output")
    (options, args) = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    # set limits
    limits = dict()
    limits['pool_name'] = options.pool
    limits['os'] = options.os
    limits['minram'] = int(options.minram)
    limits['mincores'] = int(options.mincores)

    options_var = eval(options.options)
    options_var['send_email'] = options.send_email
    options_var['email_recipients'] = options.email_recipients

    # add default rendertype if missing
    if "rendertype" not in options_var:
        options_var['rendertype'] = "animation"

    # initialize DrQueue job
    job = DrQueueJob(options.name, int(options.startframe), int(options.endframe), int(options.blocksize), options.renderer, options.scenefile, options.retries, options.owner, options_var, "send_job.py", limits)

    # run job with client
    try:
        client.job_run(job)
    except ValueError:
        print("One of your the specified values produced an error:")
        raise
        exit(1)

    # tasks which have been created
    tasks = client.query_task_list(job['_id'])

    # wait for all tasks of job to finish
    if options.wait:
        if (tasks == []) and (client.query_computer_list() == []):
            print("Tasks have been sent but no render node is running at the moment.")
            exit(0)

        for task in tasks:
            ar = client.task_wait(task['msg_id'])
            # add some verbose output
            if options.verbose:
                cpl = ar.metadata.completed
                msg_id = ar.metadata.msg_id
                status = ar.status
                engine_id = ar.metadata.engine_id
                print("Task %s finished with status '%s' on engine %i at %i-%02i-%02i %02i:%02i:%02i." % (msg_id, status, engine_id, cpl.year, cpl.month, cpl.day, cpl.hour, cpl.minute, cpl.second))
                if ar.pyerr != None:
                    print(ar.pyerr)
        print("Job %s finished." % job['name'])
def main():
    # parse arguments
    parser = OptionParser()
    parser.usage = "%prog [options] -i id"
    parser.add_option("-i", "--id ",
                      dest="id", default=None, help="id of computer")
    parser.add_option("-a", "--all ",
                      action="store_true", dest="all", default=False, help="use all computers")
    parser.add_option("-s", "--shutdown",
                      action="store_true", dest="shutdown", default=False, help="shutdown computer")
    parser.add_option("-p", "--pools",
                      dest="pools", default=None, help="add computer to one or more pools")
    parser.add_option("--info",
                      action="store_true", dest="info", default=False, help="show information about computer")
    parser.add_option("-t", "--status",
                      action="store_true", dest="status", default=False, help="show status of computer")
    parser.add_option("-v", "--verbose",
                      action="store_true", dest="verbose", default=False, help="verbose output")
    (options, args) = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    cache_time = 60

    # engines to work on
    if options.id != None:
        computers = []
        computers.append(int(options.id))
    if options.all == True:
        computers = client.ip_client.ids

    # run specified action
    if options.shutdown:
        for computer in computers:
            client.engine_stop(computer)
        print("Computer %s has been shut down." % str(computers))
        return True
    if options.pools:
        for computer in computers:
            comp = client.identify_computer(computer, cache_time)
            client.computer_set_pools(comp, options.pools.split(","))
            print("Computer %i has been added to pools %s." % (computer, options.pools.split(",")))
        return True
    if options.info:
        for computer in computers:
            print("Engine " + str(computer) + ":")
            comp = client.identify_computer(computer, cache_time)
            print(" hostname: " + comp['hostname'])
            print(" arch: " + comp['arch'])
            print(" os: " + comp['os'])
            print(" nbits: " + str(comp['nbits']))
            print(" procspeed: " + comp['procspeed'])
            print(" ncpus: " + str(comp['ncpus']))
            print(" ncorescpu: " + str(comp['ncorescpu']))
            print(" memory: " + str(comp['memory']))
            print(" load: " + comp['load'])
            print(" pools: " + ','.join(comp['pools']) + "\n")
        return True
    if options.status:
        for computer in computers:
            print("Engine " + str(computer) + ":")
            status = client.ip_client.queue_status(computer, verbose=True)
            print(" status:")
            print("  in queue: " + str(status['queue']))
            print("  completed: " + str(status['completed']))
            print("  tasks: " + str(status['tasks']))
        return True
Esempio n. 13
0
class SendJob(sendJob_widget_class, sendJob_base_class):
    def __init__(self, parent = None):
        """Initialize window."""
        super(SendJob, self).__init__(parent)
        # setup user interface
        self.setupUi(self)
        self.setWindowIcon(QtGui.QIcon(os.path.join(icons_path, "main.svg")))
        self.setWindowTitle("drQt - Create New Job")
        # disable all extra options tabs
        self.remove_options_tabs()
        # create client connection
        self.client = DrQueueClient()
        # fill form with default values
        self.set_default_values()


    def set_default_values(self):
        """Set default values on form elements"""
        url = QtCore.QUrl("lib/ui/about.html")
        self.webView.load(url)
        self.owner_box.setText(getpass.getuser())
        # load list of supported renderers from DrQueue module
        self.renderer_box.insertItem (0, "Choose renderer")
        renderers = DrQueue.supported_renderers
        i = 1
        for renderer in renderers:
            self.renderer_box.insertItem (i, renderer)
            i += 1
        # load list of available pools
        self.pool_box.insertItem (0, "Choose pool")
        pools = DrQueueComputerPool.query_poolnames()
        i = 1
        for pool in pools:
            self.pool_box.insertItem (i, pool)
            i += 1
        # load list of supported os from DrQueue module
        self.os_box.insertItem (0, "Choose OS")
        supported_os = DrQueue.supported_os
        i = 1
        for os in supported_os:
            self.os_box.insertItem (i, os)
            i += 1
        # load list of running jobs
        self.depend_box.insertItem (0, "Choose running job")
        running_jobs = self.client.query_running_job_list()
        i = 1
        for job in running_jobs:
            self.depend_box.insertItem (i, job['name'])
            i += 1
        # filter for file chooser
        self.scenefile_filter = "*"


    def openFileChooser(self):
        """Open file chooser widget."""
        fileName = QtGui.QFileDialog.getOpenFileName(self, "Choose scenefile", self.scenefile_box.text(), self.scenefile_filter)
        print(fileName)
        self.scenefile_box.setText(fileName)
        self.show()
        self.raise_()


    def remove_options_tabs(self):
        """Remove old tab with extra options"""
        index = self.tabWidget.indexOf(self.blender_tab)
        if index != -1:
            self.tabWidget.removeTab(index)
        index = self.tabWidget.indexOf(self.maya_tab)
        if index != -1:
            self.tabWidget.removeTab(index)


    def rendererChanged(self):
        """Change extra options when another renderer is selected."""
        active = str(self.renderer_box.currentText())
        if active == "3delight":
            self.scenefile_filter = "*.rib"
            self.remove_options_tabs()
        elif active == "3dsmax":
            self.scenefile_filter = "*.max"
            self.remove_options_tabs()
        elif active == "blender":
            self.scenefile_filter = "*.blend"
            self.remove_options_tabs()
            self.tabWidget.insertTab(1, self.blender_tab, "Blender")
        elif active == "maya":
            self.scenefile_filter = "*.ma *.mb"
            self.remove_options_tabs()
            self.tabWidget.insertTab(1, self.maya_tab, "Maya")
        elif active == "mentalray":
            self.scenefile_filter = "*.mi"
            self.remove_options_tabs()
        else:
            self.scenefile_filter = "*"
            self.remove_options_tabs()
        print(active)


    def accept(self):
        """Take all form values, create job and send it to IPython."""
        print("creating job ...")
        # fetch values from form elements
        name = str(self.name_box.text())
        startframe = int(self.startframe_box.value())
        endframe = int(self.endframe_box.value())
        blocksize = int(self.blocksize_box.value())
        renderer = str(self.renderer_box.currentText())
        scenefile = str(self.scenefile_box.text())
        retries = int(self.retries_box.value())
        owner = str(self.owner_box.text())
        options = {}
        limits = {}
        limits['pool_name'] = str(self.pool_box.currentText())
        # pool needs to have a real value
        if limits['pool_name'] == "Choose pool":
            limits['pool_name'] = None
        limits['os'] = str(self.os_box.currentText())
        # os needs to have a real value
        if limits['os'] == "Choose OS":
            limits['os'] = None
        limits['depend'] = str(self.depend_box.currentText())
        # depend needs to have a real value
        if limits['depend'] == "Choose running job":
            limits['depend'] = None
        limits['minram'] = int(self.minram_box.value())
        limits['mincores'] = int(self.mincores_box.value())
        options['send_email'] = self.sendemail_box.isChecked()
        options['email_recipients'] = str(self.email_recipients_box.text())
        # check renderer specific options
        if renderer == "blender":
            # check rendertype
            if self.animation_button.isChecked():
                options['rendertype'] = 'animation'
            else:
                options['rendertype'] = 'single'
        # create job object
        try:
            # TODO: add os, email, min ram, min cores, depend on job
            job = DrQueueJob(name, startframe, endframe, blocksize, renderer, scenefile, retries, owner, options, limits)
        except ValueError as strerror:
            message = str(strerror)
            print(message)
            self.status_red(message)
            return False
        # run job with client
        try:
            print(job)
            status = self.client.job_run(job)
        except ValueError as strerror:
            message = str(strerror)
            print(message)
            self.status_red(message)
            return False
        if status == True:
            #message = "Job successfully sent to IPython."
            #print(message)
            #self.status_green(message)
            #close_after_delay(2)
            self.close()
            return True


    def status_green(self, text):
        pal = QtGui.QPalette()
        bgc = QtGui.QColor(152, 229, 134)
        pal.setColor(QtGui.QPalette.Base, bgc)
        textc = QtGui.QColor(0, 0, 0)
        pal.setColor(QtGui.QPalette.Text, textc)
        self.status_box.setPalette(pal)
        self.status_box.setText(text)


    def status_red(self, text):
        pal = QtGui.QPalette()
        bgc = QtGui.QColor(229, 91, 91)
        pal.setColor(QtGui.QPalette.Base, bgc)
        textc = QtGui.QColor(0, 0, 0)
        pal.setColor(QtGui.QPalette.Text, textc)
        self.status_box.setPalette(pal)
        self.status_box.setText(text)
Esempio n. 14
0
# -*- coding: utf-8 -*-
"""
List information about connected computers
Copyright (C) 2011 Andreas Schroeder

This file is part of DrQueue.

Licensed under GNU General Public License version 3. See LICENSE for details.
"""

from DrQueue import Client

c = Client()

cache_time = 60

for comp_id in c.ip_client.ids:
    print("Engine " + str(comp_id) + ":")
    comp = c.identify_computer(comp_id, cache_time)
    if comp == None:
        print(" Engine is blocked. Try again later.")
    else:
        print(" hostname: " + comp['hostname'])
        print(" address: " + comp['address'])
        print(" arch: " + comp['arch'])
        print(" os: " + comp['os'])
        print(" proctype: " + str(comp['proctype']))
        print(" nbits: " + str(comp['nbits']))
        print(" procspeed: " + str(comp['procspeed']))
        print(" ncpus: " + str(comp['ncpus']))
        print(" ncorescpu: " + str(comp['ncorescpu']))
Esempio n. 15
0
# -*- coding: utf-8 -*-

"""
List information about connected computers
Copyright (C) 2011 Andreas Schroeder

This file is part of DrQueue.

Licensed under GNU General Public License version 3. See LICENSE for details.
"""

from DrQueue import Client

c = Client()

cache_time = 60

for comp_id in c.ip_client.ids:
    print("Engine " + str(comp_id) + ":")
    comp = c.identify_computer(comp_id, cache_time)
    print(" hostname: " + comp['hostname'])
    print(" arch: " + comp['arch'])
    print(" os: " + comp['os'])
    print(" proctype: " + comp['proctype'])
    print(" nbits: " + str(comp['nbits']))
    print(" procspeed: " + comp['procspeed'])
    print(" ncpus: " + str(comp['ncpus']))
    print(" ncorescpu: " + str(comp['ncorescpu']))
    print(" memory: " + str(comp['memory']) + " GB")
    print(" load: " + comp['load'])
    status = c.ip_client.queue_status(comp_id, verbose=True)
Esempio n. 16
0
def main():
    # parse arguments
    parser = argparse.ArgumentParser()
    parser.add_argument("-n",
                        "--name ",
                        dest="name",
                        default="",
                        help="name of job")
    parser.add_argument("-i",
                        "--id ",
                        dest="id",
                        default=0,
                        help="id of job ('ALL' for all jobs)")
    parser.add_argument("--tid ",
                        dest="tid",
                        default=0,
                        help="id of task ('ALL' for all tasks)")
    parser.add_argument("-s",
                        "--stop",
                        action="store_true",
                        dest="stop",
                        default=False,
                        help="stop the job")
    parser.add_argument(
        "-k",
        "--kill",
        action="store_true",
        dest="kill",
        default=False,
        help="stop the job (be careful, running tasks will be killed)")
    parser.add_argument(
        "-d",
        "--delete",
        action="store_true",
        dest="delete",
        default=False,
        help="delete the job (be careful, no confirmation asked)")
    parser.add_argument("-c",
                        "--continue",
                        action="store_true",
                        dest="cont",
                        default=False,
                        help="continue a previously stopped job")
    parser.add_argument("-r",
                        "--rerun",
                        action="store_true",
                        dest="rerun",
                        default=False,
                        help="rerun job with ID 'id'")
    parser.add_argument(
        "-R",
        "--rerun_task",
        action="store_true",
        dest="rerun_task",
        default=False,
        help="rerun task with ID 'tid' of job identified by ID 'id' or NAME 'n'"
    )
    parser.add_argument("-F",
                        "--rerun_interrupted_tasks",
                        action="store_true",
                        dest="rerun_interrupted_tasks",
                        default=False,
                        help="rerun interrupted tasks")
    parser.add_argument("-t",
                        "--status",
                        action="store_true",
                        dest="status",
                        default=False,
                        help="show the status of the job")
    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        dest="verbose",
                        default=False,
                        help="verbose output")
    args = parser.parse_args()

    # initialize DrQueue client
    client = DrQueueClient()

    # get job information by name
    if (args.id == 0) and (args.name != ""):
        jobs = []
        job = client.query_job_by_name(args.name)
        if job == None:
            print("Specified job does not exist.")
            sys.exit(1)
        jobs.append(job)
    # get job information by id
    elif (args.id != 0) and (args.name == ""):
        if args.id == "ALL":
            jobs = client.query_job_list()
        else:
            jobs = []
            job = client.query_job_by_id(args.id)
            if job == None:
                print("Specified job does not exist.")
                sys.exit(1)
            jobs.append(job)
    # id and name are missing
    else:
        parser.print_help()
        sys.exit(1)

    # work on task id
    if args.tid != 0:
        if args.rerun_task:
            client.task_rerun(args.tid)
            print("Task %s of job %s is running another time." %
                  (args.tid, jobs[0]['name']))
            return

    # run specified action on job(s)
    for job in jobs:
        if args.stop:
            client.job_stop(job['_id'])
            print("Job %s has been stopped.\n" % job['name'])
        if args.kill:
            client.job_kill(job['_id'])
            print("Job %s has been killed.\n" % job['name'])
        if args.delete:
            client.job_delete(job['_id'])
            print("Job %s has been deleted.\n" % job['name'])
        if args.cont:
            client.job_continue(job['_id'])
            print("Job %s is running again.\n" % job['name'])
        if args.rerun:
            client.job_rerun(job['_id'])
            print("Job %s is running another time.\n" % job['name'])
        if args.rerun_interrupted_tasks:
            client.job_rerun_interrupted_tasks(job['_id'])
            print("Interrupted tasks of job %s are running another time.\n" %
                  job['name'])
        if args.status:
            status = client.job_status(job['_id'])
            print("The status of job %s is \"%s\"\n" % (job['name'], status))
    return