示例#1
0
def hostlist():

    # Introducimos los IDs de los JOBs. No es necesario que haya Preview
    print 'No es necesario que haya PREVIEW\n'
    previewID = raw_input('Inserta el ID del Preview:\t')
    renderID = raw_input('Inserta el ID del Render:\t')

    job_subjobs = qb.jobinfo(fields=['subjobs'], id=[previewID,renderID])
    job_agenda = qb.jobinfo(fields=['agenda'], id=[previewID,renderID])
    job_render_subjobs = job_subjobs[0]
    job_render_agenda = job_agenda[0]['agenda']

    if previewID:
        job_preview_subjobs = job_subjobs[0]
        job_render_subjobs = job_subjobs[1]
        job_preview_agenda = job_agenda[0]['agenda']
        job_render_agenda = job_agenda[1]['agenda']
        job_agenda = job_preview_agenda + job_render_agenda
    else:
        job_agenda = job_render_agenda

    job_agenda_temp = {}

    #Creacion de un archivo de texto
    hosttext = open("T:\\renderfarm\\amp\\Documents\\HostList\\" + renderID + "_Hostlist.txt", 'w')

    # Recorre los frames del JOB, te muestra en pantalla y te lo copia al archivo de texto
    for frame in xrange(len(job_agenda)):
        #print job_agenda[frame]['name'], job_agenda[frame]['host']
        hosttext.write(job_agenda[frame]['name'] + ' ' + job_agenda[frame]['host'] + '\n')
示例#2
0
def nuke():
    while 1:
        name = re.compile(r'[n]')
        try:
            for i in range(len(qb.jobinfo(status='running'))):
                if name.match(qb.jobinfo(status='running')[i]['name']):

                    if qb.jobinfo(status='running')[i]['cpus'] != qb.jobinfo(
                            status='running')[i]['todo']:
                        if qb.jobinfo(status='running')[i]['todo'] < 200:
                            qb.modify(
                                {
                                    'cpus':
                                    qb.jobinfo(status='running')[i]['todo']
                                },
                                qb.jobinfo(status='running')[i]['id'])
                        else:
                            pass
                            qb.modify({'cpus': 200},
                                      qb.jobinfo(status='running')[i]['id'])
                    #content = qb.jobinfo(status = 'running')[i]['user'] + '  ' + str(qb.jobinfo(status = 'running')[i]['todo'])
                    #if str(qb.jobinfo(status = 'running')[i]['todo']) >= 200:
                    #baseMessage.send('zengxp', content, account=ACCOUNT, password=PASSWORD )
        except IndexError:
            print 'cuole'
        time.sleep(10)
示例#3
0
    def GetJobs(self):
    # Get all the priority Jobs in Qube

        import qb
        import os
        global info

        jobList = qb.jobinfo()
        jobCount = len(jobList)
        output_list = {}
        temp_list = []
        counter = 0
        for jobs in xrange(jobCount):
            job_name = jobList[jobs]['name']
            # job_data = jobList[jobs]['data']
            job_id = jobList[jobs]['id']
            job_user = jobList[jobs]['user']
            job_status = jobList[jobs]['status']
            job_priority = jobList[jobs]['priority']
            if not "complete" in job_status:
                if not "killed" in job_status:
                    if not "dying" in job_status:
                        if job_priority <= 1499:
                            info = [str(job_id), job_name, job_user, str(job_priority)]
                            self.mainWindow.twJobs.sortItems(3, QtCore.Qt.DescendingOrder)
                            self.mainWindow.twJobs.insertTopLevelItems(0, [QTreeWidgetItem(self.mainWindow.twJobs, info)])
示例#4
0
def hython():
    while 1:
        name = re.compile(r'[cwb0320]|[cwb0380]|[cwb0390]')
        for i in range(len(qb.jobinfo(status='running'))):
            if name.search(qb.jobinfo(status='running')[i]['name']):
                mission.append(qb.jobinfo(status='running')[i]['name'])
                print qb.jobinfo(status='running')[i]['name']
                print qb.jobinfo(status='running')[i]['priority']

        print '\n'
        time.sleep(10)
示例#5
0
def main():
    # Introducimos los IDs de los JOBs.
    jobID = raw_input('Introduce el ID Job: ')


    # Gather all the information
    job = qb.jobinfo(fields=['agenda', 'subjobs', 'callbacks'], id=[jobID])

    # Asignamos las variables a la informacion del Qube del primer Job
    jobName = job[0]['name']
    assetVersion = job[0]['package']['assetVersion']
    jobPreset = job[0]['package']['render_preset']
    jobUser = job[0]['user']
    mayaFile = job[0]['package']['mayafile']
    joblayer = job[0]['package']['render_layer']
    jobCamera = job[0]['package']['selected_camera']
    jobRange = job[0]['package']['range']
    jobResolution = job[0]['package']['preset_resolution']


    # Compare all the gather information

    print ""
    print 'Name'
    print jobName
    print ""
    print 'AssetVersion'
    print assetVersion
    print ""
    print 'Preset'
    print jobPreset
    print ""
    print 'User'
    print jobUser
    print ""
    print 'Layer'
    print joblayer
    print ""
    print 'MayaFile'
    print mayaFile
    print ""
    print 'Camera'
    print jobCamera
    print ''
    print 'Range'
    print jobRange
    print ''
    print 'Resolution'
    print jobResolution
    print ''
示例#6
0
文件: Control.py 项目: XPilot/Qube
    def getSegments(self, segmentNameList=[]):
        '''
        Load the all segments from the qube job object.
        '''

        agenda = qb.jobinfo(id=self.job.qubejob['id'], agenda=True)[0]['agenda']
        if (agenda == {}):
            logger.error('Job missing agenda')
            return None
            
        else:
            segments = []
            for subjob in agenda:
                if segmentNameList != []:
                    if subjob['name'] in segmentNameList:
                        segments.append(subjob)
                else:
                    segments.append(subjob)

            return segments
示例#7
0
def find_nuke():

    name = re.compile(r'[n]')

    for i in range(len(qb.jobinfo(status='running'))):
        #print qb.jobinfo(status = 'running')[i]['name']
        if name.match(qb.jobinfo(status='running')[i]['name']):
            print str(i) + '  ' + qb.jobinfo(status='running')[i]['name']
            #print qb.jobinfo(status = 'running')[i]['name']
            content = qb.jobinfo(status='running')[i]['user'] + ' ' + str(
                qb.jobinfo(status='running')[i]['todo'])
            baseMessage.send(NAME, content, account=ACCOUNT, password=PASSWORD)
        else:
            print 'pass' + '  ' + str(i) + '  ' + qb.jobinfo(
                status='running')[i]['name']
示例#8
0
    def getSegments(self, segmentNameList=[]):
        '''
        Load the all segments from the qube job object.
        '''

        agenda = qb.jobinfo(id=self.job.qubejob['id'],
                            agenda=True)[0]['agenda']
        if (agenda == {}):
            logger.error('Job missing agenda')
            return None

        else:
            segments = []
            for subjob in agenda:
                if segmentNameList != []:
                    if subjob['name'] in segmentNameList:
                        segments.append(subjob)
                else:
                    segments.append(subjob)

            return segments
示例#9
0
    def get_display(my):
        sobject = my.get_current_sobject()

        try:
            import qb
        except ImportError:
            Environment.add_warning("Qube not installed", "Qube not installed")
            return "---"

        dispatcher_id = sobject.get_value("dispatcher_id")

        all_jobinfo = qb.jobinfo(filters={'id': dispatcher_id})
        if not all_jobinfo:
            return "---"

        job_info = all_jobinfo[0]

        status = job_info.get('status')

        timestart = job_info.get('timestart')
        timecomplete = job_info.get('timecomplete')
        timeelapsed = int(timecomplete) - int(timestart)
        return "%s (%ss)" % (status, timeelapsed)
示例#10
0
    def get_display(my):
        sobject = my.get_current_sobject()

        try:
            import qb
        except ImportError:
            Environment.add_warning("Qube not installed", "Qube not installed")
            return "---"
            
        dispatcher_id = sobject.get_value("dispatcher_id")

        all_jobinfo = qb.jobinfo(filters={'id': dispatcher_id})
        if not all_jobinfo:
            return "---"

        job_info = all_jobinfo[0]

        status = job_info.get('status')

        timestart = job_info.get('timestart')
        timecomplete = job_info.get('timecomplete')
        timeelapsed = int(timecomplete) - int(timestart)
        return "%s (%ss)" % (status, timeelapsed)
示例#11
0
 def status(self):
     """Get the current status for this particular work item."""
     job = qb.jobinfo(id=[self.job_id])
     return job[0]['agenda'][self.work_id]['status']
#!/amay/bin/env python

import qb
import __future__
import re
from os import listdir
from os.path import isfile, join
import sys
import time
import argparse
#########################################

ACTIVE = ['running']
jobs = qb.jobinfo(status=ACTIVE, agenda=True, subjobs=True)
'''
parser = argparse.ArgumentParser(description='Find Memory Allocation Errors in work.')
parser.add_argument('')
'''
#########################################

# parse down target jobs by confirming failed frames

# initialize empty list which will hold iterable running ids. this will eventually hold only FAILING ids
id_list = []

# iterates over jobs and finds important information: reservation/requirement, jobid, subjob status
for j in jobs:
    
    #print j['subjobs'][0]['status']
    if j['subjobs'][0]['status'] == 'running':
        if j['todotally']['failed'] > 0:
示例#13
0
 def polling_loop(self):
         
     # Wait for a timer, or for someone to trigger us. We want to wait
     # slightly longer each time, but given the nature of qube a 2x
     # increase in delay leads us to log waits too quickly.
     self.delay = min(self.delay * 1.15, self.MAX_DELAY)
     self.loop_event.wait(self.delay)
     if self.loop_event.is_set():
         self.loop_event.clear()
         
     # Get all the new futures. If we don't have any and there aren't any
     # in the queue, then wait on the queue for something to show up.
     queue_emptied = False
     while not queue_emptied or not self.futures:
         try:
             # Block while we don't have any futures.
             future = self.new_futures.get(not self.futures)
             
         except queue.Empty:
             queue_emptied = True
             
         else:
             self.futures[(future.job_id, future.work_id)] = future
                 
             # We did just get something from the queue, so it
             # potentially has more. Keep emptying it without fear or
             # re-entering the loop since futures will be non-empty.
             queue_emptied = True
                 
             # Clean up so weak refs can vanish.
             del future
         
     # print 'QUICK POLL: %r' % self.futures.keys()
     # Using `values` instead of `itervalues` for the weakref.
     jobs = qb.jobinfo(id=[f.job_id for f in self.futures.values()], agenda=not self.two_stage_polling)
     # print 'done quick poll'
         
     if self.two_stage_polling:
         finished = [job['id'] for job in jobs if job['status'] in ('complete', 'failed')]
         if not finished:
             return
         #print 'LONG POLL'
         jobs = qb.jobinfo(id=finished, agenda=True)
         #print 'done long poll'
         
     for job in jobs:
         for agenda_i, agenda in enumerate(job['agenda']):
             if agenda['status'] not in ('complete', 'failed'):
                 continue
             
             # Leave the future in the dict in case we fail before we report
             # anything.
             future = self.futures.get((job['id'], agenda_i))
             if future is None:
                 continue
             
             # Back up to full speed.
             self.delay = self.MIN_DELAY
                 
             result = utils.unpack(agenda['resultpackage'])
             
             if 'result' in result:
                 future.set_result(result['result'])
             elif 'exception' in result:
                 future.set_exception(result['exception'])
             else:
                 future.set_exception(RuntimeError('invalid resultpackage'))
             
             # Clean up so weak refs can vanish.
             del self.futures[(job['id'], agenda_i)]
             del future
