pytorch
59a81b69 - Fix flaky linter clang-tidy relative path (#94093)

Commit
2 years ago
Fix flaky linter clang-tidy relative path (#94093) There are some occurrences when clang-tidy linter fails flakily with the following error, which is very weird: ``` >>> Lint for FILE: Error (CLANGTIDY) command-failed Failed due to FileNotFoundError: [Errno 2] No such file or directory: '.lintbin/clang-tidy' ``` For examples, * https://hud.pytorch.org/pytorch/pytorch/commit/0a93e6db5abdcc9196199d68f0c8e56578a74315 * https://hud.pytorch.org/pytorch/pytorch/commit/203b2cad3e4c650955a47d9973cfec83a3960056 The binary is definitely there as the log shows that it has been downloaded successfully from S3. Looking a bit closer, I notice that the linter uses `os.chdir` to jump around between the workspace and the build folder. And it also refers to the binary with the relative path `.lintbin/clang-tidy` which doesn't exist in the latter. AFAIK, the current working directory is per process (https://stackoverflow.com/questions/16388400/what-is-a-thread-specific-os-chdir-and-mkdir-in-python), so I suspect that there is a race here where one thread chdir into build while another thread tries to lint another file. Thus the fix to use the absolute path to clang-tidy Pull Request resolved: https://github.com/pytorch/pytorch/pull/94093 Approved by: https://github.com/malfet
Author
Committer
Parents
Loading