-
Notifications
You must be signed in to change notification settings - Fork 17
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
Remove leftover load profile #481
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #481 +/- ##
==========================================
- Coverage 79.69% 79.42% -0.27%
==========================================
Files 27 27
Lines 3757 3757
==========================================
- Hits 2994 2984 -10
- Misses 763 773 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
63fc5e6
to
8504ee5
Compare
well, there is one thing needs to change for the existing notebooks or apps the pinning @yakutovicha @danielhollas for comments. |
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 like this change. In particular, this will allow in the future to support multiple AiiDA profiles.
However, as you note this will break most of the existing apps so we should not take this lightly. It's a pity that we did not do it before the 2.0 release. Should we wait with this for 3.0?
On a practical side, I would propose to add a code in aiidalab_widgets_base/__init__.py
that would check whether the AiiDA profile is loaded and throws a RuntimeError
if that is not the case. This error should at least make it very clear to the developers what needs to be done.
I don't think this will happen soon. @yakutovicha we still have control of most of app, do you think it is doable to make this change? I'd argue this can be a feature that is worth adding with a minor release.
I didn't see the point of doing this. This is to prevent the loaded profile being overrided by the |
The point is only to provide a clear error message in case the developer forgets to call The question I had not considered is whether there are widgets which do not require loaded AiiDA profile? In which case we should not have this runtime check I guess. |
I don't think it is a big problem to do that. In most of our notebooks, we have At the moment, the only fear I have is that some of the AWB modules that require AiiDA classes will fail to load. Maybe this is ok (in the end, for exactly that reason we launch |
So I would probably go with this PR taking the suggestion of @danielhollas to through |
8504ee5
to
13bb34a
Compare
51ff655
to
29a5cb2
Compare
As I did try in lastest two commits, if the check is put in the |
raise if profile not loaded rollback runtime exceptions
29a5cb2
to
28d6233
Compare
@unkcpz, is there anything left here to be done? |
Are we in a rush for this? This is a hard breaking change for essentially
all apps that use AWB.
Dne st 12. 7. 2023 9:13 uživatel Aliaksandr Yakutovich <
***@***.***> napsal:
… @unkcpz <https://github.com/unkcpz>, is there anything left here to be
done?
—
Reply to this email directly, view it on GitHub
<#481 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACIY64PNXPSS74O76V7DABTXPZMCLANCNFSM6AAAAAAYCG3YSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
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.
Maybe just some nitpicking from my side, but otherwise good to go.
Not in a rush and yes it is a change that will break other apps. So I tag it to milestone
Yep, It is ready. I'll address your requests. |
I didn't mean to rush anybody. I saw that @unkcpz put the Do we need to do some preparatory work to make sure all apps have profiles loaded? We can, for example, list all the apps and tick-box them if they do. |
This is a good idea, can you create a list of apps and tick boxes for EPMA apps? I'll check other apps. |
Sure, I will put it in the top comment. |
Note that I've already sent my app to some external collaborators so I'd really like things to be stable. At the very least, for breaking things like this I'd like us to get back into a habit of having a reasonable deprecation period. The good news here is that we can first make all the existing apps ready for this change, by making sure they load the profile in the notebook (loading profile twice is okay). I would propose to first do:
In this way, we can release this change in a fully backwards compatible manner (even in a patch release). At the same time it would already allow us to do all the things we wanted (e.g. load non-default profiles, easier unit testing). WDYT @unkcpz @yakutovicha ? |
|
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.
The warning message is very nice! Since it is rather intrusive, we should at least bump the minor version when we release this.
ef63a27
to
a4faac1
Compare
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.
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from aiida import load_profile\n", |
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.
Can you please revert this change, so that we test that the default profile is loaded in init still?
Also, you could then extend the test_aiida_datatypes_viewers
test in tests_notebooks/test_notebooks.py
to check that the deprecation warning is displayed.
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.
Good point, I'll try to add a test.
2cd9a56
to
a449ae5
Compare
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.
LGTM,
The only thing I would consider is whether to propose to the developers an alternative solution using ipython magic:
%load_ext aiida
%aiida
a449ae5
to
b2ef669
Compare
Yes, I move it to #503 |
Yes, we can, but I remember there are issues with this magic, although all are fixed (https://github.com/search?q=repo%3Aaiidateam%2Faiida-core+ipython+magic&type=issues) but it is less robust than the |
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.
Great work, @unkcpz!
Thanks for the review! This will go to |
It is recommended to call load_profile explicitly. After `aiidalab-widgets-base` (aiidalab/aiidalab-widgets-base#481) if not loaded a warning will throw up.
Move the report part from the `submission` step to the `result` step, so that all the report-related parameters are handled in, and only in, the result step. - move all report-related code to the `result` step, the `summary_viewer.py` file. - save all GUI-related data to the `ui_parameters`, and set it as an extra attribute to the node, so we can reload the GUI back. - generate report parameters from the `ui_parameters` and inputs of the workchain node directly. - add unit tests for the `result` step, including a regression test for the report parameters. +5 % now! 😀
The
load_profile()
in__init__.py
to load the profile in module scope was introduced by PR #12. It is not needed anymore since the computer and code widgets are updated and can update the dropdown dynamically.More problematically that this makes the profile loaded in the unit tests and overrides the test profile which makes it has to put the module load inside every test. There is also the problem that if the user want to test the widgets in a newly create python environment that doesn't have an AiiDA profile setup impossible.
Before meeting this, we should make sure that apps which depend on AWB, load profiles in the notebooks. We checkbox the apps if they do: