From 65a05ea7aa9f703d35aa5e424c8038410a3e4be9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 3 Dec 2024 16:37:01 -0600 Subject: Retrieve job files metadata. --- uploader/jobs.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'uploader') diff --git a/uploader/jobs.py b/uploader/jobs.py index 90e3dc2..e86ee05 100644 --- a/uploader/jobs.py +++ b/uploader/jobs.py @@ -147,3 +147,18 @@ def job_errors( for key in rconn.keys(f"{prefix}:{str(job_id)}:*:errors:*") for error in rconn.lrange(key, 0, -1)), count) + + +def job_files_metadata( + rconn: Redis, + prefix: str, + job_id: Union[str, uuid.UUID] +) -> dict: + """Get the metadata for specific job file.""" + return { + key.split(":")[-1]: { + **rconn.hgetall(key), + "filetype": key.split(":")[-3] + } + for key in rconn.keys(f"{prefix}:{str(job_id)}:*:metadata*") + } -- cgit v1.2.3