Skip to content

Commit

Permalink
no bug - fix ./mach taskgraph test-action-callback r=releng-reviewers…
Browse files Browse the repository at this point in the history
…,jmaher DONTBUILD

First, import `yaml` from `taskgraph` instead of `gecko_taskgraph` now
that bug 1733950 has landed.

Second, avoid trying to create decision task indexes if `gecko_taskgraph.create.testing` is True (we set this in `test-action-callback` [here](https://searchfox.org/mozilla-central/rev/d488f68d845a87cc107612b667951152c34fb116/taskcluster/gecko_taskgraph/actions/registry.py#344); we need to import `create` and check `create.testing` rather than `from create import testing` because the value changes after we import it.

Third, don't die in `optimize` if we're in testing: the `status_task` call can return `None` in that case.

And fourth, let's noop bugbug `push_schedules` if we're in `create.testing`; this appears to fix a hang.

Differential Revision: https://phabricator.services.mozilla.com/D128001
  • Loading branch information
escapewindow committed Oct 11, 2021
1 parent 2f08607 commit 8def273
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
7 changes: 4 additions & 3 deletions taskcluster/gecko_taskgraph/decision.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from taskgraph.util.yaml import load_yaml
from voluptuous import Required, Optional, Any

from . import GECKO
from . import GECKO, create
from .actions import render_actions_json
from .create import create_tasks
from .generator import TaskGraphGenerator
Expand Down Expand Up @@ -207,8 +207,9 @@ def taskgraph_decision(options, parameters=None):
write_artifacts=True,
)

# set additional index paths for the decision task
set_decision_indexes(decision_task_id, tgg.parameters, tgg.graph_config)
if not create.testing:
# set additional index paths for the decision task
set_decision_indexes(decision_task_id, tgg.parameters, tgg.graph_config)

# write out the parameters used to generate this graph
write_artifact("parameters.yml", dict(**tgg.parameters))
Expand Down
2 changes: 1 addition & 1 deletion taskcluster/gecko_taskgraph/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def action_callback(options):
def test_action_callback(options):
import gecko_taskgraph.parameters
import gecko_taskgraph.actions
from gecko_taskgraph.util import yaml
from taskgraph.util import yaml
from gecko_taskgraph.config import load_graph_config

def load_data(filename):
Expand Down
4 changes: 3 additions & 1 deletion taskcluster/gecko_taskgraph/optimize/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ def should_replace_task(self, task, params, deadline, index_paths):
try:
task_id = find_task_id(index_path)
status = status_task(task_id)
if status.get("state") in ("exception", "failed"):
# status can be `None` if we're in `testing` mode
# (e.g. test-action-callback)
if not status or status.get("state") in ("exception", "failed"):
continue

if deadline and datetime.strptime(
Expand Down
5 changes: 5 additions & 0 deletions taskcluster/gecko_taskgraph/util/bugbug.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from mozbuild.util import memoize

from gecko_taskgraph.util.taskcluster import requests_retry_session
from gecko_taskgraph import create

try:
# TODO(py3): use time.monotonic()
Expand Down Expand Up @@ -73,6 +74,10 @@ def _write_perfherder_data(lower_is_better):

@memoize
def push_schedules(branch, rev):
# Noop if we're in test-action-callback
if create.testing:
return

url = BUGBUG_BASE_URL + "/push/{branch}/{rev}/schedules".format(
branch=branch, rev=rev
)
Expand Down

0 comments on commit 8def273

Please sign in to comment.