-
Notifications
You must be signed in to change notification settings - Fork 66
Triage tool deals with non-linear history #1538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
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 a179182
update changes
Steboss e848e29
fix args
Steboss 100b1b9
Merge branch 'main' into sbosisio/triage_history
Steboss cf1345c
start drafting the test for the non-linear bisection
Steboss 259b4ac
fix the test and prepare for refactoring the main
Steboss c6554e4
refactor main script in multiple ones and start testing
Steboss acd5bb3
save this version before testing it
Steboss 15ff577
fix argument
Steboss 6bdc74c
fix directory mount
Steboss 6bc0f85
finish off the testing with real examples
Steboss c5f758e
fix tests
Steboss 3ed49f2
fix test with origin main
Steboss fbc6faa
fix test and code, so we can avoid having feature-branch
Steboss 5845bfe
fix initialization of package and create a more robust test
Steboss c053884
create a test for the entire triage tool class
Steboss e6334de
remove previous test
Steboss 897dab5
Merge branch 'main' into sbosisio/triage_history
Steboss 883062f
Ruff and MyPy fixes
Steboss f1a02d8
try to fix for python 3.8
Steboss eb15191
try another way to pack dictionaries for 3.8
Steboss 057f2d1
ruff fix
Steboss 2571363
add a scheme with all the process
Steboss 457595b
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss 0e59bbf
start addressing comments
Steboss c86388a
fix comments
Steboss 27326d0
start fixing the tests too
Steboss b3c1bae
fix tests and code itself. then remove logging
Steboss a1f49fd
start fixing CI, the test still fails because of the relative path
Steboss 535aedb
fix CI
Steboss 3a6a3d4
fix comments
Steboss 8342ee0
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 4e56a73
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 7d760e4
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 08029c1
Update .github/triage/tests/test_triage_history_bisection.py
Steboss cd64936
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 43b4ce1
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 6d125aa
Update .github/triage/tests/test_triage_history_bisection.py
Steboss a974336
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 654d084
update tests for linear case, update output of triage tool
Steboss f30fd5b
Merge branch 'sbosisio/triage_history' of github.com:NVIDIA/JAX-Toolb…
Steboss fc4abfb
fix code with ruff and mypy
Steboss 9cd243c
remove old test
Steboss d3db487
Merge branch 'main' into sbosisio/triage_history
Steboss 13c9c0c
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss c791124
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss 9dcbaf1
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss e465499
Update .github/triage/jax_toolbox_triage/summary.py
Steboss b07f960
Update .github/triage/jax_toolbox_triage/triage_tool.py
Steboss 48665b3
Update .github/triage/tests/test_triage_history_bisection.py
Steboss 881fa0b
Update .github/triage/jax_toolbox_triage/bisect.py
Steboss 729f4d9
fix errors and comments
Steboss ed6da54
Merge branch 'sbosisio/triage_history' of github.com:NVIDIA/JAX-Toolb…
Steboss d6b4253
fix error
Steboss 1e13d19
fix @olupton comments
Steboss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import datetime | ||
| import subprocess | ||
|
|
||
|
|
||
| def get_commit_history( | ||
olupton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
olupton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( | ||
olupton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.