aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

CLI: `verdi daemon restart` `--timeout` option not working as expected

Open mbercx opened this issue 9 months ago • 1 comments

Describe the bug

I'm running into the following:

❯ verdi daemon restart --reset --timeout 20
Profile: dev
Stopping the daemon... OK
Starting the daemon with 1 workers... FAILED
Critical: The daemon failed to start or is unresponsive after 2 seconds.

The message is pretty clear that it's also possible that the daemon started but is simply unresponsive, but I would expect that it waits for 20 seconds due to the --timeout setting

  -t, --timeout INTEGER           Time in seconds to wait for a response
                                  before timing out.

I then configured the default timeout to 20 seconds and all was well:

❯ verdi config set daemon.timeout 20
Success: 'daemon.timeout' set to 20 for 'dev' profile
❯ verdi daemon restart --reset
Profile: dev
Stopping the daemon... OK
Starting the daemon with 1 workers... OK

Expected behavior

So two suggested action points would be:

  1. Fix the --timeout not being used properly, unless I misunderstand it's purpose?
  2. Increase the default timeout to e.g. 5 or 10.

Your environment

  • Operating system [e.g. Linux]: macOS Ventura 13.5.1
  • Python version [e.g. 3.7.1]: 3.10.13
  • aiida-core version [e.g. 1.2.1]: 2.4.1
  • RabbitMQ: 3.12.7

Context

Originally raised in #3800

mbercx avatar Nov 16 '23 09:11 mbercx

I tried to solve this issue , there I noticed

TIMEOUT = OverridableOption(
    '-t',
    '--timeout',
    type=click.FLOAT,
    default=5.0,
    show_default=True,
    help='Time in seconds to wait for a response before timing out.',
)

default is already 5.0 should it be increased to 10??

and I feel this change has to be made image

If there are any mistakes in the code I provided, please let me know so I can fix them.

SharanRP avatar Mar 05 '24 18:03 SharanRP

This option is now deprecated and will be removed so I am going to close this

sphuber avatar Apr 21 '24 06:04 sphuber

Thanks @sphuber. I see the --timeout flag was removed in https://github.com/aiidateam/aiida-core/commit/8ac6424108d1528bd3279c81da62dd44855b6ebc, since apparently it only had an effect on the "soft" restart mode (i.e. keep the process and restart the workers). But wouldn't we want to have a timeout option for the "hard" restart mode as well?

mbercx avatar Apr 21 '24 20:04 mbercx

Could have done, since verdi daemon stop takes the --timeout option, but don't think it is that important to be honest

sphuber avatar Apr 21 '24 21:04 sphuber