-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Allow patial update to wpt manifest #47588
Conversation
26d192f
to
7f8fa87
Compare
Folks, can you take a look? Tests are running fine in chromium (https://chromium-review.googlesource.com/c/chromium/src/+/5991965). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tools/manifest/update.py
Outdated
@@ -79,6 +81,9 @@ def create_parser() -> argparse.ArgumentParser: | |||
parser.add_argument( | |||
"--no-parallel", dest="parallel", action="store_false", default=True, | |||
help="Do not parallelize building the manifest") | |||
parser.add_argument('tests', | |||
nargs='*', | |||
help='Paths of test files or directories to update.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help='Paths of test files or directories to update.') | |
help=('Test files or directories to update. ' | |
'Omit to update all items under the test root.')) |
tools/manifest/vcs.py
Outdated
for filename, path_stat in filenames: | ||
path = os.path.join(subdir, | ||
os.path.join(dirpath, filename).decode("utf8")) | ||
if mtime_cache is None or mtime_cache.updated(path, path_stat): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Put the shared file case in a internal helper (e.g., yield self._make_file_info(path, path_stat)
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs some tests, and some profiling to indicate no perf regression in the case where we don't pass in any paths.
@@ -79,6 +81,9 @@ def create_parser() -> argparse.ArgumentParser: | |||
parser.add_argument( | |||
"--no-parallel", dest="parallel", action="store_false", default=True, | |||
help="Do not parallelize building the manifest") | |||
parser.add_argument('tests', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably I'm missing something, but I don't see where this command line argument is being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the description, Additional work is needed to plug in this into the test runner. This change only make patial update in wpt manifest
command possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably I'm missing something, but I don't see where this command line argument is being used.
Line 49, above:
Line 49 in b4aa684
paths_to_update=kwargs['tests'], |
Is there a reason why this could cause perf regression? I can get the data though. |
f3bc9aa
to
b4aa684
Compare
I tried to run before: After: So real time increased about 0.12s. If this is consistent, this probably is due to the instroduce of
|
@@ -79,6 +81,9 @@ def create_parser() -> argparse.ArgumentParser: | |||
parser.add_argument( | |||
"--no-parallel", dest="parallel", action="store_false", default=True, | |||
help="Do not parallelize building the manifest") | |||
parser.add_argument('tests', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably I'm missing something, but I don't see where this command line argument is being used.
Line 49, above:
Line 49 in b4aa684
paths_to_update=kwargs['tests'], |
tools/manifest/update.py
Outdated
@@ -45,6 +46,7 @@ def update_from_cli(**kwargs: Any) -> None: | |||
manifest.load_and_update(tests_root, | |||
path, | |||
kwargs["url_base"], | |||
paths_to_update=kwargs['tests'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: The rest of this file seems to use double-quotes. Please match the local style.
manifest_path: Optional[Text] = None, | ||
rebuild: bool = False) -> None: | ||
self.tests_root = tests_root | ||
self.url_base = url_base | ||
self.paths_to_update = paths_to_update or [''] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaulting to ['']
seems slightly surprising. Do we not want to default to [self.tests_root]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is relevant to the other comments in __iter__
. Similar to the response there, I'd like to keep this relative to the tests root.
|
||
def __iter__(self) -> Iterator[Tuple[Text, Optional[Text], bool]]: | ||
for path_to_update in self.paths_to_update: | ||
path = os.path.join(self.tests_root, path_to_update) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to be joining to tests_root
, or do we want to be joining to the current working directory? Certainly they'll frequently be the same, but this feels maybe slightly surprising?
From the CLI, I'd expect to be able to pass an absolute path in here and have it work — or give an error if it wasn't within the test root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like path_to_update
to be relative to tests_root
.
If we want to accept absolute paths from CLI, I think we can handle that when process the command line arguments. But after that we only need to keep the part relative to tests_root
, as paths out of test root can not be handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We eventually want to yield something that is relative to tests_root
, so keep path_to_update
relative to the tests_root
seems more natural?
tools/manifest/vcs.py
Outdated
def __iter__(self) -> Iterator[Tuple[Text, Optional[Text], bool]]: | ||
def _make_file_info(self, | ||
path: Text, | ||
path_stat) -> Tuple[Text, Optional[Text], bool]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path_stat) -> Tuple[Text, Optional[Text], bool]: | |
path_stat: stat_result) -> Tuple[Text, Optional[Text], bool]: |
To run WPTs locally, developers usually only run a few of tests each time. Updating WPT manifest for the whole WPT Repo is not necessary and took ~3 seconds on a performant develop machine. And this can take forever if the developer is using a remote file system. This change allows updating WPT manifest for tests only intended to be run. This brings down the test time for a few tests to ~0.5 seconds. Additional work is needed to plug in this into the test runner.
b4aa684
to
bd7e8be
Compare
bd7e8be
to
f367c07
Compare
I tried to use Do you have any suggestion on this? @jgraham |
@gsnedders can you take a look at the updates? Thanks! |
* Allow patially update to wpt manifest To run WPTs locally, developers usually only run a few of tests each time. Updating WPT manifest for the whole WPT Repo is not necessary and took ~3 seconds on a performant develop machine. And this can take forever if the developer is using a remote file system. This change allows updating WPT manifest for tests only intended to be run. This brings down the test time for a few tests to ~0.5 seconds. Additional work is needed to plug in this into the test runner.
To run WPTs locally, developers usually only run a few of tests each time. Updating WPT manifest for the whole WPT Repo is not necessary and took ~3 seconds on a performant develop machine. And this can take forever if the developer is using a remote file system.
This change allows updating WPT manifest for tests only intended to be run. This brings down the test time for a few tests to ~0.5 seconds.
With this patch applied, we did not see a time increase when updating manifest for the entire repo.
Additional work is needed to plug in this into the test runner.