How to use the oasislmf.utils.status function in oasislmf

To help you get started, we’ve selected a few oasislmf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OasisLMF / OasisPlatform / src / server.bak / app.py View on Github external
"""
    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