def _get_base_job(my): cpus = 1 job_type = my.render_package.get_option("job_type") # generic qube parameters job = { 'name': job_type, 'prototype': job_type, 'cpus': cpus, 'priority': my.queue.get_value("priority"), } # create an agenda based on the frames ... frame_range = my.render_package.get_frame_range() start, end, by = frame_range.get_values() frames = qb.genframes("%s-%s" % (start, end)) if frames: job['agenda'] = frames # create a default package package = {} job['package'] = package # store the ticket in the job # FIXME: the problem with this is that the ticket may expire before # the job actually gets executed ticket = Environment.get_security().get_ticket_key() package['ticket'] = ticket return job
def _get_base_job(my): cpus = 1 job_type = my.render_package.get_option("job_type") # generic qube parameters job = { 'name': job_type, 'prototype': job_type, 'cpus': cpus, 'priority': my.queue.get_value("priority"), } # create an agenda based on the frames ... frame_range = my.render_package.get_frame_range() start, end, by = frame_range.get_values() frames = qb.genframes("%s-%s" % (start, end) ) if frames: job['agenda'] = frames # create a default package package = {} job['package'] = package # store the ticket in the job # FIXME: the problem with this is that the ticket may expire before # the job actually gets executed ticket = Environment.get_security().get_ticket_key() package['ticket'] = ticket return job
def submit(self, depend=None): self.reservations = ["host.processors=1+"] # add license registration for each in self.licenses: self.reservations.append("license.%s" % each) from sys import path path.insert(0, pipe.apps.qube().path("qube-core/local/pfx/qube/api/python/")) import qb # print dir(qb) self.qb = qb.Job() self.qb["name"] = self.name self.qb["prototype"] = "cmdrange" self.qb["package"] = { # 'cmdline' : 'echo "Frame QB_FRAME_NUMBER" ; echo $HOME ; echo $USER ; cd ; echo `pwd` ; sleep 10', "cmdline": self.cmd, "padding": self.pad, "range": str(self.range())[1:-1], } self.qb["agenda"] = qb.genframes(self.qb["package"]["range"]) self.qb["cpus"] = self.cpus self.qb["hosts"] = "" self.qb["groups"] = self.group self.qb["cluster"] = "/pipe" self.qb["priority"] = self.priority self.qb["reservations"] = ",".join(self.reservations) self.qb["retrywork"] = self.retry self.qb["retrywork_delay"] = 15 self.qb["retrysubjob"] = self.retry self.qb["flags"] = "auto_wrangling,migrate_on_frame_retry" return qb.submit(self.qb)[0]["id"]
def main(): # The parameters here are the same as before, with exceptions noted job = {} job['name'] = 'python test job - echo the frame number' # This time, we will request 4 instances (previously known as subjobs). # By requesting 4 instances, assuming there are 4 open slots on the farm, # up to 4 agenda items will be processed simultaneously. job['cpus'] = 4 # In the last example, we used the prototype 'cmdline' which implied a single # command being run on the farm. This time, we will use the 'cmdrange' prototype # which tells Qube that we are running a command per agenda item. job['prototype'] = 'cmdrange' package = {} # Just like the last example, we create a package parameter called 'cmdline'. # This is the command that will be run for every agenda item. QB_FRAME_NUMBER, # however, is unique to cmdrange. The text QB_FRAME_NUMBER will be replaced with # the actual frame number at run time. package['cmdline'] = 'echo QB_FRAME_NUMBER' job['package'] = package # Now we must create our agenda list. This is an absolutely essential part of # submitting jobs with agenda items (i.e. frames). # First we define a range. The range is in typical number range format where: # 1-5 means frames 1,2,3,4,5 # 1,3,5 means frames 1,3, and 5 # 1-5,7 means frames 1,2,3,4,5,7 # 1-10x3 means frames 1,4,7,10 agendaRange = '0-60x10' # will evaluate to 0,10,20,30,40,50,60 # Using the given range, we will create an agenda list using qb.genframes agenda = qb.genframes(agendaRange) # Now that we have a properly formatted agenda, assign it to the job job['agenda'] = agenda # As before, we create a list of 1 job, then submit the list. Again, we # could submit just the single job w/o the list, but submitting a list is # good form. listOfJobsToSubmit = [] listOfJobsToSubmit.append(job) listOfSubmittedJobs = qb.submit(listOfJobsToSubmit) for job in listOfSubmittedJobs: print job['id']
def submitJob(self): print 'submitting job' if self.startFrame.value() >= self.endFrame.value(): msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText("Range Error") msg.setInformativeText("Start frame must be less than end frame") return msg.exec_() # The first few parameters are the same as the previous examples job = {} job['name'] = str(self.jobName.text()) job['cpus'] = min(self.endFrame.value() - self.startFrame.value(), 40) job['priority'] = 9999 job['cwd'] = str(self.cwd.text()) # Below creates an empty package dictionary package = {} # Below instructs the Qube! GUI which submission UI to use for resubmission if self.renderRange.isChecked() == True: package['simpleCmdType'] = 'cmdrange' job['prototype'] = 'cmdrange' # doing a range # todo add sanity check for range package['range'] = '%d-%d' % (self.startFrame.value(), self.endFrame.value()) renderString = '$RMANTREE/bin/render ' renderString = renderString + self.cwd.text() + '/' # todo add sanity check and instructions on file formats file = str(self.ribFile.text()) # some regex magic! fileName = re.sub(r'(\d+)', 'QB_FRAME_NUMBER', file, 1) renderString = renderString + fileName package['cmdline'] = str(renderString) package['padding'] = self.padding.value() job['package'] = package # Using the given range, we will create an agenda list using qb.genframes agenda = qb.genframes(package['range']) # Now that we have a properly formatted agenda, assign it to the job job['agenda'] = agenda else: # single file print "single" package['simpleCmdType'] = 'cmdline' job['prototype'] = 'cmdline' renderString = '$RMANTREE/bin/render ' renderString = renderString + self.cwd.text() + '/' # todo add sanity check and instructions on file formats file = str(self.ribFile.text()) # some regex magic! renderString = renderString + file package['rangeExecution'] = 'individual' package['cmdline'] = str(renderString) job['package'] = package # Below sets the job's package to the package dictionary we just created job['env'] = { 'RMANTREE': '/opt/software/pixar/RenderManProServer-20.10/' } listOfJobsToSubmit = [] listOfJobsToSubmit.append(job) # As before, we create a list of 1 job, then submit the list. Again, we # could submit just the single job w/o the list, but submitting a list is # good form. listOfSubmittedJobs = qb.submit(listOfJobsToSubmit) for job in listOfSubmittedJobs: print job['id'] print job, package
def postDialog(cmdjob, values): valuesPkg = values.setdefault('package', {}) ctrl = cmdjob.ctrl ################################################################################################################# # # Create a copy of the original project to render from # ################################################################################################################# sourceFilePath = valuesPkg.get('projectPath', '') newFilePath = ctrl.makeCopyOfProject(sourceFilePath, QUBESUBMISSIONSFOLDERNAME) # Store the translated projectPaths valuesPkg['projectPath'] = ctrl.translatePath(sourceFilePath) valuesPkg['renderProjectPath'] = ctrl.translatePath(newFilePath) ################################################################################################################# # # Add the email callbacks # ################################################################################################################# mail = valuesPkg.get('email', '') # If there is no @ specified, supply @fellowshipchurch.com if not ("@" in mail): mail = mail + "@fellowshipchurch.com" values['mailaddress'] = mail values['callbacks'] = [{'triggers': 'done-job-self', 'language': 'mail'}] # logging.info("Callbacks: " + str(values['callbacks'])) # If I delete the email here, the Qube GUI Submission dialog won't remember it for next time # if valuesPkg.has_key('email'): del valuesPkg['email'] # Delete the original option for cleanlinesss # Use the email as the user in Qube values['user'] = mail.split('@')[0] ################################################################################################################# # # Move the notes to the qube notes field # ################################################################################################################# notes = valuesPkg.get('notes', '') values['notes'] = notes # If I delete the notes here, the Qube GUI Submission dialog won't remember it for next time # if valuesPkg.has_key('notes'): del valuesPkg['notes'] # Delete the original option for cleanlinesss ################################################################################################################# # # Set up the Agenda to record percent progress. # We'll use a percentage based of 1-100. # I've tried setting this to frames, but the backend was # having trouble keeping up with qb.reportwork() on fast renders # ################################################################################################################# values['agenda'] = qb.genframes("1-100") # Load the output paths rqItem = ctrl.getRQIndex(valuesPkg['rqIndex'].split('.')[0]) valuesPkg['outputs'] = str(rqItem.getOutputPaths()) # Store the output paths in the first agenda item as well values['agenda'][0]['resultpackage'] = { 'outputPaths': str(rqItem.getOutputPaths()) } # Store the paths to aerender for mac and pc valuesPkg['aerenderwin'] = ctrl.getAERenderPath(sysOS='win32') valuesPkg['aerendermac'] = ctrl.getAERenderPath(sysOS='darwin')
def postDialog(cmdjob, values): valuesPkg = values.setdefault('package', {}) ctrl = cmdjob.ctrl ################################################################################################################# # # Create a copy of the original project to render from # ################################################################################################################# sourceFilePath = valuesPkg.get('projectPath', '') newFilePath = ctrl.makeCopyOfProject(sourceFilePath, QUBESUBMISSIONSFOLDERNAME) # Store the translated projectPaths valuesPkg['projectPath'] = ctrl.translatePath(sourceFilePath) valuesPkg['renderProjectPath'] = ctrl.translatePath(newFilePath) ################################################################################################################# # # Add the email callbacks # ################################################################################################################# mail = valuesPkg.get('email', '') # If there is no @ specified, supply @fellowshipchurch.com if not ("@" in mail): mail = mail + "@fellowshipchurch.com" values['mailaddress'] = mail values['callbacks'] = [{'triggers':'done-job-self', 'language':'mail'}] # logging.info("Callbacks: " + str(values['callbacks'])) # If I delete the email here, the Qube GUI Submission dialog won't remember it for next time # if valuesPkg.has_key('email'): del valuesPkg['email'] # Delete the original option for cleanlinesss # Use the email as the user in Qube values['user'] = mail.split('@')[0] ################################################################################################################# # # Move the notes to the qube notes field # ################################################################################################################# notes = valuesPkg.get('notes', '') values['notes'] = notes # If I delete the notes here, the Qube GUI Submission dialog won't remember it for next time # if valuesPkg.has_key('notes'): del valuesPkg['notes'] # Delete the original option for cleanlinesss ################################################################################################################# # # Set up the Agenda to record percent progress. # We'll use a percentage based of 1-100. # I've tried setting this to frames, but the backend was # having trouble keeping up with qb.reportwork() on fast renders # ################################################################################################################# values['agenda'] = qb.genframes("1-100") # Load the output paths rqItem = ctrl.getRQIndex(valuesPkg['rqIndex'].split('.')[0]) valuesPkg['outputs'] = str(rqItem.getOutputPaths()) # Store the output paths in the first agenda item as well values['agenda'][0]['resultpackage'] = { 'outputPaths': str(rqItem.getOutputPaths()) } # Store the paths to aerender for mac and pc valuesPkg['aerenderwin'] = ctrl.getAERenderPath(sysOS='win32') valuesPkg['aerendermac'] = ctrl.getAERenderPath(sysOS='darwin')