Skip to content

Commit

Permalink
maint: add differentiator to filename
Browse files Browse the repository at this point in the history
  • Loading branch information
xgui3783 committed May 25, 2023
1 parent 79aae70 commit 4486866
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/voluba_backend/ebrains_router/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from datetime import datetime
import requests
from pathlib import Path
from uuid import uuid4

from voluba_auth import S2SToken
from .const import SPC_NAME_TO_ID_VOCAB, KG_INSTANCES, KG_IDS, SPC_NAME_TO_KG_ID, STRING_CONST
Expand Down Expand Up @@ -65,11 +66,13 @@ def _run(self, context: 'WorkProgress'):
auth_token = S2SToken.get_token()
client = BucketApiClient(token=auth_token)
bucket = client.buckets.get_bucket(DP_BUCKET_NAME)

_id = str(uuid4())

assert context.param.reference_volume in SPC_NAME_TO_ID_VOCAB, f"Expecting reference volume name {context.param.reference_volume} is in {', '.join(SPC_NAME_TO_ID_VOCAB.keys())}, but is not."
sanitized_spc_id = SPC_NAME_TO_ID_VOCAB[context.param.reference_volume].replace("/", ".")
incoming_vol_id = context.param.content_hash or f'name.{context.param.incoming_volume}'
bucket_filename = f"{sanitized_spc_id}_{incoming_vol_id}_transform_{context.param.version}.json"
bucket_filename = f"{sanitized_spc_id}_{incoming_vol_id}_transform_{context.param.version}_{_id}.json"

# Unfortunately, bucket API does not yet support stringIO, and must write it to disk first.
with NamedTemporaryFile("w", suffix=".json", encoding="utf-8", delete=False) as fp:
Expand Down

0 comments on commit 4486866

Please sign in to comment.