Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
CLI: add the
verdi database version
command #4613CLI: add the
verdi database version
command #4613Changes from all commits
cb2d4d2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_backend_manager
should load the backend?isn't that a significant change?
should this be in this PR?
I probably just miss the reasoning for these changes, could you please explain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the changes in this file can be explained as follows, and they should answer all three of your questions. The
get_backend_manager
was so far not loading the backend, although that really doesn't make any sense. It is providing access to data from the database, but to do so the backend should be loaded, otherwise a connection isn't possible. This problem went unnoticed, because theBackendManager
is only used inaiida.engine.utils.set_process_state_change_timestamp
. By the time this gets used, the database backend will already have been loaded through another code path.For the changes in this PR, however, I needed to get just the backend manager and have the backend loaded, which wasn't the case. I couldn't simply call
_load_backend()
in theget_backend_manager
because this would lead to infinite recursion as_load_backend()
also callsget_backend_manager
. Therefore I had to refactor_load_backend
to not call the former and directly fetch it through `aiida.backends.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the clarification, very helpful!
One last question:
_load_backend()
now uses a backend manager that is then thrown away.If these two things indeed have to go together, why not let
_load_backend()
also setself._backend_manager
?The current solution seems to duplicate the creation of the backend manager, once in
_load_backend()
and once inget_backend_manager()
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in because I wasn't sure that there wasn't a code path (unlikely, but still) where the backend manager instance would not be constructed in
_load_backend
because it is in the conditionalif configuration.BACKEND_UUID is None:
. If that somehow isFalse
the calling_load_backend
will not create an instance of the backend manager. So callingget_backend_manager
will returnNone
. I have looked more into the code to see where the design mistake is, but I am not sure yet how to improve the flow. Most of this code that makes it complicated is to deal with the possibility of unloading/reloading different profiles, which is currently anyway not supported. Maybe it is best to leave like this for now, but if you prefer I can assign the backend manager in_load_backend
toself._backend_manager
and remove the construction fromget_backend_manager
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, please add a comment in the corresponding issue so that we don't forget
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!