Example #1
0
def generate_cpta(spec, data):
    """Generate all formats and versions of the Continuous Performance Trending
    and Analysis.

    :param spec: Specification read from the specification file.
    :param data: Full data set.
    :type spec: Specification
    :type data: InputData
    """

    logging.info(u"Generating the Continuous Performance Trending and Analysis "
                 u"...")

    ret_code = _generate_all_charts(spec, data)

    cmd = HTML_BUILDER.format(
        date=datetime.utcnow().strftime(u'%Y-%m-%d %H:%M UTC'),
        working_dir=spec.environment[u'paths'][u'DIR[WORKING,SRC]'],
        build_dir=spec.environment[u'paths'][u'DIR[BUILD,HTML]'])
    execute_command(cmd)

    with open(spec.environment[u'paths'][u'DIR[CSS_PATCH_FILE]'], u'w') as \
            css_file:
        css_file.write(THEME_OVERRIDES)

    with open(spec.environment[u'paths'][u'DIR[CSS_PATCH_FILE2]'], u'w') as \
            css_file:
        css_file.write(THEME_OVERRIDES)

    if spec.configuration.get(u"archive-inputs", True):
        archive_input_data(spec)

    logging.info(u"Done.")

    return ret_code
Example #2
0
def generate_report(release, spec, report_week):
    """Generate all formats and versions of the report.

    :param release: Release string of the product.
    :param spec: Specification read from the specification file.
    :param report_week: Calendar week when the report is published.
    :type release: str
    :type spec: Specification
    :type report_week: str
    """

    logging.info(u"Generating the report ...")

    report = {u"html": generate_html_report, u"pdf": generate_pdf_report}

    for report_format in spec.output[u"format"]:
        report[report_format](release, spec, report_week)

    archive_input_data(spec)

    logging.info(u"Done.")