Skip to content

Commit

Permalink
Merge pull request #201 from EBISPOT/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jdhayhurst authored Feb 18, 2022
2 parents 492d576 + ce69a8a commit 9dd8428
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions sumstats_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def update_sumstats(callback_id):
content = request.get_json(force=True)
resp = endpoints.update_sumstats(callback_id=callback_id, content=content)
if resp:
publish_sumstats.apply_async(args=[resp], retry=True)
publish_and_clean_sumstats.apply_async(args=[resp], retry=True)
return Response(status=200,
mimetype="application/json")

Expand Down Expand Up @@ -186,8 +186,8 @@ def remove_payload_files(callback_id):


@celery.task(queue=config.CELERY_QUEUE1, options={'queue': config.CELERY_QUEUE1})
def publish_sumstats(resp):
au.publish_sumstats(resp)
def publish_and_clean_sumstats(resp):
au.publish_and_clean_sumstats(resp)


if __name__ == '__main__':
Expand Down
19 changes: 17 additions & 2 deletions sumstats_service/resources/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,29 @@ def remove_payload_files(callback_id):
payload.remove_payload_directory()


def publish_sumstats(study_list):
def publish_and_clean_sumstats(study_list):
# 1) move sumstats files to staging for publishing
# 2) deactivate globus endpoint
moved = 0
callback_id = None
globus_endpoint_id = None
for s in study_list['studyList']:
study = st.Study(study_id=s['id'], file_path=s['file_path'],
assembly=s['assembly'], callback_id=s['callback_id'],
readme=s['readme'], entryUUID=s['entryUUID'],
author_name=s['author_name'], pmid=s['pmid'],
gcst=s['gcst'], raw_ss=s['rawSS'])
study.move_file_to_staging()
if study.move_file_to_staging() is True:
moved += 1
if callback_id is None:
callback_id = s['callback_id']
if globus_endpoint_id is None:
globus_endpoint_id = s['entryUUID']
if callback_id and globus_endpoint_id:
payload = pl.Payload(callback_id=callback_id)
payload.get_data_for_callback_id()
if len(payload.study_obj_list) == moved:
delete_globus_endpoint(globus_endpoint_id)


def construct_get_payload_response(callback_id):
Expand Down

0 comments on commit 9dd8428

Please sign in to comment.