def createTransformation(self): ######################################## # Transformation definition ######################################## t = Transformation() t.setTransformationName(self.__transName) t.setType(self.__transType) t.setDescription(self.__description) t.setLongDescription(self.__description) t.setGroupSize(self.__groupSize) if self.__transGroup: t.setTransformationGroup(self.__transGroup) t.setPlugin(self.__plugin) t.setTargetSE(self.__targetSE) transBody = [] t.setBody(transBody) ######################################## # Transformation submission ######################################## res = t.addTransformation() if not res['OK']: raise Exception('Add transformation error: {0}'.format( res['Message'])) t.setStatus("Active") t.setAgentType("Automatic") currtrans = t.getTransformationID()['Value'] if self.__inputMeta: client = TransformationClient() res = client.createTransformationMetaQuery(currtrans, self.__inputMeta, 'Input') if not res['OK']: raise Exception( 'Create transformation query error: {0}'.format( res['Message'])) return str(currtrans)
def createTransformation(self): ######################################## # Transformation definition ######################################## t = Transformation() t.setTransformationName(self.__stepName) t.setType(self.__transType) t.setDescription(self.__description) t.setLongDescription(self.__description) if self.__isGen: t.setMaxNumberOfTasks(self.__maxNumberOfTasks) else: t.setGroupSize(1) if self.__transGroup: t.setTransformationGroup(self.__transGroup) # set the job workflow to the transformation t.setBody(self.__job.workflow.toXML()) ######################################## # Transformation submission ######################################## res = t.addTransformation() if not res['OK']: raise Exception( 'Add transformation error: {0}'.format(res['Message'])) t.setStatus("Active") t.setAgentType("Automatic") currtrans = t.getTransformationID()['Value'] if self.__inputMeta and not self.__isGen: client = TransformationClient() res = client.createTransformationMetaQuery( currtrans, self.__inputMeta, 'Input') if not res['OK']: raise Exception( 'Create transformation query error: {0}'.format(res['Message'])) return str(currtrans)
def createTransformation(self): ######################################## # Transformation definition ######################################## t = Transformation() t.setTransformationName(self.__transName) t.setType(self.__transType) t.setDescription(self.__description) t.setLongDescription(self.__description) t.setGroupSize(self.__groupSize) if self.__transGroup: t.setTransformationGroup(self.__transGroup) t.setPlugin(self.__plugin) # t.setSourceSE(self.__sourceSE) t.setTargetSE(self.__targetSE) transBody = [] # transBody.append( # ("ReplicateAndRegister", {"TargetSE": ','.join(self.__targetSE)})) # for tse in self.__targetSE: # sse = list(set(self.__sourceSE) - set([tse])) # transBody.append(("ReplicateAndRegister", {"SourceSE": ','.join(sse), "TargetSE": ','.join(tse)})) # # if self.__flavour == 'Moving': # for sse in self.__sourceSE: # if sse in self.__targetSE: # continue # gLogger.debug('Remove from SE: {0}'.format(sse)) # transBody.append(("RemoveReplica", {"TargetSE": ','.join(sse)})) # # transBody.append(("ReplicateAndRegister", {"SourceSE": ','.join( # self.__sourceSE), "TargetSE": ','.join(self.__targetSE)})) # if self.__flavour == 'Moving': # transBody.append( # ("RemoveReplica", {"TargetSE": ','.join(self.__sourceSE)})) t.setBody(transBody) ######################################## # Transformation submission ######################################## res = t.addTransformation() if not res['OK']: raise Exception('Add transformation error: {0}'.format( res['Message'])) t.setStatus("Active") t.setAgentType("Automatic") currtrans = t.getTransformationID()['Value'] if self.__inputMeta: client = TransformationClient() res = client.createTransformationMetaQuery(currtrans, self.__inputMeta, 'Input') if not res['OK']: raise Exception( 'Create transformation query error: {0}'.format( res['Message'])) return str(currtrans)
) # Here you specify how many files should be grouped within he same request, e.g. 100 transBody = '' t.setBody(transBody) if sourceSE: res = t.setSourceSE(sourceSE) if not res['OK']: gLogger.error("SourceSE not valid: %s" % res['Message']) exit(1) res = t.setTargetSE(targetSE) if not res['OK']: gLogger.error("TargetSE not valid: %s" % res['Message']) exit(1) result = t.addTransformation() # Transformation is created here if not result['OK']: gLogger.error('Can not add transformation: %s' % result['Message']) exit(2) t.setStatus("Active") t.setAgentType("Automatic") transID = t.getTransformationID() result = tc.createTransformationMetaQuery(transID['Value'], query, 'Input') if not result['OK']: gLogger.error('Can not create query to transformation: %s' % result['Message']) exit(2)