Example #1
0
    def run(self):
        """
        The main method of the class.
        """
     
        common.logger.debug( "Requestor::run() called")
        common.logger.info('Creating request for server, please wait...')
        start = time.time()
        # Instantiate ScriptWriter
        script_writer = ScriptWriter(self.cfg_params,'crab_template.sh')
     
        # Create script (sh)
        script_writer.modifyTemplateScript()
       
        # SL This should be a list, rather than a string!
        concString = ','
        inSand=''
        if len(self.job_type.inputSandbox(1)): 
            inSand +=   concString.join(self.job_type.inputSandbox(1)) 
        # Sandbox, Start Dir , outputDir
        param = {'globalSandbox': inSand , 'startDirectory': common.work_space.cwdDir() , 'outputDirectory': common.work_space.resDir() }
        common._db.updateTask_(param) 
        # define requirement
        common.scheduler.sched_fix_parameter()
       
        stop = time.time()

        common.logger.info('Request created.')
        common.logger.debug( "Request Creation Time: "+str(stop - start))

        msg = ''
        common.logger.info(msg)
        return
Example #2
0
    def run(self):
        """
        The main method of the class.
        """

        common.logger.debug( "Creator::run() called")
        start = time.time()
        # Instantiate ScriptWriter
        script_writer = ScriptWriter(self.cfg_params,'crab_template.sh')

        # Loop over jobs
        argsList = []
        njc = 0
        listID=[]
        listField=[]
        listRunField=[]
        run_jobToSave = {'status' :'C', \
                         'statusScheduler' : 'Created', \
                         'state' : "Created"  }

        msg = ("Creating jobs :\n")
        for nj in range(self.total_njobs):
            nj=nj+self.first_jobID
            output=[]
            if njc == self.ncjobs : break

            msg += "... job # %s "%str(nj+1)
            listRunField.append(run_jobToSave)

            # Prepare configuration file

            output.append('out_files_'+str(nj+1)+'.tgz')
            job_ToSave={'outputFiles': output}
            listField.append(job_ToSave)             

            listID.append(nj+1)
            njc = njc + 1
            pass
        common.logger.log(10-1,msg) 
       # ## Not clear why here.. DS
       # self.job_type.setArgsList()
        common._db.updateRunJob_(listID , listRunField ) 
        common._db.updateJob_(listID, listField ) 

        if self.isNew:
            # Create script (sh)
            script_writer.modifyTemplateScript()
       
            # SL This should be a list, rather than a string!
            concString = ','
            inSand=''
            if len(self.job_type.inputSandbox(1)): 
                inSand +=   concString.join(self.job_type.inputSandbox(1)) 
            # Sandbox, Start Dir , outputDir
            param = {'globalSandbox': inSand , 'startDirectory': common.work_space.cwdDir() , 'outputDirectory': common.work_space.resDir() }
            common._db.updateTask_(param) 
            # define requirement
            common.scheduler.sched_fix_parameter()
        common.scheduler.declare(listID) 
       
        stop = time.time()
        common.logger.info('Creating '+str(self.total_njobs)+' jobs, please wait...')

        stop = time.time()
        common.logger.debug( "Creation Time: "+str(stop - start))

        msg = 'Total of %d jobs created'%njc
        if njc != self.ncjobs: msg = msg + ' from %d requested'%self.ncjobs
        msg = msg + '.\n'
        common.logger.info(msg)
        
        return
Example #3
0
    def run(self):
        """
        The main method of the class.
        """

        common.logger.debug("Creator::run() called")
        start = time.time()
        # Instantiate ScriptWriter
        script_writer = ScriptWriter(self.cfg_params, 'crab_template.sh')

        # Loop over jobs
        argsList = []
        njc = 0
        listID = []
        listField = []
        listRunField = []
        run_jobToSave = {'status' :'C', \
                         'statusScheduler' : 'Created', \
                         'state' : "Created"  }

        msg = ("Creating jobs :\n")
        for nj in range(self.total_njobs):
            nj = nj + self.first_jobID
            output = []
            if njc == self.ncjobs: break

            msg += "... job # %s " % str(nj + 1)
            listRunField.append(run_jobToSave)

            # Prepare configuration file

            output.append('out_files_' + str(nj + 1) + '.tgz')
            job_ToSave = {'outputFiles': output}
            listField.append(job_ToSave)

            listID.append(nj + 1)
            njc = njc + 1
            pass
        common.logger.log(10 - 1, msg)
        # ## Not clear why here.. DS
        # self.job_type.setArgsList()
        common._db.updateRunJob_(listID, listRunField)
        common._db.updateJob_(listID, listField)

        if self.isNew:
            # Create script (sh)
            script_writer.modifyTemplateScript()

            # SL This should be a list, rather than a string!
            concString = ','
            inSand = ''
            if len(self.job_type.inputSandbox(1)):
                inSand += concString.join(self.job_type.inputSandbox(1))
            # Sandbox, Start Dir , outputDir
            param = {
                'globalSandbox': inSand,
                'startDirectory': common.work_space.cwdDir(),
                'outputDirectory': common.work_space.resDir()
            }
            common._db.updateTask_(param)
            # define requirement
            common.scheduler.sched_fix_parameter()
        common.scheduler.declare(listID)

        stop = time.time()
        common.logger.info('Creating ' + str(self.total_njobs) +
                           ' jobs, please wait...')

        stop = time.time()
        common.logger.debug("Creation Time: " + str(stop - start))

        msg = 'Total of %d jobs created' % njc
        if njc != self.ncjobs: msg = msg + ' from %d requested' % self.ncjobs
        msg = msg + '.\n'
        common.logger.info(msg)

        return