Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable pantsd in inner runs. (#7884)
**Problem** When a pants run under pantsd calls pants, it will also enable pantsd in the inner run. Since we don't allow parallel runs under pantsd, the inner run will block waiting for the outer run to complete, eventually timing out and crashing the whole run. See #7881 for context. The only real instance we've seen of this was entirely accidental. **Solution** Explicitly disable pantsd through an environment variable whenever we are serving a pailgun request. **Result** Inner runs under pantsd have the daemon turned off by default. Fixes #7881 , Depends on #7890 Commits should be independently reviewable.
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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,6 @@ | ||
python_binary( | ||
name="nested_runs", | ||
source="run_pants_with_pantsd.py", | ||
compatibility=['CPython>=3.6,<4'] | ||
) | ||
|
23 changes: 23 additions & 0 deletions
23
testprojects/src/python/nested_runs/run_pants_with_pantsd.py
This file contains 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,23 @@ | ||
import pathlib | ||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
workdir = sys.argv[1] | ||
config = pathlib.Path(workdir) / 'pants.ini' | ||
|
||
cmd = [ | ||
'./pants', | ||
'--no-pantsrc', | ||
f'--pants-config-files={config}', | ||
'--print-exception-stacktrace=True', | ||
f'--pants-workdir={workdir}', | ||
'goals' | ||
] | ||
print(f'Running pants with command {cmd}') | ||
subprocess.run(cmd, check=True) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains 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