summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Thiemonge <gthiemon@redhat.com>2021-11-05 09:23:35 +0100
committerGregory Thiemonge <gthiemon@redhat.com>2022-01-10 12:40:28 +0100
commitba2cbd72f9deee5fedf15864dac41471f4402c82 (patch)
tree6e6da3e154da2cb5b8f37448342dcbfba33299de
parent6d9330a1b0afaa1fdb8c995c009b4ac90db94c00 (diff)
downloadtaskflow-ba2cbd72f9deee5fedf15864dac41471f4402c82.tar.gz
Handle invalid redis entries in RedisJobBoard
When catching that a redis buffer is not formatted correctly, _fetch_jobs now deletes the data from the hashmap, so the same error will not occur during the next call to the function. The commit also adds JobFailure in the list of caught exceptions (might be raised by _loads) in _fetch_jobs Closes-Bug: #1949950 Change-Id: I9078086cd4c3dbfa954422dfa3d5b19fefd7264f
-rw-r--r--taskflow/jobs/backends/impl_redis.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/taskflow/jobs/backends/impl_redis.py b/taskflow/jobs/backends/impl_redis.py
index 66133fe..8c1e511 100644
--- a/taskflow/jobs/backends/impl_redis.py
+++ b/taskflow/jobs/backends/impl_redis.py
@@ -826,11 +826,14 @@ return cmsgpack.pack(result)
job_name = job_data['name']
job_sequence_id = job_data['sequence']
job_details = job_data.get('details', {})
- except (ValueError, TypeError, KeyError):
+ except (ValueError, TypeError, KeyError, exc.JobFailure):
with excutils.save_and_reraise_exception():
LOG.warning("Incorrectly formatted job data found at"
" key: %s[%s]", self.listings_key,
raw_job_key, exc_info=True)
+ LOG.info("Deleting invalid job data at key: %s[%s]",
+ self.listings_key, raw_job_key)
+ self._client.hdel(self.listings_key, raw_job_key)
else:
postings.append(RedisJob(self, job_name, job_sequence_id,
raw_job_key, uuid=job_uuid,