diff options
author | Frederick Muriuki Muriithi | 2024-12-03 16:37:01 -0600 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-12-03 16:37:01 -0600 |
commit | 65a05ea7aa9f703d35aa5e424c8038410a3e4be9 (patch) | |
tree | 4c9ac081fc7b4c770ce6a6367a317e0ea18b9f57 /uploader | |
parent | cb171851416f7f895ccf8bc582b8b6995c71e4d0 (diff) | |
download | gn-uploader-65a05ea7aa9f703d35aa5e424c8038410a3e4be9.tar.gz |
Retrieve job files metadata.
Diffstat (limited to 'uploader')
-rw-r--r-- | uploader/jobs.py | 15 |
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*") + } |