-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ctrl-c is the wrong key to trigger cancellation #16
Comments
I think the best way to fix this is to double fork and create a new session, or run pegasus as a daemon since many users have the habit of using ctrl+c |
@NobodyXu Thanks for the advice! I gave it some more thought. One possible solution that popped up is for the pre_exec(|| unsafe { nix::libc::setsid() }) Single-forking would still be okay of I think this will make the |
Yes that requires modifications to openssh, however I don't think this is a great solution. That would mean the ssh multiplex master won't exit and release the resource (including the TCP connection). Next invocation of pegasus would create another ssh multiplex master and TCP connection. Since pegasus is designed to run tasks on clusters, I think it is more reasonable to run it as a daemon that keep running tasks on the remote until you explicitly terminate it. |
Ah, I get your point. It's not easy to guarantee that all the ssh masters terminate when pegasus dies/terminates/is killed/panics. Making Pegaus a daemon seems good. 👍 I think I'll implement a stop command for termination. |
Pressing ctrl-c when Pegasus is running will also send ctrl-c to the entire foreground process group, thus also sending SIGINT to the
ssh
processes.Instead of waiting for ctrl-c with the tokio ctcl-c catcher, find another way to catch the user's intent to cancel.
Possible solutions:
stdin
for something random. Likeq<Enter>
.pegasus stop
command. This should make sure to identify the specificpegasus
process that is running on the current working directory. This will probably require a pid file.pegasus
per directory (if not, that means more than onepegasus
processes are manipulatingqueue.yaml
andconsumed.yaml
).The text was updated successfully, but these errors were encountered: