Closed unkcpz closed 10 months ago
Attention: 60 lines
in your changes are missing coverage. Please review.
Comparison is base (
5b303df
) 79.92% compared to head (4060723
) 82.79%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@unkcpz I would recommend to merge with master
branch, I made some fixes in #502 and #508
Thanks @danielhollas, I am thinking about it as well. I rebase it.
Hi @superstar54, @yakutovicha, this is ready for review, let me know how you want me to rebase it so you can review it more easily. It is currently every task has its own commit. I can rebase it to:
computational_resources.py
quite large, I think it is better to move some widgets to files, this is not included in this PR, not sure if we want to have this or not.)Hi @unkcpz thanks for the work. the UI looks more organized than before. I did a test using Quick Setup
, but got an error,
When I checked the code, I found there was a projwfc-7.2@daint-mc
code, which I did select to setup.
In the Quick Setup
UI, it sets up both the computer and code, but the Label
only shows daint-mc
, which may make the user a little confused.
In the Quick Setup UI, it sets up both the computer and code, but the Label only shows daint-mc, which may make the user a little confused.
Good point! This is read from the template, it is the people who upload the template can set the name for this see https://aiidateam.github.io/aiida-resource-registry/database.json, I change it to "Computer Label"
Hi @superstar54, could you try again? I find a bug in my code and it is now fixed see https://github.com/aiidalab/aiidalab-widgets-base/pull/511/commits/f75c79de4a3289e2d0b5e4303790d4918955bf8b
Hi @superstar54, could you try again? I find a bug in my code and it is now fixed see f75c79d
The error still exists. And there is a new error now.
Request for URL https://unkcpz.github.io/aiida-resource-registry/database.json failed; using cached response
Traceback (most recent call last):
File "/opt/conda/lib/python3.9/site-packages/requests_cache/session.py", line 231, in _resend_and_ignore
response.raise_for_status()
File "/opt/conda/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://unkcpz.github.io/aiida-resource-registry/database.json
For the new error, it is because I move the aiida-resource-registry
, and the update in the pr is in the latest commit.
But I have no idea how to fix the previous error. Let's meet in person and debug together when you are in the office.
Thanks a lot for the review! Take you time and since it is quite big pr it deserve time to check details carefully.
but the obvious question I have here is: are you sure you want to have separate widgets for quick setup and detailed setup? I see a lot of duplication there.
This has to be I'd say. The logic of these two widgets is quite different. The quick_setup widget uses the computer resource database and template widgets and the set of inner computer/code widgets happens in one step and quick_setup
button does the last trigger to set the computer and code to the database. But the detali_setup widget has its widgets directly from computer/code widgets.
I started with didn't separate them and found it was insanely complex to implement the template mechanism because everything was tangled. As you can see from the first couple of commits I did the refactoring and decoupled these two things from ComputatianalResourceWidget
, I think after refactoring things became clearer and I can focus on certain parts without worrying about the entanglement of traits huge widget class.
These two things have different orientation, they can appear independently (although I made the detail setup widget shows together with quick_setup widget and put it inside the ComputationalResourceWidget
, it is not necessary, the quick_setup can be used directly to set the computer/code).
From test point of view, these two widgets serve two different use cases and have different flows of usage.
I see a lot of duplication there.
The widgets and their layouts are quite different and the callback functions have different purposes as well. For the quick_setup widget, the callback function is when new computer/code selected, which is triggered from the database widgets. While for the detail_setup widget, the callback function is for when the "setup" button is clicked.
From I understanding, the detail widget is a wrapper of AiidaComputer
and AiidaCode
widget, while quick_setup widget in my design I make it a composite widget to communicate between ComputerResourceDatabaseWidget
and AiidaComputer
/AiidaCode
widgets.
For the record. We had a meeting with @unkcpz to discuss some design aspects. And we agreed on them. At this point, I am waiting for the review request.
Hi @yakutovicha, it is ready to review. I left some notes for myself to clean up, please feel free to add more, the notebook test I didn't fix it because it quite tricky and rely on UI, so I want to leave it after all the design is settled before it is ready to merge.
Hi @yakutovicha, these two behaviors are both expected. See my explanation below. I don't know if there are better solutions.
When I display step-by-step widgets, changing the slurm partition does not affect the prepend text. However, when I change the account number, things get updated.
This is because the for the prepend text
it contains both slurm partition
and slurm account
, I monitoring the template string and only start render the template to full string when all the template variables are ready. I was trying to immediately update the template string but it cause the problem that when I change the template of changed value to other value, the template not get update anymore. For example, I fill the slurm_acount
with jyu
and update the template string "xxxx {slurm_acount} yyyy {slurm_partition} " to "xxxx jyu yyyy {slurm_partiotion}", then the template don't have {{ slurm_acount }}
anymore and I can not change the slurm_account
to other value. This would lead to problem that user wrongly input the username and correct it later.
Therefore design I proposed is to make sure when only use the quick_setup, the behaviors are expected. When the toggle of detailed setup is ticked, it checks the template fields and raises warnings to ask for missing variable.
Also, the computer name template is not updated till I modify the default value. Please correct this.
It is also expected because 1. if the value of widget not changed, it will not trigger the callbacks thus nothing changed. 2. the callbacks are guaranteed to be triggered once you click the detailed_setup checkbox. I guess you encounter this because you first display the detailed setup and then go back to the quick setup to change things. I would regard this is an advance usage and only experts may encounter such scenario.
Hi @yakutovicha, there is a final decision I am not so sure about.
In the https://aiidateam.github.io/aiida-resource-registry/database.json, the metadata section has a relatively flat nest with tooltip
and template variables mixed in the same level with each other.
metadata:
tooltip: "some tooltip"
slurm_account:
default: none
type: text
description: this is a field read from template string
which can be:
metadata:
tooltip: "some tooltip"
template_variables:
slurm_account:
default: none
type: text
description: this is a field read from template string
slurm_partition:
default: debug
type: list
which one do you think is better? Please also check the schema (https://aiidateam.github.io/aiida-resource-registry/resource.schema.json) there, once we make the release, it will become the API_v1 and not going to change in the near future.
Rebased and ready for review @yakutovicha
As discussed with @yakutovicha on Zoom, there are the following things need to be polished:
dlink
instead of observe
for _on_template_variables_*
callbacks.Hi @yakutovicha, I made all the changes as we discussed. You are right that for the weird behavior where the template placeholder not update, the codes are already there. Problem was when the default value does not exist for a template string, the _fill_tempalte
function raise the exception and exits the for loop and following computer_setup are skipped.
For using the dlink
, it is feasible for the code_setup and the test passed directly. But for the computer_setup_and_configure
, I can not make such a change because for the template widget the trait filled_template
is computer_setup
and computer_configure
, while for the resource widget the trait is computer_setup_and_configure
. The transform is not working here because what is needed here is to dlink from computer_setup
-> self.computer_setup_and_configure["setup"]
.
As discussed with @unkcpz separately, I will do the remaining changes.
Hi @yakutovicha, I fix all the tests and try my best to clear the flow of the template class. Please have a "final" (:crossed_fingers:) look.
Congrats @unkcpz, this is a cool feature! 👏
Supersede #483, fixes #482 also fixes https://github.com/aiidalab/aiidalab-qe/issues/240
XXX
001XXX
label 002 is cleaned.Feedbacks from @giovannipizzi after demo in the aiidalab meeting, can add in the template a section "meta" for information like
More tasks after @superstar54's test on CSCS machine.
More tasks after discuss with @yakutovicha.
username
now can be template for thecomputer_configure
. I think this is a very good design decision, we were not able to put username which is a mandatory field forverdi computer configure
since we don't want the code/resoruce registry contain specific information. Now thanks to the flexible template mechanism this information can be asked without specify the final value in the registry setup file.Notes for myself:
Before merge, instead of relying on the remoteaiida-resource-registry
database, mock one as fixture locally but validate it with the remote schema, this give us more flexibility to and robustness to run unit test.metadata.template_variables
?