Skip to content

Commit

Permalink
Checking hostname against current hostname before updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Elizabeth Decolvenaere committed Jun 30, 2016
1 parent 6db5dd1 commit d24a465
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pbs/jobdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,20 @@ def update(self):

# update jobstatus

# Parse our hostname so we can only select jobs from THIS host
# Otherwise, if we're on a multiple-clusters-same-home setup,
# we may incorrectly update jobs from one cluster onto the other
m = m = re.search(r"(.*?)(?=[^a-zA-Z0-9]*login.*)", self.hostname) #pylint: disable=invalid-name
if m:
hostname_regex = m.group(1) + ".*"
else:
hostname_regex = self.hostname + ".*"

# select jobs that are not yet marked complete
self.curs.execute("SELECT jobid FROM jobs WHERE jobstatus!='C'")
# self.curs.execute("SELECT jobid FROM jobs WHERE jobstatus!='C'")
# self.curs.execute("SELECT jobid FROM jobs WHERE hostname REGEXP ")
self.curs.execute("SELECT jobid FROM jobs WHERE jobstatus!='C' AND hostname REGEXP ?",
(hostname_regex, ))

# newstatus will contain the updated info
newstatus = dict()
Expand Down

0 comments on commit d24a465

Please sign in to comment.