Created
July 27, 2018 14:24
-
-
Save LincolnBryant/71ab087efff85bea588ee5c3c53fa06a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def retire(self, n): | |
""" | |
trigger retirement of this many idle pilots. just remove them from the local queue | |
""" | |
self.log.debug("Beginning to retire %d CondorSSH pilots..." % n) | |
self.log.debug("Getting jobinfo for [%s]" % (self.apfqueue.apfqname)) | |
jobinfo = self.apfqueue.batchstatus_plugin.getJobInfo(queue=self.apfqueue.apfqname) | |
self.log.debug("Jobinfo is %s" % jobinfo) | |
if jobinfo: | |
if self.peaceful: | |
numtoretire = n | |
numretired = 0 | |
idlelist = [] | |
busylist = [] | |
killlist = [] | |
for job in jobinfo: | |
if job.executeinfo is not None: | |
self.log.debug("Handling VC3_GLIDEIN_ID = %s" % job.executeinfo.glideinid) | |
stat = job.executeinfo.getStatus() | |
if stat == 'busy': | |
busylist.append(job) | |
elif stat == 'idle': | |
idlelist.append(job) | |
sortedlist = idlelist # we only want to peacefully condor_rm idle workers | |
for job in sortedlist: | |
numtoretire = numtoretire - 1 | |
numretired += 1 | |
killlist.append("%s.%s" % (job.clusterid, job.procid)) | |
if numtoretire <= 0: | |
break | |
killids(killlist) | |
self.log.debug("wanted to retire %s pilots, retired %s pilots, %s pilots idle in total" % | |
(n, numtoretire, len(idlelist))) | |
else: | |
self.log.debug("Only know how to do peaceful retirement.. doing nothing") | |
else: | |
self.log.debug("No jobinfo.. doing nothing") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment