hundreds-breakfast-49010
09/18/2020, 8:04 PMhundreds-breakfast-49010
09/18/2020, 8:04 PM--debug
flag to foreground them; e.g. ./pants test --debug tests/python/pants_test/pantsd/pantsd_integration_test.py
hundreds-breakfast-49010
09/18/2020, 8:05 PMhundreds-breakfast-49010
09/18/2020, 8:05 PMaloof-angle-91616
09/18/2020, 8:13 PMhundreds-breakfast-49010
09/18/2020, 8:15 PMaloof-angle-91616
09/18/2020, 8:15 PMhundreds-breakfast-49010
09/18/2020, 8:16 PM--debug
seems to cause ctrl-c to not actually quit tests processes, which I think might be because when the main instance of pantsd that is running tests exits, it doesn't necessarily kill the testsaloof-angle-91616
09/18/2020, 8:17 PMaloof-angle-91616
09/18/2020, 8:17 PMhundreds-breakfast-49010
09/18/2020, 8:18 PMaloof-angle-91616
09/18/2020, 8:18 PMwitty-crayon-22786
09/18/2020, 9:15 PMwitty-crayon-22786
09/18/2020, 9:16 PMwitty-crayon-22786
09/18/2020, 9:17 PMnails
now gives a guarantee that the client input only stays open as long as the client is connected and sending heartbeats. but we don’t do anything with that information in pants’ nailgun server yet.witty-crayon-22786
09/18/2020, 9:21 PMaloof-angle-91616
09/18/2020, 9:22 PMhundreds-breakfast-49010
09/18/2020, 9:23 PMwitty-crayon-22786
09/18/2020, 9:23 PMhundreds-breakfast-49010
09/18/2020, 9:23 PMhundreds-breakfast-49010
09/18/2020, 9:29 PMpython3.6
processes aroundhundreds-breakfast-49010
09/18/2020, 9:29 PM/usr/bin/python3.6 ./test_runner.pex --no-header src/python/pants/engine/internals/scheduler_integration_test.py
and /usr/bin/python3.6 -m pants --no-pantsrc --pants-workdir=/tmp/.tmpjyLQzy/.pants.d/tmp/tmp6g359434.pants.d --print-exception-stacktrace=True --pantsd --pants-config-files=[] --backend-packages=['pants.backend.python', 'internal_plugins.rules_for_testing'] list-and-die-for-testing examples/src/python/example/hello/greet
(this might vary with the specific test being run)hundreds-breakfast-49010
09/18/2020, 9:30 PMInteractiveProcess
mechanism is sticking around on the system even though pantsd
itself has quitwitty-crayon-22786
09/18/2020, 9:31 PMhundreds-breakfast-49010
09/18/2020, 9:32 PMwitty-crayon-22786
09/18/2020, 9:32 PM./pants run
, and then ctrl+c’ing it kills the sleep forever.hundreds-breakfast-49010
09/18/2020, 11:42 PMhundreds-breakfast-49010
09/18/2020, 11:42 PMaloof-angle-91616
09/18/2020, 11:42 PMaloof-angle-91616
09/18/2020, 11:42 PMaloof-angle-91616
09/18/2020, 11:42 PMhundreds-breakfast-49010
09/18/2020, 11:42 PMaloof-angle-91616
09/18/2020, 11:43 PMhundreds-breakfast-49010
09/18/2020, 11:43 PMaloof-angle-91616
09/18/2020, 11:43 PMaloof-angle-91616
09/18/2020, 11:43 PMaloof-angle-91616
09/18/2020, 11:43 PMaloof-angle-91616
09/18/2020, 11:44 PMhundreds-breakfast-49010
09/18/2020, 11:49 PMInteractiveProcess
hundreds-breakfast-49010
09/18/2020, 11:49 PMhundreds-breakfast-49010
09/18/2020, 11:49 PMaloof-angle-91616
09/18/2020, 11:51 PMaloof-angle-91616
09/18/2020, 11:51 PMhundreds-breakfast-49010
09/18/2020, 11:58 PMhundreds-breakfast-49010
09/18/2020, 11:59 PMhundreds-breakfast-49010
09/18/2020, 11:59 PM./pants --no-pantsd test --debug src/python/pants/engine/internals/engine_test.py
for instance doesn't leave any test process runningaloof-angle-91616
09/18/2020, 11:59 PMhundreds-breakfast-49010
09/18/2020, 11:59 PMaloof-angle-91616
09/18/2020, 11:59 PMhundreds-breakfast-49010
09/19/2020, 12:00 AM--debug
is passed, then the subprocess is executed via the rust Command
mechanism in the enginehundreds-breakfast-49010
09/19/2020, 12:00 AMhundreds-breakfast-49010
09/19/2020, 12:00 AMhundreds-breakfast-49010
09/19/2020, 12:00 AMaloof-angle-91616
09/19/2020, 12:00 AMRemotePantsRunner
so i would look to see if we're forwarding the signal correctly therealoof-angle-91616
09/19/2020, 12:01 AMhundreds-breakfast-49010
09/19/2020, 12:01 AMhundreds-breakfast-49010
09/19/2020, 12:01 AMhundreds-breakfast-49010
09/19/2020, 12:01 AM./pants --no-pantsd test --debug src/python/pants/engine/internals::
then if I hit ctrl-c, whatever process si currently running will die, but then the next one takes overhundreds-breakfast-49010
09/19/2020, 12:01 AMaloof-angle-91616
09/19/2020, 12:01 AMhundreds-breakfast-49010
09/19/2020, 12:02 AMhundreds-breakfast-49010
09/19/2020, 12:02 AM--debug
to debug one test at a time. but nothing right now stops anyone from passing it with more than one test targethundreds-breakfast-49010
09/19/2020, 12:03 AMhundreds-breakfast-49010
09/19/2020, 12:03 AMhundreds-father-404
09/19/2020, 12:04 AM--debug
is interesting. With repl
and run
, we know we’ll only have one interactive process
Until recently, it was the same with --debug
, but we recently loosened the constraints so that you could run as many tests as you wantwitty-crayon-22786
09/19/2020, 12:05 AMhundreds-breakfast-49010
09/19/2020, 12:06 AMhundreds-breakfast-49010
09/19/2020, 12:06 AM--debug
case, I'm not sure what the best thing to do iswitty-crayon-22786
09/19/2020, 12:07 AMwitty-crayon-22786
09/19/2020, 12:07 AMhundreds-breakfast-49010
09/19/2020, 12:07 AMhundreds-father-404
09/19/2020, 12:08 AMrepl
, I like the non-pantsd behavior that it results in a KeyboardInterrupt
being printed from the Repl, which is what you’d get without Pants too. Pants is a light wrapper
(The pantsd behavior is different than non-pantsd for repl
)hundreds-breakfast-49010
09/19/2020, 12:08 AMInteractiveProcess
doesn't let pants itself handle ctrl-c (which was months ago)hundreds-father-404
09/19/2020, 12:09 AMhundreds-breakfast-49010
09/19/2020, 12:09 AMhundreds-breakfast-49010
09/19/2020, 12:09 AMhundreds-breakfast-49010
09/19/2020, 12:10 AMpytest
binary directly to run tests in a python repo?hundreds-breakfast-49010
09/19/2020, 12:10 AMhundreds-father-404
09/19/2020, 12:10 AMdoes anyone run the pytest binary directly to run tests in a python repo?Yes, for sure. This is the default flow. Or a light shell script that runs it, yeah But that script is only running Pytest in one subprocess call, usually
aloof-angle-91616
09/19/2020, 12:27 AM--debug
, are we piping out in our rust code to stdout and stderr? or are we letting it inherit the parent file descriptors? i'm not sure if that's related to why ^C gets sent to the child instead of pantsaloof-angle-91616
09/19/2020, 12:27 AMhundreds-breakfast-49010
09/19/2020, 12:29 AMhundreds-breakfast-49010
09/19/2020, 12:30 AM<http://interface.rs|interface.rs>
hundreds-breakfast-49010
09/19/2020, 12:30 AMCommand
api has some faculties for doing things to the std* file descriptors that I don't think we're using?aloof-angle-91616
09/19/2020, 12:30 AMhundreds-breakfast-49010
09/19/2020, 12:31 AMaloof-angle-91616
09/19/2020, 12:31 AMhundreds-breakfast-49010
09/19/2020, 12:31 AMspawn
or status
, but create pipes for output"
hundreds-breakfast-49010
09/19/2020, 12:31 AM.spawn
later on in the filehundreds-breakfast-49010
09/19/2020, 12:32 AMhundreds-breakfast-49010
09/19/2020, 12:32 AM--debug
only be used with one targethundreds-breakfast-49010
09/19/2020, 12:33 AM--debug
is so that you can run a test interactively, so you can debug italoof-angle-91616
09/19/2020, 12:33 AM./pants test --debug ::
though maybe in a small repohundreds-breakfast-49010
09/19/2020, 12:33 AMaloof-angle-91616
09/19/2020, 12:33 AMhundreds-breakfast-49010
09/19/2020, 12:34 AMaloof-angle-91616
09/19/2020, 12:34 AMhundreds-breakfast-49010
09/19/2020, 12:34 AMhundreds-breakfast-49010
09/19/2020, 12:34 AMaloof-angle-91616
09/19/2020, 12:38 AMfor debug_request in debug_requests:
if debug_request.process is None:
continue
debug_result = interactive_runner.run(debug_request.process)
if debug_result.exit_code != 0:
exit_code = debug_result.exit_code
so yes they do run serially for --debug
aloof-angle-91616
09/19/2020, 12:40 AM--debug --fail-fast
which would avoid the multiple ^C (and default it to False maybe)hundreds-breakfast-49010
09/19/2020, 12:42 AMtest
goal that should change to accomodate ithundreds-breakfast-49010
09/19/2020, 12:42 AMaloof-angle-91616
09/19/2020, 12:43 AMaloof-angle-91616
09/19/2020, 12:43 AMhundreds-breakfast-49010
09/19/2020, 12:50 AMdebug_result
to have a way to distinguish an actual test failure from a ctrl-chundreds-breakfast-49010
09/19/2020, 12:50 AMpytest
levelhundreds-breakfast-49010
09/19/2020, 12:50 AMpytest
- other test runners exist)aloof-angle-91616
09/19/2020, 12:50 AM--fail-fast
behavior is a pretty reasonable flag to havealoof-angle-91616
09/19/2020, 12:51 AMhundreds-father-404
09/19/2020, 1:21 AM--debug
only applies to one target. This was crucial when we made the change to the model of targets, where now Pants always runs one-file-at-a-time (unless we batch). Without the change, ./pants test path/to:target
would complain if the target had >1 filehundreds-father-404
09/19/2020, 1:23 AMi feel like the --fail-fast behavior is a pretty reasonable flag to havePossibly. We thought about that when loosening
--debug
, but didn’t add because you’re not expected to use --debug
for more than when you need a debugger. So we didn’t want to optimize for it; test
already has a ton of optionsaloof-angle-91616
09/19/2020, 3:53 AM./pants help
become unwieldy for so many options on one subsystem?hundreds-father-404
09/19/2020, 3:59 AMor does ./pants help become unwieldy for so many options on one subsystem?Options fatigue. It gets overwhelming when you have too much choice. It also (often) makes it harder for plugin authors to implement things the more options we add. For example, adding
--test-force
was worth it, but it means that plugin authors now need to be careful to respect the flagaloof-angle-91616
09/19/2020, 3:59 AMhundreds-father-404
09/19/2020, 4:02 AMtest --force
was added based on a user request.
The other day, I thought “let’s add a `force_reruns`” field to python_tests()
, and Stu pointed out it was a bit premature, that we don’t know how users would need something like that. So we didn’t land the change.aloof-angle-91616
09/19/2020, 4:03 AMhundreds-father-404
09/19/2020, 4:11 AMaloof-angle-91616
09/19/2020, 4:11 AMaloof-angle-91616
09/19/2020, 4:12 AMaloof-angle-91616
09/19/2020, 4:13 AMhundreds-father-404
09/19/2020, 4:13 AMrepl
, that I really like when you’re not using Pantsd that we behave just like you would without Pants. That is, ctrl-c results in “KeyboardInterrupt” being printed to the REPL, but not exiting
That would imply “We should pass the signal through to the InteractiveProcess and let it handle it”.
But, then, that might be really unergonomic for test --debug
🤔 and I don’t think we want lots of special casing in the Rust codealoof-angle-91616
09/19/2020, 4:15 AMif
branch predicated on the fieldhundreds-father-404
09/19/2020, 4:15 AMand I don’t think we want lots of special casing in the Rust codeWell, possibly, it should be an option on
InteractiveProcess
like capture_signals
?
I’m a little skeptical for similar reasons of “option fatigue”, but this time applied to rule authors. The more parameters we add, the higher our surface area for bugs.
But none of these options seem perfect. So, could be worth consideringhundreds-father-404
09/19/2020, 4:15 AMaloof-angle-91616
09/19/2020, 4:15 AMaloof-angle-91616
09/19/2020, 4:18 AM--debug
is especially useful to attach a debugger (and to have stdin and a tty attached, basically): could that be its own goal? feels not too hard because v2 rules are so easy to mix and matchhundreds-father-404
09/19/2020, 4:18 AMpantsd
and --no-pantsd
should be consistent
* repl
and run
should likely not capture signals; the underlying process should handle them. Note that there’s only one InteractiveProcess in the whole run for thosealoof-angle-91616
09/19/2020, 4:19 AMhundreds-father-404
09/19/2020, 4:20 AMand also if i understand you correctly, --debug is especially useful to attach a debugger (and to have stdin and a tty attached, basically):Alex considered that when adding the option a long time ago. Same with Tansy when adding coverage, to have a
coverage
goal.
I think a couple people weighed in and all agreed that the option was nice to a) reduce the number of goals that users need to learn, and b) keep things more organized for plugin authors. For example, when you implement test
, you must implement test --debug
right now; it would be confusing if you could do one but not the otherhundreds-father-404
09/19/2020, 4:21 AMtest --debug
do? If we let the underlying process handle signals, you would have to press ctrl-c
for every single test, given that there may be multiple tests in a run. Might an option be appropriate, or options fatigue and we should choose?hundreds-father-404
09/19/2020, 4:22 AMInteractiveProcess
would be helpful. We would do something like capture_signals=test_subsystem.exit_early
aloof-angle-91616
09/19/2020, 4:29 AMFor example, when you implement test, you must implement test --debug right now;something's bugging me, i feel like there's a way to handle this nicely, thinking about it
We would do something like capture_signals=test_subsystem.exit_early
capture_signals
is very interesting. i think that the shell terminal captures it and sends the signal, but i know for example if you run emacs -nw
and press C-c
(that's ctrl-c), it obviously captures it normally. that's a curses app, so i don't know at what level that translation occurs, or if we can avoid it being converted into a signal and then handle keyboard codes for the tty or whatever it's calledhundreds-father-404
09/19/2020, 4:30 AMsomething’s bugging me, i feel like there’s a way to handle this nicely, thinking about itSee https://github.com/pantsbuild/example-plugin/blob/main/pants-plugins/examples/bash/shunit2_test_runner.py for how a plugin author implements both.
aloof-angle-91616
09/19/2020, 4:31 AMhundreds-father-404
09/19/2020, 4:31 AMaloof-angle-91616
09/19/2020, 4:32 AMhundreds-breakfast-49010
09/20/2020, 9:45 AMhundreds-breakfast-49010
09/20/2020, 9:46 AMInteractiveProcess
ought to handle signalshundreds-breakfast-49010
09/20/2020, 9:48 AMtest --debug
case, possibly becuase I was operating under the mindset that this was a bug in signal handling, rather than expect, if (possibly) undesirable, behavior