示例#14
0
def obtain_jobsInfo():
    '''
                    obtain all jobs by status likes running, pending
    '''
    jobsInfos = qb.jobinfo(status=JOBSTATUS)
    return jobsInfos
示例#15
0
import time
import qb

start = time.time()
for i in xrange(10):
    jobs = qb.jobinfo(id=[26851, 26858, 26859, 26782])
    for job in jobs:
        print job['id'], job['status'], job.get('resultpackage')
    print
print time.time() - start
示例#16
0
    def polling_loop(self):

        # Wait for a timer, or for someone to trigger us. We want to wait
        # slightly longer each time, but given the nature of qube a 2x
        # increase in delay leads us to log waits too quickly.
        self.delay = min(self.delay * 1.15, self.MAX_DELAY)
        self.loop_event.wait(self.delay)
        if self.loop_event.is_set():
            self.loop_event.clear()

        # Get all the new futures. If we don't have any and there aren't any
        # in the queue, then wait on the queue for something to show up.
        queue_emptied = False
        while not queue_emptied or not self.futures:
            try:
                # Block while we don't have any futures.
                future = self.new_futures.get(not self.futures)

            except queue.Empty:
                queue_emptied = True

            else:
                self.futures[(future.job_id, future.work_id)] = future

                # We did just get something from the queue, so it
                # potentially has more. Keep emptying it without fear or
                # re-entering the loop since futures will be non-empty.
                queue_emptied = True

                # Clean up so weak refs can vanish.
                del future

        # print 'QUICK POLL: %r' % self.futures.keys()
        # Using `values` instead of `itervalues` for the weakref.
        jobs = qb.jobinfo(id=[f.job_id for f in self.futures.values()],
                          agenda=not self.two_stage_polling)
        # print 'done quick poll'

        if self.two_stage_polling:
            finished = [
                job['id'] for job in jobs
                if job['status'] in ('complete', 'failed')
            ]
            if not finished:
                return
            #print 'LONG POLL'
            jobs = qb.jobinfo(id=finished, agenda=True)
            #print 'done long poll'

        for job in jobs:
            for agenda_i, agenda in enumerate(job['agenda']):
                if agenda['status'] not in ('complete', 'failed'):
                    continue

                # Leave the future in the dict in case we fail before we report
                # anything.
                future = self.futures.get((job['id'], agenda_i))
                if future is None:
                    continue

                # Back up to full speed.
                self.delay = self.MIN_DELAY

                result = utils.unpack(agenda['resultpackage'])

                if 'result' in result:
                    future.set_result(result['result'])
                elif 'exception' in result:
                    future.set_exception(result['exception'])
                else:
                    future.set_exception(RuntimeError('invalid resultpackage'))

                # Clean up so weak refs can vanish.
                del self.futures[(job['id'], agenda_i)]
                del future
示例#17
0
 def status(self):
     """Get the current status for this particular work item."""
     job = qb.jobinfo(id=[self.job_id])
     return job[0]['agenda'][self.work_id]['status']
