コード例 #1
0
ファイル: PilotLSFSubmitter.py プロジェクト: zhiwenuil/WMCore
    def submitPilot(self, taskName, exe, exePath, inputSandbox, bulkSize):

        shellScript = exe
        scriptPath = exePath
        lsfConfig = loadLSFConfig()
        if ( lsfConfig == None ):
            logging.debug('lsfConfig is none. returing back the call')
            return

    	#start lsf submission command
        lsfSubmitCommand = 'bsub'
        lsfQueue = lsfConfig['Queue']
	lsfSubmitCommand += ' -q %s -J %s' % (lsfQueue, taskName)
	
	#creating the log directory.
	lsfLogDir = lsfConfig['logDir']
        #'/afs/cern.ch/user/k/khawar/scratch2/khawar/logs'
	if ( lsfLogDir != 'None' ):
            now = datetime.datetime.today()
	    lsfLogDir += '/%s' % now.strftime("%Y%m%d%H")
	    try:
	        os.mkdir(lsfLogDir)
	        logging.debug("Created directory %s" % lsfLogDir)
	    except OSError, err:
	        # suppress LSF log unless it's about an already exisiting directory
	        if err.errno != errno.EEXIST or not os.path.isdir(lsfLogDir):
	            logging.debug("Can't create directory %s, turning off LSF log" % lsfLogDir)
	            lsfLogDir = 'None'
コード例 #2
0
    def lsfPilotTask(self, taskName, exe, exePath, inpSandbox, bulkSize):
        """ 
	__lsfPilotTask__
	
	declares Task and Job objects but don't store
	in the db
 	"""
        #load LSF configurations 
	lsfConfig = loadLSFConfig()       
        if ( lsfConfig is None):
            logging.debug('LSFConfig is None: returning back the call ')
            return
        
        outdir = time.strftime('%Y%m%d_%H%M%S')
        #got logDir information from the config
        logDir = lsfConfig['logDir'] 
        lsfLogDir = os.path.join(logDir, outdir )
          
        taskCount = self.taskCount()
        taskName = "%s_%s" % (taskName, taskCount + 1)
	#task object
        try:
            os.mkdir(lsfLogDir)
           
            self.bossTask = Task()
            self.bossTask['name'] = taskName
            self.bossTask['jobType'] = 'PilotJob'
            self.bossTask['globalSandbox'] = exePath+'/'+exe+','+ inpSandbox
            self.bossTask['outputDirectory'] = lsfLogDir 
            self.bossLiteSession.saveTask( self.bossTask )

        except BossLiteError, ex:
            self.failedSubmission = 'pilotboss' 
            raise JSException(str(ex), FailureList = self.failedSubmission)