Ejemplo n.º 1
0
"""
Get information on the ActiveData schema. The above command returns the
available tables. To see the columns in a table, run:

.. code-block:: bash

    adr inspect
    adr inspect --table task
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

RUN_CONTEXTS = [
    override('attribute', hidden=True),
]


def run(args):

    if not args.table:
        data = run_query('meta', args)['data']
        data = sorted([(d['name'], ) for d in data])
        data.insert(0, ('Table', ))
        return data

    if not args.attribute:
        data = run_query('meta_columns', args)['data']
        data = sorted([(d['name'], ) for d in data])
        data.insert(0, ('Column', ))
`View Results <https://mozilla.github.io/active-data-recipes/#task-durations>`__
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

DEFAULT_BRANCHES = [
    'autoland',
    'mozilla-inbound',
    'mozilla-central',
]

RUN_CONTEXTS = [
    override('branches', default=DEFAULT_BRANCHES),
    override('limit', default=20, help="Maximum number of jobs in result"),
    override('sort_key', default=2,
             help="Key to sort on (int, 0-based index)"),
]


def run(args):

    limit = args.limit
    delattr(args, 'limit')

    data = run_query('task_durations', args)['data']
    result = []
    for record in data:
        if record[2] is None:
Ejemplo n.º 3
0
at preventing backouts. It is roughly:

    1000000 / (total_compute_hours_on_try * backout_rate)

.. code-block:: bash

    adr try_efficiency

`View Results <https://mozilla.github.io/active-data-recipes/#try-efficiency>`_
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

RUN_CONTEXTS = [override('branches', hidden=True)]


def run(args):

    pushes = len(set(run_query('all_push_id', args)['data']['push.id']))
    backouts = len(set(run_query('backout_rate', args)['data']['push.id']))
    backout_rate = round((float(backouts) / pushes) * 100, 2)

    args.branches = ['try']
    data = run_query('total_hours_spent_on_branch', args)['data']

    try_hours = int(data['hours'])
    try_efficiency = round(10000000 / (backout_rate * try_hours), 2)

    return (
Ejemplo n.º 4
0
"""
Get skipped tests on the ActiveData schema. The above command returns the
test suites and their count which were skipped/disabled between specified period.

.. code-block:: bash

    adr skipped_tests
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

RUN_CONTEXTS = [
    override('limit', default=25, help="Maximum number of users in result"),
    override('sort_key', default=1, help="Key to sort on (int, 0-based index)"),
]


def run(args):

    result = run_query('skipped_tests', args)['data']

    result.sort(key=lambda x: x[0])
    result.insert(0, ['Result test', 'run suite', 'count'])
    return result
Ejemplo n.º 5
0
    adr inspect

To see the attributes in a given table run:

.. code-block:: bash

    adr inspect --table <name>
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

RUN_CONTEXTS = [
    override('attribute', default=None),
]


def run(args):

    if not args.table:
        data = run_query('meta', args)['edges'][0]['domain']['partitions']
        data = sorted([(d['name'], ) for d in data])
        data.insert(0, ('Table', ))
        return data

    if not args.attribute:
        data = run_query('meta_columns', args)['data']
        data = sorted([(d['name'], ) for d in data])
        data.insert(0, ('Column', ))
    adr branch_usage [-B <branch>] [-B <branch>]

"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

DEFAULT_BRANCHES = [
    'autoland',
    'mozilla-central',
    'mozilla-inbound',
]

RUN_CONTEXTS = [
    override('branches', default=DEFAULT_BRANCHES),
]


def run(args):
    results = []
    branches = args.branches
    delattr(args, 'branches')

    total = 0
    for branch in branches:
        args.branches = [branch]
        data = run_query('total_hours_spent_on_branch', args)['data']
        hours = int(data['hours'])
        total += hours
        results.append([branch, hours])
Ejemplo n.º 7
0
"""
This is currently broken.

.. code-block:: bash

    adr intermittent_tests
"""
from __future__ import absolute_import, print_function

from adr.context import override
from adr.query import run_query

BROKEN = True
RUN_CONTEXTS = [override('platform_config', hidden=True)]


def run(args):
    # These 4 args are defined so that we can share the queries with the
    # 'intermittent_test_data' recipe.
    args.test_name = '(~(file.*|http.*))'
    args.groupby = 'result.test'
    args.result = ["F"]
    args.platform_config = "test-%s/%s" % (args.platform, args.build_type)

    jobs = run_query('intermittent_jobs', args)['data']
    result = run_query('intermittent_tests', args)['data']
    total_runs = run_query('intermittent_test_rate', args)['data']

    intermittent_tests = []
    # for each result, match up the revision/name with jobs, if a match, save testname
    index = -1
Ejemplo n.º 8
0
from adr.query import run_query
from loguru import logger

DEFAULT_BRANCHES = [
    'autoland',
    'mozilla-central',
    'mozilla-inbound',
]

# The RUN_CONTEXTS global contains context definitions that are unique to this
# recipe.
RUN_CONTEXTS = [
    # Sometimes the shared context needs to be tweaked (in this case, let's
    # remove '--kind' from the help since it will be hardcoded later on. This
    # can be accomplished with the 'override' method.
    override('kind', help=argparse.SUPPRESS)
]


# All recipes must have a 'run' function. The 'args' value contains all of the
# context needed by this recipe and the queries that it uses. Context can be
# accessed using dot notation (e.g, args.foo).
def run(args):
    logger.info("Running the 'build_times' recipe!")

    # The task_durations query was designed to be more general purpose than
    # this recipe. Since we are only looking at build tasks here, we can hard
    # code the 'kind' context.
    args.kind = "build"

    # Set the default branch if it wasn't specified.
"""
Get the total tasks passed and failed for build platforms and types.

.. code-block:: bash

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

from adr.context import override
from adr.query import run_query

RUN_CONTEXTS = [
    override('limit', default=50, help="Maximum number of configs"),
    override('sort_key', default=0,
             help="Key to sort on (int, 0-based index)"),
]


def run(args):
    # process config data
    data = run_query('config_intermittents', 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: