示例#1
0
 def _findSubmitEntity(self, id):
     """ method will returns the submit entity with the given id.
         
         :param id: id of the submit entity to be searched for
         :type id: int
         
         :returns: the found submit entity with all attributes and their values in the dictionary
         :rtype: dict
     """
     
     fieldList = ['%s%s'%(self._sgAttrPrefix, each['name']) for each in entityConfig.submitEntityFields]
     fieldList.extend(['id', 'type', 'project', 'code', 'description'])
     
     renderEntity = self.sg.find_one(rrSG.entitySubmit(),
                     filters=[['id', 'is', id]],
                     fields=fieldList
                 )
     if not renderEntity:
         raise RoyalRifleException('submissionEntity %s not in database!')
     return renderEntity
示例#2
0
 def submitRender(self, renderDataList, submitUser, projectName, sequenceId, shotId, taskId=None):
     """ method will enter the current submission in shotgun. It will be called by the rrSubmitter.
         
         For each submission, this method will create one submit entity in shotgun and each render-pass/layer will get one
         render entity. All render entities will be linked to the submission entity while the submit entity is linked to the
         submitter, the shot, the sequence and, if given, the task::
             
             seq
             |_shot
               |_SUBMIT-ENTITY ----------> submitter
                 |_RENDER-ENTITY-1
                 |_RENDER-ENTITY-..
                 |_RENDER-ENTITY-n
             
         
         :param renderDataList: this list holds dictionaries with attributes, which should be set to the render and submit entities.
                 as keys you can use any attribute listed in the config file and all default attribute names loke code, description etc
                 The containing values have to be in the correct data-type
         :type renderDataList: list
         :param submitUser: login-name of the submitter
         :type submitUser: string
         :param projectName: name of  the project the submission is containing to
         :type projectName: string
         :param shotId: id of the shot the submission is containing to
         :type shotId: int
         :param sequenceId: id of the sequence the submission is containing to
         :type sequenceId: int
         :param taskId: int of  the shot the submission is containing to (optional)
         :type taskId: int
         
         :returns: the created submit entity in shotgun
         :rtype: dict
     """
     
     # create shotgun entity instances
     project = self._findProject(projectName)
     user = self._findUser(submitUser)
     sequence = self._findSequence(sequenceId)
     shot = self._findShot(shotId)
     if taskId:
         task = self._findTask(taskId)
     
     creationDict = {}
     creationDict['%slinked_shot'%self._sgAttrPrefix] = shot
     creationDict['%slinked_sequence'%self._sgAttrPrefix] = sequence
     creationDict['%slinked_user'%self._sgAttrPrefix] = user
     if taskId:
         creationDict['%slinked_task'%self._sgAttrPrefix] = task
     creationDict['code'] = 'render_%s_%s'%(sequence['code'], shot['code'])
     creationDict['project'] = project
     
     submitEntity = self.sg.create(rrSG.entitySubmit(), creationDict, ['type', 'id', 'code'])
     
     renderJobEntities = []
     for i, renderData in enumerate(renderDataList):
         if not i:
             self.sg.update(
                             submitEntity['type'],
                             submitEntity['id'],
                             {
                                     '%srender_application'%self._sgAttrPrefix:renderData.get('render_application', ''),
                                     '%srender_scene_name'%self._sgAttrPrefix : {
                                                     'local_path' : renderData.get('render_scene_name', '')
                                             },
                             }
                     )
         
         renderJobEntities.append(self.addRenderJobEntities(submitEntity, project, renderData))
         self.sg.update(
                         renderJobEntities[-1]['type'],
                         renderJobEntities[-1]['id'],
                         {'%slinked_submit_entity'%self._sgAttrPrefix: submitEntity,}
                 )
     
     # link dependencies
     self.sg.update(
                     submitEntity['type'],
                     submitEntity['id'],
                     {'%slinked_jobs'%self._sgAttrPrefix : renderJobEntities}
             )
     
     self.sg.update(
                     sequence['type'],
                     sequence['id'],
                     {'%sroyal_render_watch'%self._sgAttrPrefix:[submitEntity]}
             )
     self.sg.update(
                     shot['type'],
                     shot['id'],
                     {'%sroyal_render_watch'%self._sgAttrPrefix:[submitEntity]}
             )
     if taskId:
         self.sg.update(
                         task['type'],
                         task['id'],
                         {'%sroyal_render_watch'%self._sgAttrPrefix:[submitEntity]}
                 )
     
     return self._findSubmitEntity(submitEntity['id'])
			'input' : {'valid_types':[rrSG.entityJob()]}
		},
		{'type' : 'text',
			'name' : 'render_application',
		},
		{'type' : 'url',
			'name' : 'render_scene_name',
			'input' : {'open_in_new_window': True},
		},
	]


jobEntityFields = [
		{'type' : 'entity',
			'name' : 'linked_submit_entity',
			'input' : {'valid_types':[rrSG.entitySubmit()]}
		},
		{'type' : 'text',
			'name' : 'render_pass',
		},
		{'type' : 'text',
			'name' : 'render_camera',
		},
		{'type' : 'text',
			'name' : 'average_render_time',
		},
		{'type' : 'float',
			'name' : 'average_memory_usage',
		},
		{'type' : 'number',
			'name' : 'frames',