Skip to content

Commit

Permalink
upload testing
Browse files Browse the repository at this point in the history
  • Loading branch information
vsoch committed Oct 31, 2017
1 parent 900a57f commit 413ef84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
17 changes: 10 additions & 7 deletions sendit/apps/main/tasks/finish.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
from random import choice
from time import sleep
import os
import json


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sendit.settings')
Expand Down Expand Up @@ -194,6 +195,7 @@ def upload_storage(batch_ids=None):
# We only expect to have one entity per batch
kwargs = {"items":[compressed_file],
"table":table,
"study": SOM_STUDY,
"metadata": metadata,
"batch": False} # upload in batches at END

Expand Down Expand Up @@ -252,13 +254,14 @@ def upload_dataset(client, k):
#upload_delay = choice([2,4,6,8,10,12,14,16])
#sleep(upload_delay)
client.upload_dataset(items=k['items'],
table=k['table'],
mimetype="application/gzip",
entity_key=ENTITY_ID,
item_key=ITEM_ID,
batch=k['batch'],
metadata=k['metadata'],
permission="projectPrivate") # default batch=True
table=k['table'],
mimetype="application/gzip",
entity_key=ENTITY_ID,
item_key=ITEM_ID,
study_name=k['study'],
batch=k['batch'],
metadata=k['metadata'],
permission="projectPrivate") # default batch=True


@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000,stop_max_attempt_number=3)
Expand Down
3 changes: 1 addition & 2 deletions sendit/apps/main/tasks/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,11 @@ def replace_identifiers(bid, run_upload_storage=False):
aggregate=aggregate)
batch_ids.shared = shared_ids
batch_ids.save()

# Rename
for dcm in batch.image_set.all():
try:
dicom = dcm.load_dicom()
item_id = os.path.basename(dcm.image.path)

# S6M0<MRN-SUID>_<JITTERED-REPORT-DATE>_<ACCESSIONNUMBER-SUID>
# Rename the dicom based on suid
if item_id in updated:
Expand All @@ -168,6 +166,7 @@ def replace_identifiers(bid, run_upload_storage=False):
message = "%s for Image Id %s not found in lookup: skipping." %(item_id, dcm.id)
batch = add_batch_error(message,batch)
dcm.delete()

batch.qa['ProcessFinishTime'] = time.time()

# We don't get here if the call above failed
Expand Down

0 comments on commit 413ef84

Please sign in to comment.