Skip to content

Commit

Permalink
Merge pull request #5 from d3b-center/bug/fix_token_call
Browse files Browse the repository at this point in the history
🐛 fix create_gql_client call with token
  • Loading branch information
sickler-alex authored Mar 27, 2024
2 parents 442f74a + f5c75df commit 6b10c41
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 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 @@ -542,7 +545,7 @@ def load_and_hash_volume(
Output: job id of parent job created when volume is hashed.
"""

client = create_gql_client(token)
client = create_gql_client(api_key=token)

job_id = None

Expand All @@ -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 6b10c41

Please sign in to comment.