<commit_before>"""
Get the average and total runtime for build platforms and types.

.. code-block:: bash

    adr config_durations [--branch <branch>]
"""
from __future__ import absolute_import, print_function

from ..query import run_query


def run(config, args):
    # process config data
    data = run_query('config_durations', config, args)["data"]
    result = []
    for record in data:
        if not record or not record[args.sort_key]:
            continue
        if isinstance(record[1], list):
            record[1] = record[1][-1]
        if record[2] is None:
            continue
        if record[3] is None:
            continue
        record[3] = round(record[3] / 60, 2)
        record.append(int(round(record[2] * record[3], 0)))
        result.append(record)

    result = sorted(result, key=lambda k: k[args.sort_key], reverse=True)[:args.limit]
    result.insert(0, ['Platform', 'Type', 'Num Jobs', 'Average Hours', 'Total Hours'])
    return result<commit_msg>Disable failing recipe in CRON tests<commit_after>"""
Get the average and total runtime for build platforms and types.

.. code-block:: bash

    adr config_durations [--branch <branch>]
"""
from __future__ import absolute_import, print_function

from ..query import run_query

BROKEN = True


def run(config, args):
    # process config data
    data = run_query('config_durations', config, args)["data"]
    result = []
    for record in data:
        if not record or not record[args.sort_key]:
            continue
        if isinstance(record[1], list):
            record[1] = record[1][-1]
        if record[2] is None:
            continue
        if record[3] is None:
            continue
        record[3] = round(record[3] / 60, 2)
        record.append(int(round(record[2] * record[3], 0)))
        result.append(record)

    result = sorted(result, key=lambda k: k[args.sort_key], reverse=True)[:args.limit]
    result.insert(0, ['Platform', 'Type', 'Num Jobs', 'Average Hours', 'Total Hours'])
    return result
{'fraction_non_alphanumeric': 0.12760675273088382, 'fraction_numerical': 0.014895729890764648, 'mean_word_length': 2.845419847328244, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3604354', 'n_tokens_mistral': 622, 'n_tokens_neox': 593, 'n_words': 184}