aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
431 stars 187 forks source link

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

Closed mbercx closed 5 months ago

mbercx commented 10 months ago

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

Context

Originally raised in #3800

SharanRP commented 7 months ago

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.

sphuber commented 5 months ago

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

mbercx commented 5 months ago

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?

sphuber commented 5 months ago

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