def insertMaxLikeJob(self): maxjobq = appiondata.ApMaxLikeJobData() maxjobq['runname'] = self.params['runname'] maxjobq['path'] = appiondata.ApPathData( path=os.path.abspath(self.params['rundir'])) maxjobdatas = maxjobq.query(results=1) if maxjobdatas: alignrunq = appiondata.ApAlignRunData() alignrunq['runname'] = self.params['runname'] alignrunq['path'] = appiondata.ApPathData( path=os.path.abspath(self.params['rundir'])) alignrundata = alignrunq.query(results=1) if maxjobdatas[0]['finished'] is True or alignrundata: apDisplay.printError( "This run name already exists as finished in the database, please change the runname" ) maxjobq[ 'REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId( self.params['stackid']) maxjobq['timestamp'] = self.timestamp maxjobq['finished'] = False maxjobq['hidden'] = False if self.params['commit'] is True: maxjobq.insert() self.params['maxlikejobid'] = maxjobq.dbid print "self.params['maxlikejobid']", self.params['maxlikejobid'] return
def getMaxLikeJob(self, runparams): maxjobq = appiondata.ApMaxLikeJobData() maxjobq['runname'] = runparams['runname'] maxjobq['path'] = appiondata.ApPathData(path=os.path.abspath(runparams['rundir'])) maxjobq['REF|projectdata|projects|project'] = apProject.getProjectIdFromStackId(runparams['stackid']) maxjobq['timestamp'] = self.params['timestamp'] maxjobdata = maxjobq.query(results=1) if not maxjobdata: return None return maxjobdata[0]
def getMaxlikeJobDataForUpload(alignrunname): maxjobq = appiondata.ApMaxLikeJobData() maxjobq['runname'] = alignrunname maxjobq['finished'] = True maxjobq['hidden'] = False maxjobdatas = maxjobq.query() freejobs = [] for maxjobdata in maxjobdatas: if not _isMaxLikeJobUploaded(maxjobdata): freejobs.append(maxjobdata) if len(freejobs) == 0: return None elif len(freejobs) > 1: apDisplay.printError("Found too many align runs for specified criteria") return freejobs[0]