Commit 0cb94105 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Add directory for archived jobs

Reviewed-by: iustinp
parent 3a2c7775
......@@ -253,6 +253,7 @@ JOB_QUEUE_VERSION = 1
JOB_QUEUE_LOCK_FILE = QUEUE_DIR + "/lock"
JOB_QUEUE_VERSION_FILE = QUEUE_DIR + "/version"
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
JOB_ID_TEMPLATE = r"\d+"
......
......@@ -303,12 +303,13 @@ class DiskJobStorage(JobStorageBase):
self._memcache = {}
self._my_hostname = utils.HostInfo().name
# Make sure our directory exists
try:
os.mkdir(constants.QUEUE_DIR, 0700)
except OSError, err:
if err.errno not in (errno.EEXIST, ):
raise
# Make sure our directories exists
for path in (constants.QUEUE_DIR, constants.JOB_QUEUE_ARCHIVE_DIR):
try:
os.mkdir(path, 0700)
except OSError, err:
if err.errno not in (errno.EEXIST, ):
raise
# Get queue lock
self.lock_fd = open(constants.JOB_QUEUE_LOCK_FILE, "w")
......@@ -419,6 +420,9 @@ class DiskJobStorage(JobStorageBase):
def _GetJobPath(self, job_id):
return os.path.join(constants.QUEUE_DIR, "job-%s" % job_id)
def _GetArchivedJobPath(self, job_id):
return os.path.join(constants.JOB_QUEUE_ARCHIVE_DIR, "job-%s" % job_id)
def _GetJobIDsUnlocked(self, archived=False):
"""Return all known job IDs.
......
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