Example #1
0
def task_results_latest(report_name):
    """
    Renders the full results page for a report_name. This searches the database
    for the last completed report for the given report_name.

    :param report_name: The name of the report

    :return: The HTML rendering of the results page for the latest successful execution of the given report_name.
    """
    report_name = convert_report_name_url_to_path(report_name)
    params = _params_from_request_args(request.args)
    result = get_latest_job_results(report_name, params, get_serializer())
    job_id = result.job_id
    return _render_results(job_id, report_name, result)
Example #2
0
def task_latest_status(report_name):
    """
    Searches for the latest status of the given report_name/override args combination, and returns the status with
    a redirect URL or stdout.

    :param report_name: The name of the report which we are searching for the latest status of.

    :return: A JSON which contains "status" and either stdout in "run_output" or a URL to results in "results_url".
    """
    params = _params_from_request_args(request.args)
    result = get_latest_job_results(report_name, params, get_serializer())
    job_id = result.job_id
    if job_id:
        return jsonify(_get_job_status(job_id, report_name))
    return jsonify({"status": "Job not found for given overrides"})
Example #3
0
def latest_successful_task_results_html(report_name):
    """
    Returns the HTML render of the .ipynb output of notebook execution. In the webapp this is rendered within an \
    iframe. Searches the database for the last successful execution of this report_name. \
    Notebook parameters can be specified as request args, \
    e.g. ?ticker=AAPL. In this method, we either:

    - present the HTML results, if the job has finished
    - present the error, if the job has failed
    - present the user with some info detailing the progress of the job, if it is still running.

    :param report_name: The name of the report.

    :return: The HTML rendering of the .ipynb for the latest successful execution of the given report_name.
    """
    params = _params_from_request_args(request.args)
    result = get_latest_successful_job_results(report_name, params, get_serializer())
    return _process_result_or_abort(result)
Example #4
0
def latest_parameterised_task_results_as_of(report_name, as_of):
    """
    Returns the HTML render of the .ipynb output of notebook execution. In the webapp this is rendered within an \
    iframe. Searches the database for the last result as of the given date, regardless of status. \
    Notebook parameters can be specified as request args, \
    e.g. ?ticker=AAPL. In this method, we either:

    - present the HTML results, if the job has finished
    - present the error, if the job has failed
    - present the user with some info detailing the progress of the job, if it is still running.

    :param report_name: The name of the report.
    :param as_of: The maximum date up to which we are searching for any executions.

    :return: The HTML rendering of the .ipynb for the latest execution of the given report_name.
    """
    params = _params_from_request_args(request.args)
    result = get_latest_job_results(report_name, params, get_serializer(), as_of=as_of)
    return _process_result_or_abort(result)