diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b96c52f30..10b6933b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,18 @@ # Changelog -## v1.6.2 - 2021-04-26 +## v1.6.3 - 2021-04-28 -[full changelog](https://github.com/aiidateam/aiida-core/compare/v1.6.1...v1.6.2) | [GitHub contributors page for this release](https://github.com/aiidateam/aiida-core/graphs/contributors?from=2021-03-31&to=2021-04-26&type=c) +[full changelog](https://github.com/aiidateam/aiida-core/compare/v1.6.2...v1.6.3) | [GitHub contributors page for this release](https://github.com/aiidateam/aiida-core/graphs/contributors?from=2021-04-281&to=2021-04-28&type=c) + +This is a patch release to fix a bug that was introduced in `v1.6.2` that would cause a number of `verdi` commands to fail due to a bug in the `with_dbenv` decorator utility. + +### Bug fixes +- Fix `aiida.cmdline.utils.decorators.load_backend_if_not_loaded` [[#4878]](https://github.com/aiidateam/aiida-core/pull/4878) + + +## v1.6.2 - 2021-04-28 + +[full changelog](https://github.com/aiidateam/aiida-core/compare/v1.6.1...v1.6.2) | [GitHub contributors page for this release](https://github.com/aiidateam/aiida-core/graphs/contributors?from=2021-03-31&to=2021-04-27&type=c) ### Bug fixes - CLI: Use the proper proxy command for `verdi calcjob gotocomputer` if configured as such [[#4761]](https://github.com/aiidateam/aiida-core/pull/4761) diff --git a/aiida/__init__.py b/aiida/__init__.py index fa8655f8ff..e413f46003 100644 --- a/aiida/__init__.py +++ b/aiida/__init__.py @@ -31,7 +31,7 @@ 'For further information please visit http://www.aiida.net/. All rights reserved.' ) __license__ = 'MIT license, see LICENSE.txt file.' -__version__ = '1.6.2' +__version__ = '1.6.3' __authors__ = 'The AiiDA team.' __paper__ = ( 'S. P. Huber et al., "AiiDA 1.0, a scalable computational infrastructure for automated reproducible workflows and ' diff --git a/aiida/cmdline/utils/decorators.py b/aiida/cmdline/utils/decorators.py index 804f99f957..82bf49f170 100644 --- a/aiida/cmdline/utils/decorators.py +++ b/aiida/cmdline/utils/decorators.py @@ -19,7 +19,6 @@ code branch gets visited and possibly avoiding the overhead if not """ - from contextlib import contextmanager from click_spinner import spinner @@ -33,18 +32,26 @@ def load_backend_if_not_loaded(): - """Load the current profile if necessary while running the spinner to show command hasn't crashed.""" - from aiida.manage.configuration import load_profile, PROFILE + """Load the database backend environment for the currently loaded profile. + + If no profile has been loaded yet, the default profile will be loaded first. A spinner will be shown during both + actions to indicate that the function is working and has not crashed, since loading can take a second. + """ + from aiida.manage.configuration import get_profile, load_profile from aiida.manage.manager import get_manager - if PROFILE is None: + manager = get_manager() + + if get_profile() is None or not manager.backend_loaded: with spinner(): - load_profile() - get_manager().get_backend() + load_profile() # This will load the default profile if no profile has already been loaded + manager.get_backend() # This will load the backend of the loaded profile, if not already loaded def with_dbenv(): - """Function decorator that will load the database environment only when the function is called. + """Function decorator that will load the database environment for the currently loaded profile. + + .. note:: if no profile has been loaded yet, the default profile will be loaded first. Example:: diff --git a/setup.json b/setup.json index 7fb6a7ebad..94f120eecd 100644 --- a/setup.json +++ b/setup.json @@ -1,6 +1,6 @@ { "name": "aiida-core", - "version": "1.6.2", + "version": "1.6.3", "url": "http://www.aiida.net/", "license": "MIT License", "author": "The AiiDA team",