Skip to content
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

seprate workchain selector to be extendable #401

Merged
merged 5 commits into from
May 26, 2023

Conversation

unkcpz
Copy link
Member

@unkcpz unkcpz commented May 18, 2023

fixes #388
This PR is also an attempt of aiidalab/aiidalab-widgets-base#382.

@codecov
Copy link

codecov bot commented May 18, 2023

Codecov Report

Patch coverage: 30.50% and project coverage change: -0.14 ⚠️

Comparison is base (6c26138) 50.66% compared to head (de5083a) 50.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
- Coverage   50.66%   50.53%   -0.14%     
==========================================
  Files          16       16              
  Lines        1804     1789      -15     
==========================================
- Hits          914      904      -10     
+ Misses        890      885       -5     
Flag Coverage Δ
python-3.10 50.53% <30.50%> (-0.14%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiidalab_qe/app/process.py 30.23% <30.50%> (-5.42%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unkcpz this looks great, thanks! Let's try it out here, and then later we can upstream to AWB.

Except for some minor comments / suggestions that you can feel free to ignore, there is one subtle thing about triggering a refresh upon submitted WorkChain completion.

aiidalab_qe/app/process.py Show resolved Hide resolved
aiidalab_qe/app/process.py Outdated Show resolved Hide resolved
qe.ipynb Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look closely at the corresponding PR in my app, I've added one extra hack, where I trigger the workchain selector refresh when a submitted workflow finishes. That way the process status in the selector is updated from "Running" to "Finished". This is a bit ugly since I need to directly patch the ProcessMonitor object in one of the Step classes, the but it works.

https://github.com/ispg-group/aiidalab-ispg/pull/177/files#diff-5c45c68ed738fa714abe5583a6dabb14053e4cc0c93d8b253292d1cca0464a6aR162

Copy link
Member Author

@unkcpz unkcpz May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, this is cool. I also mad process_monitor the interface of ViewQeAppWorkCHainStatusAndStep so it is designed to be used as such, then it is not very hacked. I change it back because after look at the ProcessMonitor this on_seal is not very clear to me. I think it is more better to first to make the process monitor properly interfaced and have a way no notify another widget with the process is finished.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. The on_sealed callbacks are called when the process finishes. Normally one should passed them via the class constructor, so what I am doing is definitely hacky, since I am touching the internal implementation of ProcessMonitor.

@danielhollas
Copy link
Contributor

@unkcpz since there is already an associated issue, I've removed this PR from the AiiDAlab project to avoid duplication. Hope that's okay.

@unkcpz
Copy link
Member Author

unkcpz commented May 23, 2023

Sure, thanks! If you mean it is duplicated with #388 which is already in the current sprint. I was adding this to the project in order to set it to the current sprint so I didn't forget to bring it up in the meeting (I admit this is not the original way we plan to use the sprint, but for myself it a bit easy to track everything happened. I start to have a very bad memory among a couple of things 😿 ).

@unkcpz unkcpz added the backport Backport PR to legacy support label May 25, 2023
@unkcpz unkcpz requested a review from danielhollas May 25, 2023 17:12
Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a two short suggestions, otherwise I am approving....

aiidalab_qe/app/process.py Outdated Show resolved Hide resolved
aiidalab_qe/app/process.py Outdated Show resolved Hide resolved
Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unkcpz have you tested your latest changes? Found a bug while I was transplanting this into my app.

aiidalab_qe/app/process.py Outdated Show resolved Hide resolved
@unkcpz unkcpz force-pushed the fea/separate-workchain-selector branch from ffef39a to de5083a Compare May 25, 2023 21:14
@unkcpz unkcpz requested a review from danielhollas May 25, 2023 21:14
Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. I've transplanted this to my app and everything is much cleaner now, thanks!

@unkcpz unkcpz merged commit a3d0ef7 into main May 26, 2023
8 of 12 checks passed
@unkcpz unkcpz deleted the fea/separate-workchain-selector branch May 26, 2023 08:48
unkcpz added a commit that referenced this pull request May 29, 2023
As mentioned in #388, the workchain selector is one of the sources lead to the memory leak. It uses a spare threading to update the list which is not fully necessary because the `refresh` button is already served for this purpose.

In this PR we did not only remove the threading but also decouple the QeAppWorkChain specific code out as the sub-class, so the WorkChainSelector can be re-used through inherited by other apps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Backport PR to legacy support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorkChainSelector: Remove background thread
2 participants