Skip to content

Commit

Permalink
✨ use prefix when determing if the volume exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sickler-alex committed Mar 26, 2024
1 parent 567e23f commit f5c75df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions d3b_dff_cli/modules/dewrangle/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def get_study_volumes(client, study_id):
node {
id
name
pathPrefix
}
}
}
Expand All @@ -274,7 +275,8 @@ def get_study_volumes(client, study_id):
volume = volume_edge["node"]
vid = volume["id"]
vname = volume["name"]
study_volumes[vid] = vname
prefix = volume["pathPrefix"]
study_volumes[vid] = {"name": vname, "pathPrefix": prefix}

return study_volumes

Expand All @@ -285,6 +287,7 @@ def process_volumes(study, volumes, **kwargs):
Outputs: volume id"""
volume_id = kwargs.get("vid", None)
vname = kwargs.get("vname", None)
vpre = kwargs.get("prefix", None)

if volume_id:
if volume_id not in volumes.keys():
Expand All @@ -295,7 +298,7 @@ def process_volumes(study, volumes, **kwargs):
# see how many times the volume was added to the study
matching_volumes = []
for vol in volumes:
if volumes[vol] == vname:
if volumes[vol]["name"] == vname and volumes[vol]["pathPrefix"] == vpre:
matching_volumes.append(vol)
count = len(matching_volumes)

Expand Down Expand Up @@ -556,7 +559,7 @@ def load_and_hash_volume(

# check if volume loaded to study
study_volumes = get_study_volumes(client, study_id)
volume_id = process_volumes(study_id, study_volumes, vname=bucket_name)
volume_id = process_volumes(study_id, study_volumes, vname=bucket_name, prefix=prefix)

if volume_id is None:
# need to load, get credential
Expand Down

0 comments on commit f5c75df

Please sign in to comment.