예제 #1
0
def test_get_latest_successful_job_results(_get_results_from_name_and_params):
    serializer = MagicMock()
    results.get_latest_successful_job_results(sentinel.report_name,
                                              sentinel.report_params,
                                              serializer, sentinel.retrying,
                                              sentinel.ignore_cache)

    _get_results_from_name_and_params.assert_called_once_with(
        serializer.get_latest_successful_job_id_for_name_and_params,
        sentinel.report_name,
        sentinel.report_params,
        serializer,
        sentinel.retrying,
        sentinel.ignore_cache,
        None,
    )
예제 #2
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)