Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Get the status of an analysis
"""
result = CELERY.AsyncResult(location)
logging.debug("celery result:{}".format(result.result))
if result.state == status.STATUS_SUCCESS:
analysis_status = data.AnalysisStatus(
id=-1,
status=status.STATUS_SUCCESS,
message="",
outputs_location=result.result)
elif result.state == status.STATUS_FAILURE:
analysis_status = data.AnalysisStatus(
id=-1,
status=status.STATUS_FAILURE,
message=repr(result.result),
outputs_location=None)
else:
analysis_status = data.AnalysisStatus(
id=-1,
status=result.state,
message="",
outputs_location=None)
return analysis_status