Commit fae737ac authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Move code extracting job ID into function

It might come in handy at some point and makes the code a bit easier
to read.

Reviewed-by: iustinp
parent 5d414478
...@@ -431,6 +431,13 @@ class DiskJobStorage(JobStorageBase): ...@@ -431,6 +431,13 @@ class DiskJobStorage(JobStorageBase):
def _GetArchivedJobPath(self, job_id): def _GetArchivedJobPath(self, job_id):
return os.path.join(constants.JOB_QUEUE_ARCHIVE_DIR, "job-%s" % job_id) return os.path.join(constants.JOB_QUEUE_ARCHIVE_DIR, "job-%s" % job_id)
def _ExtractJobID(self, name):
m = self._RE_JOB_FILE.match(name)
if m:
return None
def _GetJobIDsUnlocked(self, archived=False): def _GetJobIDsUnlocked(self, archived=False):
"""Return all known job IDs. """Return all known job IDs.
...@@ -442,9 +449,7 @@ class DiskJobStorage(JobStorageBase): ...@@ -442,9 +449,7 @@ class DiskJobStorage(JobStorageBase):
extra IDs). extra IDs).
""" """
jfiles = self._ListJobFiles() jlist = [self._ExtractJobID(name) for name in self._ListJobFiles()]
jlist = [ for m in
[self._RE_JOB_FILE.match(name) for name in jfiles]]
jlist.sort() jlist.sort()
return jlist return jlist
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment