Beispiel #1
0
def write_main_workflow_report(job_id, job_resources, workflow_opts, task_opts, bg_, state_, was_successful_, run_time_sec):
    """
    Write the main workflow level report.

    :type job_resources: JobResources
    :type workflow_opts: WorkflowLevelOptions
    :type bg_: BindingsGraph
    :type was_successful_: bool
    :type run_time_sec: float

    :param job_id:
    :param job_resources:
    :param workflow_opts:
    :param task_opts:
    :param bg_:
    :param state_:
    :param was_successful_:
    :param run_time_sec:
    :return:
    """
    # workflow_json = os.path.join(job_resources.workflow, 'workflow.json')
    # with open(workflow_json, 'w+') as f:
    #     f.write(json.dumps(json_graph.node_link_data(bg_)))

    report_path = os.path.join(job_resources.workflow, 'report-tasks.json')
    report_ = _to_report(bg_, job_resources.root, job_id, state_, was_successful_, run_time_sec)
    report_.write_json(report_path)
    R.write_report_with_html_extras(report_, os.path.join(job_resources.root, 'index.html'), job_resources.html)

    setting_report = _to_workflow_settings_report(bg_, workflow_opts, task_opts, state_, was_successful_)
    R.write_report_to_html(setting_report, os.path.join(job_resources.html, 'settings.html'))

    setting_report = _to_workflow_report(job_resources, bg_, workflow_opts, task_opts, state_, was_successful_, _get_images_in_dir(job_resources.workflow, formats=(".svg",)))
    R.write_report_to_html(setting_report, os.path.join(job_resources.html, 'workflow.html'))
Beispiel #2
0
def write_main_workflow_report(job_id, job_resources, workflow_opts, task_opts, bg_, state_, was_successful_, run_time_sec):
    """
    Write the main workflow level report.

    :type job_resources: JobResources
    :type workflow_opts: WorkflowLevelOptions
    :type bg_: BindingsGraph
    :type was_successful_: bool
    :type run_time_sec: float

    :param job_id:
    :param job_resources:
    :param workflow_opts:
    :param task_opts:
    :param bg_:
    :param state_:
    :param was_successful_:
    :param run_time_sec:
    :return:
    """
    # workflow_json = os.path.join(job_resources.workflow, 'workflow.json')
    # with open(workflow_json, 'w+') as f:
    #     f.write(json.dumps(json_graph.node_link_data(bg_)))

    report_path = os.path.join(job_resources.workflow, 'report-tasks.json')
    report_ = _to_report(bg_, job_resources.root, job_id, state_, was_successful_, run_time_sec)
    report_.write_json(report_path)
    R.write_report_with_html_extras(report_, os.path.join(job_resources.root, 'index.html'), job_resources.html)

    setting_report = _to_workflow_settings_report(bg_, workflow_opts, task_opts, state_, was_successful_)
    R.write_report_to_html(setting_report, os.path.join(job_resources.html, 'settings.html'))

    setting_report = _to_workflow_report(job_resources, bg_, workflow_opts, task_opts, state_, was_successful_, _get_images_in_dir(job_resources.workflow, formats=(".svg",)))
    R.write_report_to_html(setting_report, os.path.join(job_resources.html, 'workflow.html'))
    def test_01(self):
        name = "filter_reports_filter_stats.json"
        f = os.path.join(TEST_DATA_DIR, name)
        report = S.json_file_to_report(f)
        s = R.render_report(report)
        self.assertIsNotNone(s)

        for x in ("css", "js"):
            p = os.path.join(self.temp_dir, x)
            if not os.path.exists(p):
                os.mkdir(p)
        html_output = os.path.join(self.temp_dir, "report.html")
        rcode = R.write_report_with_html_extras(report, html_output, self.temp_dir)
        msg = "Failed writing {f}".format(f=html_output)
        self.assertEqual(rcode, 0, msg)
    def test_01(self):
        name = "filter_reports_filter_stats.json"
        f = os.path.join(TEST_DATA_DIR, name)
        report = S.json_file_to_report(f)
        s = R.render_report(report)
        self.assertIsNotNone(s)

        for x in ('css', 'js'):
            p = os.path.join(self.temp_dir, x)
            if not os.path.exists(p):
                os.mkdir(p)
        html_output = os.path.join(self.temp_dir, 'report.html')
        rcode = R.write_report_with_html_extras(report, html_output,
                                                self.temp_dir)
        msg = "Failed writing {f}".format(f=html_output)
        self.assertEqual(rcode, 0, msg)