about summary refs log tree commit diff
path: root/uploader
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-12-03 16:37:01 -0600
committerFrederick Muriuki Muriithi2024-12-03 16:37:01 -0600
commit65a05ea7aa9f703d35aa5e424c8038410a3e4be9 (patch)
tree4c9ac081fc7b4c770ce6a6367a317e0ea18b9f57 /uploader
parentcb171851416f7f895ccf8bc582b8b6995c71e4d0 (diff)
downloadgn-uploader-65a05ea7aa9f703d35aa5e424c8038410a3e4be9.tar.gz
Retrieve job files metadata.
Diffstat (limited to 'uploader')
-rw-r--r--uploader/jobs.py15
1 files changed, 15 insertions, 0 deletions
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*")
+    }