https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-breakfast-49010

10/02/2020, 7:12 PM
is it just me or is (what's currently)
nailgun::ServerState
not being used by anything? @witty-crayon-22786
w

witty-crayon-22786

10/02/2020, 7:13 PM
looks like it, yea. the unnecessary
pub
is throwing off dead code detection
h

hundreds-breakfast-49010

10/02/2020, 7:17 PM
ok I'll remove it
also re: https://github.com/pantsbuild/pants/pull/10865#discussion_r498970890 , how much of the
let exit_code =...
block do you think is simplifiable? most of the logic there is taking care of making sure the
python_signal_fn
callback is repeatedly invoked so we can handle a ctrl-C
@witty-crayon-22786
w

witty-crayon-22786

10/02/2020, 8:17 PM
Mm mm. Got it.
I think that that could be a select loop without a spawned task though?
select(am_i_dead, exit_code)
But maybe you'd need a spawned task to check the "am_i_dead" flag in a loop
So perhaps not a lot simpler
h

hundreds-breakfast-49010

10/02/2020, 8:21 PM
I think the fundamental thing that needs to happen here is that
maybe_break_execution_loop
needs to get called in a synchronous loop, once every <100ms
I don't know how to make that interact with an async task other than with
executor.spawn
w

witty-crayon-22786

10/02/2020, 8:22 PM
Yea. Or the signal handler would need to set the signal by putting it directly on a future queue/tokio event thing.
Yea, that's right. As long as the boolean is itself not an async eventy thing (see above)
h

hundreds-breakfast-49010

10/02/2020, 8:22 PM
is there a way to have python function do that across the FFI?
w

witty-crayon-22786

10/02/2020, 8:22 PM
Yea... Call an ffi that does it
... but it would need to interact with a Session or a global somehow I suppose
...a global in this case maybe, because this is the client, so there is no Session, just an Executor. But on the server this will eventually be something like
Session.canceled
h

hundreds-breakfast-49010

10/02/2020, 8:26 PM
right, but that's out of scope for this PR, right?
I mean, figuring out the design for what state will exist on a
Session
to indicate that the client has requested cancellation
w

witty-crayon-22786

10/02/2020, 8:27 PM
Probably/maybe. Having the state is different from how it is set (signals vs heartbeats)
You already have the state in one place
h

hundreds-breakfast-49010

10/02/2020, 8:27 PM
in any case, that doesn't sound much simpler than calling
spawn
+ this loop, unless there's a reason to want to avoid calling
spawn
w

witty-crayon-22786

10/02/2020, 8:29 PM
Yea, fine