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

Add stop command to server #43

Closed
Kobzol opened this issue Apr 18, 2018 · 3 comments
Closed

Add stop command to server #43

Kobzol opened this issue Apr 18, 2018 · 3 comments
Labels
enhancement New feature or request

Comments

@Kobzol
Copy link
Contributor

Kobzol commented Apr 18, 2018

The start command conveniently launches a cluster (server + workers), but it makes it a bit cumbersome to stop the cluster.

For a short term, hacky solution, a simple killall on Linux could solve it, or the start command could run the server in-process, so that it would block while the server lives.
But in general I think that the server should have a more general and graceful option to stop itself, defined in its API.

Proposal:
The stop event would stop all the connected workers and then shutdown the server.
The command could look like this:
rain stop server:1234
It would probably make sense to stop individual workers too, possibly with the same command and a --worker flag.

The ability for clients to shutdown the server is a non-issue from a security standpoint, since there is already no client authentication and the cluster supposes that it's run in a trusted environment.

There could also be an option for a "soft stop", that would cause the server to stop scheduling tasks, but it would first wait for the current in-progress tasks to finish (and maybe checkpoint them to disk) before stopping the cluster.

@spirali spirali added the enhancement New feature or request label Apr 18, 2018
@spirali
Copy link
Collaborator

spirali commented Apr 18, 2018

I am planning to add the following functionality:

When "rain start" is executed, it creates a file (e.g. 'rain.env') with information about started processes.
When "rain stop" is executed then it reads the file and terminates all processes that was spawn.
The existence of file makes also quite easy to stop (or start a new!) worker.

It is not difficult to implement it; however, I have now different priorities and "killall rain" is quite good enough :)
But if someone wants to do it, PR is very welcome:)

@spirali
Copy link
Collaborator

spirali commented Apr 23, 2018

After the discussion, it seems that .env file is not necessary and the proposed rain stop is sufficient.

@Kobzol
Copy link
Contributor Author

Kobzol commented May 4, 2018

Implemented as part of #47.

@Kobzol Kobzol closed this as completed May 4, 2018
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

2 participants