示例#18
0
    def ExportStdOutStdErr(self):

        import qb
        import datetime

        ID = self.mainWindow.leJobInfo_JobID.text()

        global job_list
        # global ID
        job_list = str(ID)
        global job_info
        global job_subjobs
        global job_callbacks
        global job_agenda
        job_info = {}
        frame = {}
        global job_counter
        job_counter = 0


        for jobs in job_list.split(","):
            job_callbacks = qb.jobinfo(fields=['callbacks'], id=[int(jobs)])
            job_agenda = qb.jobinfo(fields=['agenda'], id=[int(jobs)])
            job_frames = job_agenda[0]['agenda']
            job_subjobs = qb.jobinfo(fields=['subjobs'], id=[int(jobs)])

            # Propiedades que todos los Jobs contienen

            job_info[job_counter] = {'info':
                                         {'name': job_callbacks[0]['name'],
                                          'id': str(job_callbacks[0]['id']),
                                          #'asset_version': job_callbacks[0]['package']['assetVersion'],
                                          # 'worktype': job_callbacks[0]['package']['priority_data']['worktype'],
                                          'jobclass': job_callbacks[0]['package']['priority_data']['jobclass'],
                                          'status': job_callbacks[0]['status'],
                                          # 'camera': job_agenda[0]['package']['selected_camera'],
                                          # 'render_layer': job_agenda[0]['package']['render_layer'],
                                          # 'resolution': job_agenda[0]['package']['preset_resolution'],
                                          'user': job_agenda[0]['package']['queue_options']['user'],
                                          'time_submit': datetime.datetime.fromtimestamp(
                                              job_agenda[0]['timesubmit']).strftime('%Y-%m-%d %H:%M:%S'),
                                          'range': job_callbacks[0]['package']['range'],
                                          },
                                     'subjobs': [job_subjobs[0]['subjobs'][subjobs]['id'] for subjobs in xrange(len(job_subjobs[0]['subjobs']))],
                                     'frames':
                                         [{job_agenda[0]['agenda'][frames]['name']:
                                               {
                                                'host': job_agenda[0]['agenda'][frames]['host'], \
                                                'subid': job_agenda[0]['agenda'][frames]['subid'], \
                                                'pid': job_agenda[0]['agenda'][frames]['pid'], \
                                                'status': job_agenda[0]['agenda'][frames]['status']}
                                           } for frames in xrange(len(job_agenda[0]['agenda']))],
                                     }

            # Propiedades que NO todos los Jobs contienen

            if 'assetVersion' in job_callbacks[0]['package'].keys():
                job_info[job_counter]['asset_version'] = job_callbacks[0]['package']['assetVersion']
            else:
                job_info[job_counter]['asset_version'] = "None"

            if 'selected_camera' in job_agenda[0]['package'].keys():
                job_info[job_counter]['selected_camera'] = job_agenda[0]['package']['selected_camera']
            else:
                job_info[job_counter]['selected_camera'] = "None"

            if 'render_layer' in job_agenda[0]['package'].keys():
                job_info[job_counter]['render_layer'] = job_agenda[0]['package']['render_layer']
            else:
                job_info[job_counter]['render_layer'] = "None"

            if 'preset_resolution' in job_agenda[0]['package'].keys():
                job_info[job_counter]['preset_resolution'] = job_agenda[0]['package']['preset_resolution']
            else:
                job_info[job_counter]['preset_resolution'] = "None"

            if 'original_range' in job_callbacks[0]['package'].keys():
                job_info[job_counter]['original_range'] = job_callbacks[0]['package']['original_range']
            else:
                job_info[job_counter]['original_range'] = "None"

            if 'out_path' in job_agenda[0]['package'].keys():
                job_info[job_counter]['framesserver_logPath'] = job_agenda[0]['package']['framesserver_logPath']
            else:
                job_info[job_counter]['framesserver_logPath'] = "None"

            job_counter += 1
示例#19
0
def obtain_jobsInfo():
    '''
                    obtain all jobs by status likes running, pending
    '''
    jobsInfos = qb.jobinfo(status=JOBSTATUS)
    return jobsInfos
