Commit eeca4f84 authored by Andrew Halberstadt's avatar Andrew Halberstadt
Browse files

Bug 1903320 - Create a dedicated task route for pernosco, a=dmeehan

This sets up a route on Pernosco tasks such that they will emit pulse messages
over the notify service's exchange with a dedicated routing key. This will allow
the Pernosco pulse consumer to receive only tasks that should be recorded.

Original Revision: https://phabricator.services.mozilla.com/D215967

Differential Revision: https://phabricator.services.mozilla.com/D216444
parent e5001f5c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -66,6 +66,11 @@ gecko_parameters_schema = {
            "A module path pointing to a dict to be use as the `strategy_override` "
            "argument in `taskgraph.optimize.base.optimize_task_graph`.",
        ): str,
        Optional(
            "pernosco",
            description="Record an rr trace on supported tasks using the Pernosco debugging "
            "service.",
        ): bool,
        Optional("rebuild"): int,
        Optional("tasks-regex"): {
            "include": Any(None, [str]),
+2 −1
Original line number Diff line number Diff line
@@ -406,6 +406,7 @@ def run_remaining_transforms(config, tasks):
        ("other", None),
        ("worker", None),
        ("confirm_failure", None),
        ("pernosco", lambda t: t["build-platform"].startswith("linux64")),
        # These transforms should always run last as there is never any
        # difference in configuration from one chunk to another (other than
        # chunk number).
@@ -499,7 +500,7 @@ def make_job_description(config, tasks):
        if "expires-after" in task:
            jobdesc["expires-after"] = task["expires-after"]

        jobdesc["routes"] = []
        jobdesc["routes"] = task.get("routes", [])
        jobdesc["run-on-projects"] = sorted(task["run-on-projects"])
        jobdesc["scopes"] = []
        jobdesc["tags"] = task.get("tags", {})
+19 −0
Original line number Diff line number Diff line
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from taskgraph.transforms.base import TransformSequence

transforms = TransformSequence()


@transforms.add
def add_pernosco_route(config, tasks):
    try_config = config.params.get("try_task_config", {})
    if not try_config.get("pernosco"):
        yield from tasks
        return

    for task in tasks:
        task.setdefault("routes", []).append("notify.pulse.pernosco-v1.on-resolved")
        yield task
+5 −1
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ class Pernosco(TryConfig):
        return super().add_arguments(group)

    def try_config(self, pernosco, **kwargs):
        pernosco = pernosco or os.environ.get("MOZ_USE_PERNOSCO")
        if pernosco is None:
            return

@@ -187,9 +188,12 @@ class Pernosco(TryConfig):
                        break

        return {
            "pernosco": True,
            # TODO Bug 1907076: Remove the env below once Pernosco consumers
            # are using the `pernosco-v1` task routes.
            "env": {
                "PERNOSCO": str(int(pernosco)),
            }
            },
        }

    def validate(self, **kwargs):
+1 −1
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ def test_pernosco(patch_ssh_user):
    cfg.add_arguments(parser)
    args = parser.parse_args(["--pernosco"])
    params = cfg.get_parameters(**vars(args))
    assert params == {"try_task_config": {"env": {"PERNOSCO": "1"}}}
    assert params == {"try_task_config": {"env": {"PERNOSCO": "1"}, "pernosco": True}}


def test_exisiting_tasks(responses, patch_ssh_user):