site = ceToSite[gatekeeper] procThresh = self.siteThresholds[site]["processingThreshold"] minSubmit = self.siteThresholds[site]["minimumSubmission"] maxSubmit = self.siteThresholds[site]["maximumSubmission"] test = idle - procThresh msg="CondorMonitor Proc: Site=%s, Idle=%s, Thresh=%s, Test=%s"%(site,idle,procThresh,test) logging.debug(msg) if test < 0: if abs(test) < minSubmit: # // # // below threshold, but not enough for a bulk #// submission continue constraint = self.newConstraint() constraint['count'] = abs(test) # enforce maximum number to submit if constraint['count'] > maxSubmit: constraint['count'] = maxSubmit constraint['type'] = "Processing" constraint['site'] = self.allSites[site]['SiteIndex'] print str(constraint) result.append(constraint) return result registerMonitor(CondorMonitor, CondorMonitor.__name__)
if ( missingHarvestingCollectJobs >= minSubmit ): constraint = self.newConstraint() # determine number of jobs if ( missingHarvestingCollectJobs > maxSubmit ): constraint['count'] = maxSubmit else: constraint['count'] = missingHarvestingCollectJobs # some more constraints constraint['type'] = "Harvesting" #constraint['site'] = self.allSites[siteName]['SiteIndex'] # constraint for workflow if ( constrainWorkflow ): constraint['workflow'] = siteName logging.info("Releasing %d harvesting jobs for workflow %s" % (constraint['count'],siteName)) else: logging.info("Releasing %d harvesting jobs" % constraint['count']) result.append(constraint) return registerMonitor(T0LSFMonitor, T0LSFMonitor.__name__)
class RandomMonitor(MonitorInterface): """ _RandomMonitor_ Randomly generate 0-few jobs per call for testing purposes """ def __call__(self): """ _operator()_ Fake callout to check a batch system """ constraint = self.newConstraint() constraint['count'] = int(abs(random.gauss(_GaussMean, _GaussStdDev))) return [constraint] registerMonitor(FixedMonitor, FixedMonitor.__name__) registerMonitor(RandomMonitor, RandomMonitor.__name__)
if test < 0: constraint = self.newConstraint() constraint['count'] = abs(test) constraint['type'] = "CleanUp" result.append(constraint) if poller['LogCollect'] != None: logging.info(" LogCollect jobs are: %s Threshold: %s" % \ (poller['LogCollect'], collectThresh) ) test = poller['LogCollect'] - collectThresh if test < 0: constraint = self.newConstraint() constraint['count'] = abs(test) constraint['type'] = "LogCollect" result.append(constraint) if (poller['Merge'] == None) and (poller['Processing'] == None) \ and (poller['CleanUp'] == None) and (poller['LogCollect'] == None): test = poller['Processing'] - procThresh if test < 0: constraint = self.newConstraint() constraint['count'] = abs(test) result.append(constraint) # // # // return the contstraints #// return result registerMonitor(PABossLiteMonitor, PABossLiteMonitor.__name__)
{"CEName":str, "Alias":str, "Queue":str, "Active":bool} """ r = [] i = 0 while i < len(output): words = output[i].split() if len(words) > 0 and words[0] == 'Cluster': CEName = words[1] alias, queue, active = "", "", False while i < len(output) and output[i].strip(): words = output[i].split() if words[0] == 'Alias:': alias = words[1] elif words[0] == 'Queue': queue = words[1] elif words[0] == 'Status:' and words[1] == 'active': active = True i += 1 r.append({"CEName":CEName, "Alias":alias, "Queue":queue, "Active":active}) i += 1 return r registerMonitor(ARCMonitor, ARCMonitor.__name__)
logging.debug(msg) return [] if maxTotal and (total > maxTotal): msg = "%s: Total tasks (%s) over maxTotalThr" % (self.me, total) logging.debug(msg) return [] if (ratio) >= actvRatio: msg = "%s: Active/total (%s) over threshold" % (self.me, ratio) logging.debug(msg) result = self.prepare() return result else: msg = "%s: Active/total (%s) below threshold" % (self.me, ratio) logging.debug(msg) return [] def prepare(self): msg = "%s: New constraint of %s" % (self.me, self.blockSize) logging.debug(msg) constraint = self.newConstraint() constraint['count'] = self.blockSize return [constraint] registerMonitor(TaskQueueThresholdMonitor, TaskQueueThresholdMonitor.__name__)
Use TaskQueueThresholdMonitor instead. """ from ResourceMonitor.Monitors.MonitorInterface import MonitorInterface from ResourceMonitor.Registry import registerMonitor # Fixed value of tasks to enqueue at each iteration # TODO: Should come from the cfg... _FixedValue = 25 class TaskQueueFixedMonitor(MonitorInterface): """ _TaskQueueFixedMonitor_ Returns always a fixed value (in theory one can always enqueue new tasks into the TaskQueue). """ def __call__(self): """ _operator()_ """ constraint = self.newConstraint() constraint['count'] = _FixedValue return [constraint] registerMonitor(TaskQueueFixedMonitor, TaskQueueFixedMonitor.__name__)
constraint = self.newConstraint() constraint['count'] = abs(test) constraint['type'] = "CleanUp" result.append(constraint) if poller['LogCollect'] != None: logging.info(" LogCollect jobs are: %s Threshold: %s" % \ (poller['LogCollect'], logThresh) ) test = poller['LogCollect'] - logThresh if test < 0: constraint = self.newConstraint() constraint['count'] = abs(test) constraint['type'] = "LogCollect" result.append(constraint) if (poller['Merge'] == None) and (poller['Processing'] == None) \ and (poller['CleanUp'] == None) \ and (poller['LogCollect'] == None): test = poller['Processing'] - procThresh if test < 0: constraint = self.newConstraint() constraint['count'] = abs(test) result.append(constraint) # // # // return the contstraints #// return result registerMonitor(PAJobStateMonitor, PAJobStateMonitor.__name__)