-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add missing features in resource settings tabs #946
Add missing features in resource settings tabs #946
Conversation
e3ca31b
to
c788d27
Compare
3552823
to
82113b8
Compare
f5c4e5f
to
888d042
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #946 +/- ##
==========================================
+ Coverage 67.81% 68.29% +0.47%
==========================================
Files 110 110
Lines 6221 6210 -11
==========================================
+ Hits 4219 4241 +22
+ Misses 2002 1969 -33
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@superstar54 ready for review 🙏 |
Pleeeeeeeeeeeeeeease @superstar54 🙏 |
Hi @edan-bainglass , my apologies for overlooking your comment earlier. I’m reviewing it now. Thanks for your patience! 🙏 |
One more missing feature: the panel shows a wrong warning message when an HPC is selected. This is probably because it checks the resource before the In the screenshot, I selected the merlin hpc with 44 cpus for each node, but it give a warning that it only has 28 cpus (which is the number of my localhost). |
src/aiidalab_qe/common/panel.py
Outdated
dependencies = ["global.global_codes"] | ||
codes = {} # To be defined by subclasses | ||
dependencies = [ | ||
"global.global_codes", |
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.
One concern: the base class hardcodes a dependency on "global.global_codes," where "global" is an identifier defined in the subclass or the context where the class is used.
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.
Yeah, this is not great. It appears to be non-breaking, as linking a model's trait to its own same trait does not raise an error and also doesn't do anything. However, it is still a thorn in principal.
Two ways to decouple:
- Make the global panel unique. I don't like this - regardless of its special treatment, it IS conceptually a resources panel
- Link the dependency explicitly during plugin discovery (in
_fetch_plugin_resource_settings
) rather than via the_link_model
method:
global_model = self._model.get_model("global")
... # then later in the for loop...
self._model.add_model(identifier, model)
tl.dlink(
(global_model, "global_codes"),
(model, "global_codes"),
)
Comments:
- This is the only thing
_link_model
is doing, so by applying the above workaround, we render the method unnecessary - Other future dependencies between the plugin panels and the global panel may require similar workarounds
I'm honestly not too bothered by it. There are more pros than this one conceptual con. But I am open to discussion on the matter.
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.
Another solution is to keep the dependencies empty in the ResourceSettingsModel
and create another PluginResourceSettingsModel
for the plugin, in which we add this global.global_codes
; in this way, we follow the oop and avoid making _fetch_plugin_resource_settings
special.
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.
Very nice 💪
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.
Implemented in latest push!
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.
Hi @edan-bainglass , thanks for the nice work.
One issue when loading the previous calculations, the code setting and the override box are not loaded correctly.
Thanks @superstar54 for the review. Indeed, I discovered this issue yesterday morning but didn't have much time to think about it. I tried first to understand how |
Right, indeed, it appears to be so that the check is done prior to the update of def _render_code_widget(
self,
code_model: CodeModel,
code_widget: QEAppComputationalResourcesWidget,
):
super()._render_code_widget(code_model, code_widget)
if code_model.default_calc_job_plugin == "quantumespresso.pw":
code_model.observe(
self._on_pw_code_resource_change,
[
"num_cpus",
"num_nodes",
"ntasks_per_node",
"cpus_per_task",
"max_wallclock_seconds",
],
) where in A temporary hack would be to add |
@superstar54 could you please have a look at my comments? I think this is closer to a solution, but we need to see if it sufficient. My main concern at the moment is the mistimed firing of Note that some part of the code is only there to handle changes in options occurring on the widget side. This happens when one introduces a new code using the "new code setup" button. However, we discussed removing this button in favor of a dedicated notebook for creating new codes. If and when this gets merged, some code introduced in this PR will be removed. |
Hi @edan-bainglass , thank you for the update. Regarding the dependencies issue, I suggest creating a |
@superstar54 I found out the issue with I'm afraid there is nothing to be done here short of redesigning updateRealizing that's our widget, i.e. not in AWB 😅 Working on a fix... Fixed! |
0c7c80a
to
0aa53f5
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.
Thanks for the nice work! LGTM!
Based on #945
This PR looks to clean up the recently implemented plugin-based tab system in the resources/submission step (#939).
The idea is to leverage the newly developed abstraction in #945 to encapsulate the behavior of ANY resource settings panel, leaving the global resource settings panel to override based on its unique added features.
A few added items addressed in this PR:
Remaining issues:
The new approach somehow causes three tests, which pass in isolation, to fail when running the full suite.
The last one I suspect may simply require a regeneration of the stored references.
But the first two, I suspect here it is a more serious issue that ONLY shows up in testing. I think the issue is that in testing, we generate more than a single instance of certain classes that have
dict
and/orlist
caches. We define these as class variables, which is "fine" for the app, but raises issues when various tests create instances of the class. A quick solution (if indeed this is the issue) is to define these as instance variables. However, this is not straight forward for thecodes
class variable shared by instances ofResourceSettingsModel
s.There is no guarantee that this is the issue. Just a suspicion. Will test further as soon as I am not sick 🤒
@superstar54 good if you take a look, see if I missed something obvious. We can chat when I'm better.
Update
My suspicions were correct. For the last test regarding the differing files, the issue is that part of implementing synchronization of newly setup codes required adding code options to the returned dictionary from
CodeModel.get_model_state
. This method, however, is also used when constructing builder parameters. Though it does not harm the builder process, it does affect the regression test part oftest_create_builder_default
. Simply regenerating the cached file does not help, as code options include UUIDs, which change every time the test runs. So I added aremove_code_options
method to the test to discard the option keys, which resolves the problem.Regarding the other two failing tests, indeed the issue here was the use of dictionary class variables. Both
plugin_mapping
andcodes
dictionary class variables are now changed to instance variables to avoid sharing state across class instances. Again, this is not an issue for the app, as there is only one instance per class. But this is not true for testing.