Skip to content

Commit 5436a5d

Browse files
authored
triage: allow container+commits arg (#1482)
This allows combining `--{passing,failing}-container` with `--{passing,failing}-commits`. The behaviour is that entries in the latter override values read from the former.
1 parent 5b6299c commit 5436a5d

File tree

3 files changed

+69
-20
lines changed

3 files changed

+69
-20
lines changed

.github/triage/jax_toolbox_triage/args.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55
import pathlib
66
import tempfile
77

8+
# Software we know may exist in the containers that we might be able to triage
9+
# We know how to recompile JAX/XLA, so it's OK that they include C++ code
10+
# TransformerEngine is intentionally excluded because build-te.sh is not plumbed yet.
11+
# Flax and MaxText are pure Python, so it's OK we don't have a way of compiling them,
12+
# but they are not always installed in containers we want to triage.
13+
compulsory_software = {"xla", "jax"}
14+
optional_software = {"flax", "maxtext"}
15+
816

917
def parse_commit_argument(s):
1018
ret = {}
1119
for part in s.split(","):
1220
sw, commit = part.split(":", 1)
1321
assert sw not in ret, ret
1422
ret[sw] = commit
15-
assert ret.keys() == {"jax", "xla"}, ret.keys()
1623
return ret
1724

1825

@@ -189,14 +196,24 @@ def parse_args(args=None):
189196
assert (
190197
args.container is None and args.start_date is None and args.end_date is None
191198
), (
192-
"No container-level search options should be passed if the passing/failing containers/commits have been passed explicitly."
199+
"No container-level search options should be passed if the passing/failing"
200+
" containers/commits have been passed explicitly."
193201
)
194202
assert (
195203
args.passing_container is not None or args.failing_container is not None
196-
), ""
204+
), "At least one of --passing-container and --failing-container must be passed."
205+
for prefix in ["passing", "failing"]:
206+
assert (
207+
getattr(args, f"{prefix}_container") is not None
208+
or getattr(args, f"{prefix}_commits").keys() >= compulsory_software
209+
), (
210+
f"--{prefix}-commits must specify all of {compulsory_software} if "
211+
f"--{prefix}-container is not specified"
212+
)
197213
elif sets_of_known_commits == 1:
198214
raise Exception(
199-
"If --passing-{commits OR container} is passed then --failing-{commits OR container} should be too"
215+
"If --passing-{commits AND/OR container} is passed then "
216+
"--failing-{commits AND/OR container} should be too"
200217
)
201218
else:
202219
# None of --{passing,failing}-{commits,container} were passed, make sure the

.github/triage/jax_toolbox_triage/main.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import time
88
import typing
99

10-
from .args import parse_args
10+
from .args import compulsory_software, optional_software, parse_args
1111
from .docker import DockerContainer
1212
from .logic import commit_search, container_search, TestResult
1313
from .pyxis import PyxisContainer
@@ -54,12 +54,6 @@ def get_commit(
5454
def get_commits_and_dirs(
5555
worker: typing.Union[DockerContainer, PyxisContainer], logger: logging.Logger
5656
) -> typing.Tuple[typing.Dict[str, str], typing.Dict[str, str]]:
57-
# Software we know may exist in the containers that we might be able to triage
58-
# We know how to recompile JAX/XLA, so it's OK that they include C++ code
59-
# TransformerEngine is intentionally excluded because there isn't a build-te.sh yet
60-
# Flax and MaxText are pure Python, so it's OK we don't have a way of compiling them
61-
compulsory_software = ["xla", "jax", "flax"]
62-
optional_software = ["maxtext"]
6357
package_commits, dirs = {}, {}
6458
for package in compulsory_software:
6559
package_commits[package], dirs[package] = get_commit(worker, logger, package)
@@ -97,15 +91,22 @@ def get_commits(
9791
container, or return the explicitly passed set of hashes if they are
9892
given.
9993
100-
It is an error for both/neither of the arguments to be None.
94+
If both arguments are non-None, the commits read from inside the given
95+
container will be overwritten by explicit passed entries.
96+
97+
If is an error for both of the arguments to be None.
10198
"""
10299
if explicit_commits is None:
103100
assert container_url is not None
104101
with Container(container_url) as worker:
105102
return get_commits_and_dirs(worker, logger)
106103
else:
107-
assert container_url is None
108-
return explicit_commits, None
104+
if container_url is None:
105+
return explicit_commits, None
106+
with Container(container_url) as worker:
107+
commits, package_dirs = get_commits_and_dirs(worker, logger)
108+
commits.update(explicit_commits)
109+
return commits, package_dirs
109110

110111
def add_summary_record(section, record, scalar=False):
111112
"""

.github/triage/tests/test_arg_parsing.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
"--passing-commits",
2222
"xla:fedcba9876543210,jax:0123456789",
2323
],
24+
[
25+
"--passing-container",
26+
"passing-url",
27+
"--passing-commits",
28+
"jax:123", # xla not needed, the value from passing-container can be read
29+
"--failing-container",
30+
"failing-url",
31+
],
32+
[
33+
"--failing-container",
34+
"failing-url",
35+
"--failing-commits",
36+
"xla:456", # jax not needed, the value from failing-container can be read
37+
"--passing-container",
38+
"passing-url",
39+
],
2440
]
2541
valid_start_end_date_args = [
2642
["--container", "jax"],
@@ -67,14 +83,29 @@ def test_bad_container_arg_combinations_across_groups(date_args):
6783
"--failing-commits",
6884
"xla:fedcba9876543210,jax:0123456789",
6985
],
70-
# Cannot combine --passing-container with --passing-commits etc.
71-
["--passing-container", "passing-url", "--passing-commits", "jax:123,xla:456"],
72-
["--failing-container", "failing-url", "--failing-commits", "jax:123,xla:456"],
7386
# --{passing,failing}-commits must be formatted correctly
74-
["--passing-container", "passing-url", "--failing-commits", "jax:123"],
87+
[
88+
"--passing-container",
89+
"passing-url",
90+
"--failing-commits",
91+
# no xla
92+
"jax:123",
93+
],
7594
["--passing-container", "passing-url", "--failing-commits", "jax:123,jax:456"],
76-
["--passing-container", "passing-url", "--failing-commits", "xla:123"],
77-
["--passing-container", "passing-url", "--failing-commits", "bob:123"],
95+
[
96+
"--passing-container",
97+
"passing-url",
98+
"--failing-commits",
99+
# no jax
100+
"xla:123",
101+
],
102+
[
103+
"--passing-container",
104+
"passing-url",
105+
"--failing-commits",
106+
# neither jax nor xla
107+
"bob:123",
108+
],
78109
],
79110
)
80111
def test_bad_container_arg_combinations_within_groups(container_args):

0 commit comments

Comments
 (0)