Skip to content
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

Cancelling commands #11

Open
jaywonchung opened this issue Feb 13, 2022 · 1 comment
Open

Cancelling commands #11

jaywonchung opened this issue Feb 13, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jaywonchung
Copy link
Owner

jaywonchung commented Feb 13, 2022

Cancelling commands ran by Pegasus is very difficult. You essentially have to ssh into each node and manually figure out the PIDs of commands and kill them.

Nested commands, so to say, make things more complicated. For instance, docker exec sh -c "python train.py" will run the following commands:

  • Ran by user: sh -c docker exec sh -c "python train.py"
  • Ran by user: docker exec sh -c "python train.py"
  • Ran by root:sh -c "python train.py"
  • Ran by root: python train.py

Only killing the fourth python train.py command will truely achieve cancellation. The bottom line is, it is difficult for Pegasus to infer how to properly terminate a command.

Potential solutions

  • We might ask the user for a cancellation command in queue.yaml. For example, sudo kill $(pgrep -f 'train.py'). Then the ctrl_c handler will create a new connection to the hosts and run the designated cancellation command.
  • Somehow figure out the PGID of the sh process and run sudo kill -- -PGID. Can we pgrep -f with the entire command? Shell escaping might become a problem. (pgrep -f with every single word in the command and kill the intersection of all PIDs returned?)
@jaywonchung jaywonchung added the enhancement New feature or request label Feb 13, 2022
@jaywonchung
Copy link
Owner Author

Commands ran with docker exec currently have no standard way to kill.

Following moby/moby#41548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant