def __generate(config_run, title, live_run=True):
    run_id = config_run["run_id"]
    print("Generate report for config run_id: " + repr(run_id))
    metrics = __get_metrics(config_run, title, live_run)
    metrics = __enrich_metrics(metrics)
    __complete_charts(run_id, metrics, title, config_run)
    if live_run:
        __update_runtime_timestamp(run_id, report.get_last_timestamp(metrics), "true") # trigger termination runtime report js reload loop
        print("Finished run " + repr(run_id))
    print("Complete report for test_config run " + repr(run_id) + ":\n" + complete_report_url(run_id))
Beispiel #2
0
def __generate(config_run, title, live_run=True):
    run_id = config_run["run_id"]
    print("Generate report for config run_id: " + repr(run_id))
    metrics = __get_metrics(config_run, title, live_run)
    metrics = __enrich_metrics(metrics)
    __complete_charts(run_id, metrics, title, config_run)
    if live_run:
        __update_runtime_timestamp(
            run_id, report.get_last_timestamp(metrics),
            "true")  # trigger termination runtime report js reload loop
        print("Finished run " + repr(run_id))
    print("Complete report for test_config run " + repr(run_id) + ":\n" +
          complete_report_url(run_id))
Beispiel #3
0
def __get_metrics(config_run, title, live_run=True):
    run_id = config_run["run_id"]

    __prepare(run_id)
    __save_meta(run_id, title, config_run)

    metrics = None
    if live_run:
        print("Current runtime report is " + __report_path(run_id) +
              "/runtime/runtime_report.html")
        create_runtime_report = True
        test_run = liclient.client.get_test(run_id)
        stream = test_run.result_stream(__get_result_ids(config_run))
        # Wait for test to finish
        for data in stream(poll_rate=3):
            if (
                    CLIENTS_ACTIVE_KEY not in data
            ):  # Only treat data which has real metrics, otherwise it is just booting msg etc. (e.g. live feed)
                continue
            metrics = stream.series
            __store_metrics(run_id, metrics)
            if create_runtime_report:
                # update timestamp to trigger js auto-reload
                __update_runtime_timestamp(run_id,
                                           report.get_last_timestamp(metrics))
                __runtime_charts(run_id, metrics, config_run)
            time.sleep(3)
        __store_metrics(run_id, metrics)
        metrics = stream.series
    else:
        metrics = __get_finished_run_results(run_id, config_run)
    if (
            CLIENTS_ACTIVE_KEY not in metrics
    ):  # Only treat data which has real metrics, otherwise it is just booting msg etc. (e.g. live feed)
        print(
            "metrics (for config run %s) missing %s, we assume data is incomplete"
            % (run_id, CLIENTS_ACTIVE_KEY))
        print("submetrics present: " + ", ".join(metrics.keys()))
        return
    clients_active = metrics[CLIENTS_ACTIVE_KEY]
    if not clients_active:
        print(
            "metrics (for config run %s) missing %s, we assume data is incomplete"
            % (run_id, CLIENTS_ACTIVE_KEY))
        print("submetrics present: " + ", ".join(metrics.keys()))
        return
    return metrics
def __get_metrics(config_run, title, live_run=True):
    run_id = config_run["run_id"]

    __prepare(run_id)
    __save_meta(run_id, title, config_run)

    metrics = None
    if live_run:
        print("Current runtime report is " + __report_path(run_id) + "/runtime/runtime_report.html")
        create_runtime_report = True
        test_run = liclient.client.get_test(run_id)
        stream = test_run.result_stream(__get_result_ids(config_run))
        # Wait for test to finish
        for data in stream(poll_rate=3):
            if (CLIENTS_ACTIVE_KEY not in data): # Only treat data which has real metrics, otherwise it is just booting msg etc. (e.g. live feed)
                continue
            metrics = stream.series
            __store_metrics(run_id, metrics)
            if create_runtime_report:
                # update timestamp to trigger js auto-reload
                __update_runtime_timestamp(run_id, report.get_last_timestamp(metrics))
                __runtime_charts(run_id, metrics, config_run)
            time.sleep(3)
        __store_metrics(run_id, metrics)
        metrics = stream.series
    else:
        metrics = __get_finished_run_results(run_id, config_run)
    if (CLIENTS_ACTIVE_KEY not in metrics): # Only treat data which has real metrics, otherwise it is just booting msg etc. (e.g. live feed)
        print("metrics (for config run %s) missing %s, we assume data is incomplete" % (run_id, CLIENTS_ACTIVE_KEY))
        print("submetrics present: " + ", ".join(metrics.keys()))
        return
    clients_active = metrics[CLIENTS_ACTIVE_KEY]
    if not clients_active:
        print("metrics (for config run %s) missing %s, we assume data is incomplete" % (run_id, CLIENTS_ACTIVE_KEY))
        print("submetrics present: " + ", ".join(metrics.keys()))
        return
    return metrics