Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2a920fb
update the triage tool to deal with non-linear history
Steboss Jul 2, 2025
a179182
update changes
Steboss Jul 2, 2025
e848e29
fix args
Steboss Jul 3, 2025
100b1b9
Merge branch 'main' into sbosisio/triage_history
Steboss Jul 3, 2025
cf1345c
start drafting the test for the non-linear bisection
Steboss Jul 4, 2025
259b4ac
fix the test and prepare for refactoring the main
Steboss Jul 4, 2025
c6554e4
refactor main script in multiple ones and start testing
Steboss Jul 4, 2025
acd5bb3
save this version before testing it
Steboss Jul 7, 2025
15ff577
fix argument
Steboss Jul 7, 2025
6bdc74c
fix directory mount
Steboss Jul 7, 2025
6bc0f85
finish off the testing with real examples
Steboss Jul 7, 2025
c5f758e
fix tests
Steboss Jul 8, 2025
3ed49f2
fix test with origin main
Steboss Jul 8, 2025
fbc6faa
fix test and code, so we can avoid having feature-branch
Steboss Jul 8, 2025
5845bfe
fix initialization of package and create a more robust test
Steboss Jul 8, 2025
c053884
create a test for the entire triage tool class
Steboss Jul 8, 2025
e6334de
remove previous test
Steboss Jul 8, 2025
897dab5
Merge branch 'main' into sbosisio/triage_history
Steboss Jul 8, 2025
883062f
Ruff and MyPy fixes
Steboss Jul 8, 2025
f1a02d8
try to fix for python 3.8
Steboss Jul 8, 2025
eb15191
try another way to pack dictionaries for 3.8
Steboss Jul 8, 2025
057f2d1
ruff fix
Steboss Jul 8, 2025
2571363
add a scheme with all the process
Steboss Jul 9, 2025
457595b
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss Jul 10, 2025
0e59bbf
start addressing comments
Steboss Jul 10, 2025
c86388a
fix comments
Steboss Jul 11, 2025
27326d0
start fixing the tests too
Steboss Jul 11, 2025
b3c1bae
fix tests and code itself. then remove logging
Steboss Jul 11, 2025
a1f49fd
start fixing CI, the test still fails because of the relative path
Steboss Jul 11, 2025
535aedb
fix CI
Steboss Jul 11, 2025
3a6a3d4
fix comments
Steboss Jul 14, 2025
8342ee0
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
4e56a73
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
7d760e4
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
08029c1
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
cd64936
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
43b4ce1
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
6d125aa
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
a974336
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 14, 2025
654d084
update tests for linear case, update output of triage tool
Steboss Jul 15, 2025
f30fd5b
Merge branch 'sbosisio/triage_history' of github.com:NVIDIA/JAX-Toolb…
Steboss Jul 15, 2025
fc4abfb
fix code with ruff and mypy
Steboss Jul 15, 2025
9cd243c
remove old test
Steboss Jul 15, 2025
d3db487
Merge branch 'main' into sbosisio/triage_history
Steboss Jul 15, 2025
13c9c0c
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss Jul 15, 2025
c791124
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss Jul 15, 2025
9dcbaf1
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss Jul 15, 2025
e465499
Update .github/triage/jax_toolbox_triage/summary.py
Steboss Jul 15, 2025
b07f960
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss Jul 15, 2025
48665b3
Update .github/triage/tests/test_triage_history_bisection.py
Steboss Jul 15, 2025
881fa0b
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss Jul 15, 2025
729f4d9
fix errors and comments
Steboss Jul 15, 2025
ed6da54
Merge branch 'sbosisio/triage_history' of github.com:NVIDIA/JAX-Toolb…
Steboss Jul 15, 2025
d6b4253
fix error
Steboss Jul 15, 2025
1e13d19
fix @olupton comments
Steboss Jul 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 36 additions & 3 deletions .github/triage/jax_toolbox_triage/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,23 @@ def parse_version_argument(s: str) -> typing.Dict[str, str]:
return ret


def parse_override_remotes(s: str) -> typing.Dict[str, str]:
"""Function to parse the override remote

Inputs:
s: (str) e.g. https://<token>@host/repo.git

Returns:
ret: (typing.Dict[str,str]) Dictionary with software as key and git-url as value.
"""
ret: typing.Dict[str, str] = {}
for part in s.split(","):
sw, url = part.split(":", 1)
assert sw not in ret, ret
ret[sw] = url
return ret


