How to correctly switch off worker/How to use worker maintenance mode

What is Maintenance mode and why I need to use it?

Maintenance mode allows to gracefully shut down your worker instance for maintenance without risk of being blacklisted by Customers/Connor bots. It will stop the tasks, remove sell orders from Market, close all deals automatically. Maintenance mode can be engaged via maintenance scheduler in SONM CLI.

WARNING You can only go to maintenance mode if all deals can be closed at this moment. You cannot enter maintenance mode while you have any Forward Deal - because they are time-bound and can not be interrupted from supplier side. You can read more about deal types here. Better option is to manually check your deals before planning maintenance. Look how to do it in example section of this manual

Using maintenance mode is important due following reasons:

  • Supplier should clearly understand that his equipment may have running tasks. He has a deal for renting out his equipment and receive payments for it;
  • After worker shutdown all active deals remain open - so Customer may try to launch task on your worker instance and failed;
  • Active orders still remain on market - so if you'll just turn off your machine someone coud buy non-existing resources;
  • If you want to launch your own tasks on your equipment - you'll lose performance on your own tasks and you'll be unable to provide promised resources;

You as Supplier must ensure that all running through your machine tasks are stopped, all deals and all orders are closed before worker shut down. If your equipment can not provide the promised performance, you can be considered a dishonest supplier. In that case you will probably lose the deal, Customer will include you to blacklist and you will not be able to have deals with this Customer in the future.

Maintenance scheduler command description

Video-version of following manual.

WARNING:

  • Check all your deals before planning maintenance. This can be done in SONM CLI this way. Get your Deals ID:

    sonmcli worker ask-plan list | grep dealid:

  • Check your Deal status - and pay attention to Deal type here

    sonmcli deal status <dealid> In case you have Forward deal - time to next maintenance must exceed time before deal expiration

Use following command to schedule time before next maintenance: sonmcli worker maintenance <XhYmZs>

X, Y, Z here should be numeric value of hours, minutes, seconds respectively. All Sell orders are created with time left until maintenance - so you can not accept any Forward deal with time that exceeds this time.

Example of usage:

  • I want to set time remaining until next maintenance to 12 hours, 35 minutes, 20 seconds: sonmcli worker maintenance 12h35m20s
  • In case I want to shut down my worker immediately: sonmcli worker maintenance 0h After time is set you can always check it by executing this command: sonmcli worker next-maintenance - it will print next scheduled maintenance.

In case you want to change that time - use sonmcli worker maintenance <XhYmZs> command again

WARNING:

  • Make sure all your orders are inactive before worker shutdown. sonmcli worker ask-plan list | grep orderid:
  • All orders ID should be = null

After maintenance mode is engaged you may safely turn off your worker service:

sudo service sonm-worker stop

To disengage maintenance mode - use maintenance scheduler again

sonmcli worker maintenance 10000h