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

Config: add the hidden warnings.rabbitmq_version option #5415

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Mar 6, 2022

Fixes #5414

This option can be used to suppress the warning that is emitted when a
profile storage is loaded that is configured with a version of RabbitMQ
that is known to be able to cause problems. The option is hidden because
the warning is very important and should not easily be ignorable by
normal users, but it is mostly intended for developers.

The check_rabbitmq_version and check_version free functions are
moved to Manager as methods which allows to use get_option instead
of the get_config_option free function which is just an indirect way
of calling Manager.get_option.

The is_rabbitmq_version_supported function is also corrected. It was
still using < parse('3.8') as a condition whereas it should be
< parse('3.8.15') which was recently already changed for the
check_rabbitmq_version function.

@sphuber sphuber force-pushed the fix/5414/config-option-disable-rabbitmq-warning branch 2 times, most recently from 7f0387f to a7ef8c2 Compare March 7, 2022 18:03
@@ -445,12 +445,18 @@ def check_rabbitmq_version(communicator: 'RmqThreadCommunicator'):
from packaging.version import parse

from aiida.cmdline.utils import echo
from aiida.manage.configuration import get_config_option

show_warning = get_config_option('warnings.rabbitmq_version')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
show_warning = get_config_option('warnings.rabbitmq_version')
show_warning = self.get_option('warnings.rabbitmq_version')

Copy link
Member

@chrisjsewell chrisjsewell Mar 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(FYI this is the code of get_config_option: return get_manager().get_option(option_name), i.e. it is just a shortcut)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@chrisjsewell
Copy link
Member

Eurgh, this feels like unnecessary extra complexity, just for the sake of hiding one config option, without much testing.
For example, you're not hiding it in verdi config list, where more people are likely to see it.

IMHO, I would trust users to know what they are doing, if they set this to false.

@sphuber
Copy link
Contributor Author

sphuber commented Mar 8, 2022

I implemented this as a quick proof-of-concept because when I suggested adding this option @giovannipizzi requested it be hidden. I would personally also be fine with just having this as a normal option and leave it up to the user's discretion whether to ignore it.

@sphuber sphuber force-pushed the fix/5414/config-option-disable-rabbitmq-warning branch from a7ef8c2 to a6080e5 Compare March 9, 2022 10:11
@sphuber sphuber requested a review from chrisjsewell March 9, 2022 10:12
@sphuber sphuber force-pushed the fix/5414/config-option-disable-rabbitmq-warning branch from a6080e5 to 08a4f3f Compare March 9, 2022 10:18
@sphuber
Copy link
Contributor Author

sphuber commented Mar 9, 2022

@chrisjsewell removed the first commit that added concept of hidden options. Also addressed your other comment and fixed the conditional of the correct RabbitMQ version that we missed in the other PR.

@chrisjsewell
Copy link
Member

Well, its a pre-approval, for when the tests are fixed

@sphuber sphuber force-pushed the fix/5414/config-option-disable-rabbitmq-warning branch from 08a4f3f to 4d5ef06 Compare March 9, 2022 10:26
This option can be used to suppress the warning that is emitted when a
profile storage is loaded that is configured with a version of RabbitMQ
that is known to be able to cause problems. The option is hidden because
the warning is very important and should not easily be ignorable by
normal users, but it is mostly intended for developers.

The `check_rabbitmq_version` and `check_version` free functions are
moved to `Manager` as methods which allows to use `get_option` instead
of the `get_config_option` free function which is just an indirect way
of calling `Manager.get_option`.

The `is_rabbitmq_version_supported` function is also corrected. It was
still using `< parse('3.8')` as a condition whereas it should be
`< parse('3.8.15')` which was recently already changed for the
`check_rabbitmq_version` function.
@sphuber sphuber force-pushed the fix/5414/config-option-disable-rabbitmq-warning branch from 4d5ef06 to f4fda1f Compare March 9, 2022 11:13
@sphuber sphuber merged commit 9dd216f into aiidateam:develop Mar 9, 2022
@sphuber sphuber deleted the fix/5414/config-option-disable-rabbitmq-warning branch March 9, 2022 11:39
sphuber added a commit to sphuber/aiida-core that referenced this pull request Mar 24, 2022
This option can be used to suppress the warning that is emitted when a
profile storage is loaded that is configured with a version of RabbitMQ
that is known to be able to cause problems.

The `check_rabbitmq_version` and `check_version` free functions are
moved to `Manager`.

The `is_rabbitmq_version_supported` function is removed as it is no
longer used.

Cherry-pick: 9dd216f
sphuber added a commit that referenced this pull request Mar 24, 2022
This option can be used to suppress the warning that is emitted when a
profile storage is loaded that is configured with a version of RabbitMQ
that is known to be able to cause problems.

The `check_rabbitmq_version` and `check_version` free functions are
moved to `Manager`.

The `is_rabbitmq_version_supported` function is removed as it is no
longer used.

Cherry-pick: 9dd216f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add hidden config option to hide warning about RabbitMQ
2 participants