Example #1
0
    def manageJob(self, jobFile, baseDir):
        #we will want to capture the process exit code and SGE number
        jobNumberSGE = -1

        #load the job file
        jsonData = open(jobFile)
        fileData = json.load(jsonData)
        #logging.debug('%s - %s' % (getTimestamp(), fileData))

        #create the output folder
        if 'name' in fileData:
            outputFolder = '%s/%s' % (fileData['sample_folder'],
                                      fileData['name'])
        else:
            outputFolder = fileData['output_folder']
        logging.debug('%s - Creating output folder %s' %
                      (getTimestamp(), outputFolder))
        fileData['output_folder'] = outputFolder

        #see if it exists first
        if not os.path.exists(outputFolder):
            os.makedirs(outputFolder)

        #write the job template
        fileData['json_file'] = jobFile
        templateWriter = TemplateWriter(outputFolder, self.__softwareDirectory,
                                        self.__QCSettings, self.__sendEmail)
        analysisFile = templateWriter.writeTemplate(fileData)

        #now we can pass the job to be executed over to the job runner
        runner = Runner("CommandLine")
        logging.info('%s - Starting %s' % (getTimestamp(), analysisFile))
        fileData['status'] = 'submitted'
        fileData['output_folder'] = outputFolder
        # if the --requeue option was specified, update the queue
        if options.requeue:
            fileData['analysis']['settings']['queue'] = options.requeue

        # if the user specified a different software directory, set that here
        if 'software_directory' not in fileData[
                'analysis'] or self.__softwareDirectory != fileData[
                    'analysis']['software_directory']:
            fileData['analysis'][
                'software_directory'] = self.__softwareDirectory

        #update the json
        self.__updateJSON(jobFile, fileData)

        #submit the job to SGE
        sgeJobID = runner.submitToSGE('%s/job.sh' % (outputFolder), fileData)
        fileData['status'] = 'queued'
        fileData['sge_job_id'] = sgeJobID
        logging.info('%s - Submitted to SGE (%i)' % (getTimestamp(), sgeJobID))

        #update the json
        self.__updateJSON(jobFile, fileData)
Example #2
0
    def manageJob(self, jobFile, baseDir):
        #we will want to capture the process exit code and SGE number
        jobNumberSGE = -1

        #load the job file
        jsonData = open(jobFile)
        fileData = json.load(jsonData)
        #logging.debug('%s - %s' % (getTimestamp(), fileData))

        #create the output folder
        if 'name' in fileData:
            outputFolder = '%s/%s' %(fileData['sample_folder'], fileData['name'])
        else:
            outputFolder = fileData['output_folder']
        logging.debug('%s - Creating output folder %s' % (getTimestamp(), outputFolder))
        fileData['output_folder'] = outputFolder

        #see if it exists first
        if not os.path.exists(outputFolder):
            os.makedirs(outputFolder)

        #write the job template
        fileData['json_file'] = jobFile
        templateWriter = TemplateWriter(outputFolder, self.__softwareDirectory)
        analysisFile = templateWriter.writeTemplate(fileData)

        #now we can pass the job to be executed over to the job runner
        runner = Runner("CommandLine")
        logging.info('%s - Starting %s' % (getTimestamp(), analysisFile))
        fileData['status'] = 'submitted'
        fileData['output_folder'] = outputFolder
		# if the --requeue option was specified, update the queue
        if options.requeue:
            fileData['analysis']['settings']['queue'] = options.requeue

        #update the json
        self.__updateJSON(jobFile, fileData)

        #submit the job to SGE
        sgeJobID = runner.submitToSGE('%s/job.sh' % (outputFolder), fileData)
        fileData['status'] = 'queued'
        fileData['sge_job_id'] = sgeJobID
        logging.info('%s - Submitted to SGE (%i)' % (getTimestamp(), sgeJobID))

        #update the json
        self.__updateJSON(jobFile, fileData)
Example #3
0
    def manageJob(self, jobFile, baseDir):
        #we will want to capture the process exit code and SGE number
        jobNumberSGE = -1

        #load the job file
        jsonData = open(jobFile)
        fileData = json.load(jsonData)
        logging.debug('%s - %s' % (getTimestamp(), fileData))

        #create the output folder
        outputFolder = '%s/%s/%s/%s' % (baseDir, fileData['project'],
                                        fileData['sample'], fileData['name'])
        logging.debug('%s - Creating output folder %s' %
                      (getTimestamp(), outputFolder))
        fileData['output_folder'] = outputFolder

        #see if it exists first
        if not os.path.exists(outputFolder):
            os.makedirs(outputFolder)

        #write the job template
        fileData['json_file'] = jobFile
        templateWriter = TemplateWriter(outputFolder, self.__softwareDirectory)
        analysisFile = templateWriter.writeTemplate(fileData)

        #now we can pass the job to be executed over to the job runner
        runner = Runner("CommandLine")
        logging.info('%s - Starting %s' % (getTimestamp(), analysisFile))
        fileData['status'] = 'submitted'
        fileData['output_folder'] = outputFolder

        #update the json
        self.__updateJSON(jobFile, fileData)

        #submit the job to SGE
        sgeJobID = runner.submitToSGE('%s/job.sh' % (outputFolder), fileData)
        fileData['status'] = 'queued'
        fileData['sge_job_id'] = sgeJobID
        logging.info('%s - Submitted to SGE (%i)' % (getTimestamp(), sgeJobID))

        #update the json
        self.__updateJSON(jobFile, fileData)