Skip to content

Commit

Permalink
Make sure that stop/remove don't error out when theres no bulk acquis…
Browse files Browse the repository at this point in the history
…ition job due to missing background credentials
  • Loading branch information
fe-ebroad committed Nov 2, 2020
1 parent dd12b39 commit 4252c68
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions hxtool_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,9 +1127,12 @@ def hxtool_api_stacking_remove(hx_api_object):
if bulk_download_job and 'bulk_acquisition_id' in bulk_download_job:
(ret, response_code, response_data) = hx_api_object.restDeleteJob('acqs/bulk', bulk_download_job['bulk_acquisition_id'])
hxtool_global.hxtool_db.bulkDownloadDelete(bulk_download_job.doc_id)
(r, rcode) = create_api_response(ret, response_code, response_data)
else:
(r, rcode) = create_api_response()

hxtool_global.hxtool_db.stackJobDelete(stack_job.doc_id)
(r, rcode) = create_api_response(ret, response_code, response_data)

app.logger.info(format_activity_log(msg="stacking", action="remove", id=request.args.get('id'), user=session['ht_user'], controller=session['hx_ip']))
return(app.response_class(response=json.dumps(r), status=rcode, mimetype='application/json'))

Expand All @@ -1141,12 +1144,15 @@ def hxtool_api_stacking_stop(hx_api_object):
bulk_download_job = hxtool_global.hxtool_db.bulkDownloadGet(bulk_download_eid = stack_job['bulk_download_eid'])
if bulk_download_job and 'bulk_acquisition_id' in bulk_download_job:
(ret, response_code, response_data) = hx_api_object.restCancelJob('acqs/bulk', bulk_download_job['bulk_acquisition_id'])
hxtool_global.hxtool_db.stackJobStop(stack_job_eid = stack_job.doc_id)
hxtool_global.hxtool_db.bulkDownloadUpdate(bulk_download_job.doc_id, stopped = True)

(r, rcode) = create_api_response(ret, response_code, response_data)
app.logger.info(format_activity_log(msg="stacking", action="stop", id=request.args.get('id'), user=session['ht_user'], controller=session['hx_ip']))
return(app.response_class(response=json.dumps(r), status=rcode, mimetype='application/json'))
else:
(r, rcode) = create_api_response()

hxtool_global.hxtool_db.stackJobStop(stack_job_eid = stack_job.doc_id)

app.logger.info(format_activity_log(msg="stacking", action="stop", id=request.args.get('id'), user=session['ht_user'], controller=session['hx_ip']))
return(app.response_class(response=json.dumps(r), status=rcode, mimetype='application/json'))



Expand Down

0 comments on commit 4252c68

Please sign in to comment.