Skip to content

Commit

Permalink
Add a helper to get the object store ids and the datasets size for ev…
Browse files Browse the repository at this point in the history
…ery dataset in a job
  • Loading branch information
sanjaysrikakulam committed Jan 24, 2024
1 parent dc2a19a commit 3c44b41
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tpv/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,13 @@ def tool_version_gte(tool, version):

def tool_version_gt(tool, version):
return parse_version(tool.version) > parse_version(version)


def object_store_ids_and_dataset_size(job):
# Return a dictionary of dataset ids and their object store ids
# and file sizes in bytes for all input datasets in a job
object_store_ids = {}
for i in job.get_input_datasets():
object_store_ids[i.dataset.dataset.id] = (i.dataset.dataset.object_store_id, float(i.dataset.dataset.get_size(calculate_size=False)))

return object_store_ids

0 comments on commit 3c44b41

Please sign in to comment.