def parse_args(args=None) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="""
Expand Down Expand Up @@ -208,6 +225,14 @@ def parse_args(args=None) -> argparse.Namespace:
in question has different versions at the endpoints of the bisection range.
""",
)
version_search_args.add_argument(
"--override-remotes",
type=parse_override_remotes,
default={},
help="""Remote URLs to be used for fetching, including auth token. E.g.:
jax:https://<token>@host/repo.git,xla:https://<token>@host/repo.git
""",
)
parser.add_argument(
"-v",
"--container-mount",
Expand All @@ -225,10 +250,18 @@ def parse_args(args=None) -> argparse.Namespace:
help="Container runtime used, can be docker, pyxis, or local.",
type=lambda s: s.lower(),
)
args = parser.parse_args(args=args)
assert args.container_runtime in {"docker", "pyxis", "local"}, (
args.container_runtime
parser.add_argument(
"--main-branch",
type=str,
default="main",
help="The name of the main branch (e.g. main) to derive cherry-picks from",
)
args = parser.parse_args(args=args)
assert args.container_runtime in {
"docker",
"pyxis",
"local",
}, args.container_runtime
# --{passing,failing}-commits are deprecated aliases for --{passing,failing}-versions.
for prefix in ["passing", "failing"]:
commits = getattr(args, f"{prefix}_commits")
Expand Down
105 changes: 105 additions & 0 deletions .github/triage/jax_toolbox_triage/bisect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
import datetime
import subprocess


def get_commit_history(
worker,
package,
start,
end,
dir,
main_branch,
logger=None,
args=None,
):
"""
Get the commit history for a given package between two commits.

Args:
worker (Container): The container worker to execute commands.
package (str): The name of the package.
start (str): The starting commit hash.
end (str): The ending commit hash.
dir (str): The directory where the git repository is located.
main_branch (str): The main branch name. Defaults is the default branch of the repo.
logger (Logger, optional): Logger for debug information. Defaults to None.
args: Additional arguments that may contain cherry-pick commits.

Returns:
data: list, list of all the commits
cherry_pick_range: str, range of cherry pick commits if any
"""
# In particular the end commit might not already be known if the older,
# passing, container is being used for triage.
commits_known = worker.exec(
[
"sh",
"-c",
f"git cat-file commit {start} && git cat-file commit {end}",
],
policy="once_per_container",
workdir=dir,
)
if commits_known.returncode != 0:
worker.check_exec(
["git", "fetch", args.override_remotes.get(package, "origin"), start, end],
workdir=dir,
)

# detect non-linear history
is_ancestor_result = worker.exec(
["git", "merge-base", "--is-ancestor", start, end],
workdir=dir,
)
is_linear = is_ancestor_result.returncode == 0
cherry_pick_range = {}

if not is_linear:
logger.info(f"Using non-linear history logic with branch {main_branch}")

# 1. find the linear range on the main branch
passing_and_failing_cmd = worker.check_exec(
[
"sh",
"-c",
f"git merge-base {start} {end} && git merge-base {end} {main_branch}",
],
workdir=dir,
).stdout.strip()
passing_main_commit, failing_main_commit = passing_and_failing_cmd.splitlines()

# 2. find commits to cherry-pick from the failing branch
# TODO: as an alternative approach we may need to consider `{passing_main_commit}..{start}`
cherry_pick_range[package] = f"{failing_main_commit}..{end}"

# 3. now we can use the main branch commits for bisection
start = passing_main_commit
end = failing_main_commit

logger.info(f"cherry_pick_range: {cherry_pick_range}, start: {start}, end: {end}")

# now create the right git command to retrieve the history between start..end
result = worker.check_exec(
[
"git",
"log",
"--first-parent",
"--reverse",
"--format=%H %cI",
f"{start}^..{end}",
],
policy="once",
stderr=subprocess.PIPE,
workdir=dir,
)

data = []
for line in result.stdout.splitlines():
commit, date = line.split()
# for python < 3.11 we nee dto fix:
if date.endswith("Z"):
date = date[:-1] + "+00:00"
date = datetime.datetime.fromisoformat(date).astimezone(datetime.timezone.utc)
data.append((commit, date))

return data, cherry_pick_range
28 changes: 28 additions & 0 deletions .github/triage/jax_toolbox_triage/container_factory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import logging
from .container import Container
from .docker import DockerContainer
from .pyxis import PyxisContainer
from .local import LocalContainer


def make_container(
runtime: str, url: str, mounts: list, logger: logging.Logger, **kwargs
) -> Container:
"""
This function creates a container object, based on the specified runtime
Args:
runtime (str): The container runtime to use (e.g., 'docker', 'pyxis', 'local').
url (str): The URL of the container.
mounts (list): List of mounts to be used in the container.
logger (logging.Logger): Logger instance for logging messages.
**kwargs: Additional keyword arguments for specific container types.
Returns:
Container: A container class associated with the specified runtime.
"""
if runtime == "local":
return LocalContainer(logger=logger)

container_impl = DockerContainer if runtime == "docker" else PyxisContainer
return container_impl(url, logger=logger, mounts=mounts, **kwargs)
Loading