示例#20
0
def main():
    # Introducimos los IDs de los JOBs.
    jobID = raw_input('Introduce el ID del Primer Job: ')
    jobID2 = raw_input('Introduce el ID del Segundo Job: ')



    # Gather all the information
    job = qb.jobinfo(fields=['agenda', 'subjobs', 'callbacks'], id=[jobID])
    job2 = qb.jobinfo(fields=['agenda', 'subjobs', 'callbacks'], id=[jobID2])

    # Asignamos las variables a la informacion del Qube del primer Job
    jobName = job[0]['name']
    assetVersion = job[0]['package']['assetVersion']
    jobPreset = job[0]['package']['render_preset']
    jobUser = job[0]['user']
    mayaFile = job[0]['package']['mayafile']
    joblayer = job[0]['package']['render_layer']
    jobCamera = job[0]['package']['selected_camera']
    jobRange = job[0]['package']['range']
    jobResolution = job[0]['package']['preset_resolution']

    # Asignamos las variables a la informacion del Qube del segundo Job
    jobName2 = job2[0]['name']
    assetVersion2 = job2[0]['package']['assetVersion']
    jobPreset2 = job2[0]['package']['render_preset']
    jobUser2 = job2[0]['user']
    mayaFile2 = job2[0]['package']['mayafile']
    joblayer2 = job2[0]['package']['render_layer']
    jobCamera2 = job2[0]['package']['selected_camera']
    jobRange2 = job2[0]['package']['range']
    jobResolution2 = job2[0]['package']['preset_resolution']

    # Compare all the gather information

    print ""
    print 'Name'
    print '1- ' + jobName + '\n2- ' + jobName2
    print ""
    print 'AssetVersion'
    print '1- ' + assetVersion + '\n2- ' + assetVersion2
    print ""
    print 'Preset'
    print '1- ' + jobPreset + '\n2- ' + jobPreset2
    print ""
    print 'User'
    print '1- ' + jobUser + '\n2- ' + jobUser2
    print ""
    print 'Layer'
    print '1- ' + joblayer + '\n2- ' + joblayer2
    print ""
    print 'MayaFile'
    print '1- ' + mayaFile + '\n2- ' + mayaFile2
    print ""
    print 'Camera'
    print '1- ' + jobCamera + '\n2- ' + jobCamera2
    print ''
    print 'Range'
    print '1- ' + jobRange + '\n2- ' + jobRange2
    print ''
    print 'Resolution'
    print '1- ' + jobResolution + '\n2- ' + jobResolution
    print ''

    # Comparing all. Falta por depurar esto, por que es una guarreria
    if jobName == jobName2:
       if assetVersion == assetVersion2:
           if jobPreset == jobPreset2:
               if jobUser == jobUser2:
                   if joblayer == joblayer2:
                       if mayaFile == mayaFile2:
                           if jobCamera == jobCamera2:
                               if jobRange == jobRange2:
                                   if jobResolution == jobResolution2:
                                        print 'It seems the same'
                                   else:
                                        print 'Algo es distinto'
                               else:
                                    print 'Algo es distinto'
                           else:
                               print 'Algo es distinto'
                       else:
                           print 'Algo es distinto'
                   else:
                       print 'Algo es distinto'
               else:
                   print 'Algo es distinto'
           else:
               print 'Algo es distinto'
       else:
           print 'Algo es distinto'
    else:
       print 'Algo es distinto'

    # if jobName == jobName2:
    #     print''
    #     print 'La camara es igual'
    # else:
    #     print''
    #     print 'La camara es distinta'
    #
    # if assetVersion == assetVersion2:
    #     print''
    #     print 'El asset es igual'
    # else:
    #     print''
    #     print 'El asset es distinto'
    #
    # if jobPreset == jobPreset2:
    #     print''
    #     print 'El preset es igual'
    # else:
    #     print''
    #     print 'El preset es distinto'
    #
    # if jobUser == jobUser2:
    #     print''
    #     print 'El User es igual'
    # else:
    #     print''
    #     print 'El User es distinto'
    #
    # if joblayer == joblayer2:
    #     print''
    #     print 'La Layer es igual'
    # else:
    #     print''
    #     print 'La Layer es distinta'
    #
    # if mayaFile == mayaFile2:
    #     print''
    #     print 'El archivo de Maya es igual'
    # else:
    #     print''
    #     print 'El archivo de Maya es distinto'
    #
    # if jobCamera == jobCamera2:
    #     print''
    #     print 'La Camara es igual'
    # else:
    #     print''
    #     print 'La Camara es distinta'

    print ''