diff options
-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*") + } |