def addJob(self, jobType, jobWeight=1): host, xWeight = self.getNextHost(jobWeight) xLock = Lock(os.path.join(self.JobDir, "lock-" + host)) xLock.getLock() try: hostDir = os.path.join(self.JobDir, 'Host.' + host) if not os.path.exists(hostDir): try: os.mkdir(hostDir) except: pass jFile = open(os.path.join(hostDir, 'JOB.' + jobType), "w") jFile.write(str(jobWeight)) jFile.close() self.updateHost(host) time.sleep(1) except: pass print 'ADDED JOB:', jobType, ':', jobWeight, '===>', host return host, xWeight
def addJob(self, jobType, jobWeight=1): host, xWeight = self.getNextHost(jobWeight) xLock = Lock(os.path.join(self.JobDir, "lock-" + host)) xLock.getLock() try: hostDir = os.path.join(self.JobDir, "Host." + host) if not os.path.exists(hostDir): try: os.mkdir(hostDir) except: pass jFile = open(os.path.join(hostDir, "JOB." + jobType), "w") jFile.write(str(jobWeight)) jFile.close() self.updateHost(host) time.sleep(1) except: pass print "ADDED JOB:", jobType, ":", jobWeight, "===>", host return host, xWeight
def run(self): ret = 0 try: ret = os.system('rfcp '+self.castorFile+' '+self.localFile) except: ret = 1 if ret != 0: print "ERROR copying rawRefFile ", self.castorFile, ' to ', self.localFile print " rfcp returned: ", ret return def getRawRefs(): import PerfSuiteRawRef threadList = [] if not os.path.exists(PerfSuiteRawRef.rawRefDir): os.makedirs(PerfSuiteRawRef.rawRefDir) for castorDir, refList in PerfSuiteRawRef.referenceFiles.items(): for rem, ref in refList.items(): if os.path.exists(PerfSuiteRawRef.rawRefDir+'/'+ref) : print "Ignoring existing rawRefFile ", ref continue else: t = GetRawRefFile(castorDir+rem,PerfSuiteRawRef.rawRefDir+ref) t.start() threadList.append(t) for t in threadList: t.join() xLock = Lock('prefSuit.rawRef.lock') xLock.getLock(10,1000) getRawRefs()