madMAx43v3r / chia-plotter

Apache License 2.0
2.27k stars 662 forks source link

Feature Request: Graceful shutdown - finish current plot #460

Open vvavepacket opened 3 years ago

vvavepacket commented 3 years ago

Hello,

As of now when performing any maintenance or config changes, we need to kill or stop the plot which causes wasted space. As a product owner of Chia community, I want the ability to stop any running plots and let it finish so that we avoid wasted space and finished product. This feature is similar to Kubernetes ability to drain pods when performing rolling upgrades instead of abruptly sending TERM signal.

Acceptance Criteria:

Business Impact: Convert about to be wasted plot to be a usable one

Environment Impact Help conserve SSD wear and tear and avoid unproductive writes due to abruptly killing

ataa commented 3 years ago

I believe the latest update already has a similar feature:

[P2] Table 5 scan took 41.3621 sec
^C
****************************************************************************************
**  The crafting of plots will stop after the creation and copy of the current plot.        **
**          If you want to resume, press Ctrl-C or send another TERM signal.                **
****************************************************************************************
cp-nilly commented 3 years ago

We got a graceful shutdown option now and no option to force shutdown. TBH, I'd rather have TERM the way it was before because ungracefully quitting the process now is way more complex than it should be.

vvavepacket commented 3 years ago

I prefer to have two options then instead of manually finding the PID to kill. We can go both ways, when TERM is initiated, allow the user what he wants to do whether 1.) graceful (finish existing) 2.) force (just kill it)

madMAx43v3r commented 3 years ago

we can make it such that a second TERM signal within one second will force kill it?

cp-nilly commented 3 years ago

Possible side effects of accidently double tapping c when trying to gracefully quit?

jacyimp commented 3 years ago

I believe ctrl+z still works. Just gotta kill the process afterwards if needed ^^

jd1900 commented 3 years ago

I can't finish plotting. Pressing Ctrl-c once waits current plot to finish. Pressing Ctrl-c twice shows first waiting to finish, then resume back again.