-
Notifications
You must be signed in to change notification settings - Fork 14
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
0x1: Move QeAppWorkChain into the workflow module #379
Conversation
Thanks @unkcpz! Changes look fine, but the Chrome integration tests are failing? Not very familiar with these I'm afraid, so no idea what's going wrong there. |
I would have one suggestion, and that is to still have the workchain as a separate package, but install it together with There are different ways to do it, one way would be to have two packages in the src directory.
Another, somewhat more complicated way would be to use namespace packages. A good page about various possible layouts is in the setuptools docs https://setuptools.pypa.io/en/latest/userguide/package_discovery.html |
@danielhollas thanks for the feedback. I am not sure what is the issue exactly. In my test, I don't have a problem with import. I think you can even more safe to make the workchain an aiida plugin endpoint and use the class by sort of like |
@mbercx, that happened sometimes because the waiting time is too short that the selenium request is not fully loaded (This is what needs to be improved, but it is independent of this change here. I open an issue in #380). I retrigger the test and it passes. |
Thanks @unkcpz , I tested the branch in a new container. The only issue I experienced is that once i did pip install -e . on the branch, I needed an extra |
@AndresOrtegaGuerrero thanks for the test.
I don't think this is a problem. The original approach which split the packages, you also need to restart the daemon. And I think you only need to do this the first time after you install the app. From user's perspective, the |
From my side then it can be merged |
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.
Looks fine to me
Hi @danielhollas, do you want to have a second review on this? Maybe what happened to your app is another issue? |
I will soon be doing a similar refactoring in my app, and will report what I found. I think regardless it make sense to keep the workchain in a separate package (but within the same setup.cfg, installable together) so that aiidalab and aiida workchain always remain uncoupled, and so that aiida daemon does not import ipython/aiidalab/awb stuff. But if it works for you this otherwise looks good and you can merge if you don't want to wait for my investigation. |
Thanks! No in hurry. I'll wait until you do the refactoring and see which way of arranging modules is more clear. |
I don't think this is an issue. When one imports the workchain by: from aiidalab_qe.workflows import QeAppWorkChain It will import all modules inside the aiidalab_qe.__init__.py file. Since AiiDA and AiiDAlab-qe are installed in the same environment, it is not an issue for AiiDA daemon to import these modules. One downside is that this may take time, but will not exceed a few seconds. |
Indeed, that is an issue. For my app, it looks like import itself takes around 3 seconds, while just importing the workchain itself is only 1 second. Also, importing the app ends up importing a lot of stuff, the whole AWB and its dependencies, aiidalab package etc. If one is not careful, there might be side-effects. In my case, I was using a Bokeh command In any case, I think it makes sense to try to decouple the AiiDA workchains from AiiDAlab package, so I ended app having it in a separate subpackage in a way that I can import it separately.
Note that the top-level I am not saying this is the best solution, but that's what I ended up doing for now. https://github.com/ispg-group/aiidalab-ispg/tree/main/aiidalab_ispg I also considered using namespace packages, but it seems a bit too complicated for my use case. |
As a subpackage seems a compromised (and better) solution, will do that. |
cdc9d66
to
4b95501
Compare
I re-organize the modules as @danielhollas suggested. Test locally running a band structure calculation, and works as expected. |
I merge this for now, it kind of blocks me for finalize the refactoring. We are pretty much safe since we are not aggressively make new releases. |
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.
@unkcpz apologies for late review, I was on holidays last week.
@@ -1,11 +1,11 @@ | |||
"""Package for the AiiDAlab QE app.""" |
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.
You probably want to move this file to app/ Otherwise, when you import aiidalab_qe.workflows
you'll end up importing aiidalab_qe.app
as well. The top level init file should probably only export __version__
.
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.
@unkcpz apologies for late review, I was on holidays last week.
No worries, I have to merge it because it was a pain to rebase and continue with #382.
I see, thanks @danielhollas. Will do this in another PR.
* Move QeAppWorkChain into the workflow module and widgets to app sub-module * Remove installation of workchain in pytest conftest.py * remove workchain src version bump and packages in requirements * restructure the module path
* Move QeAppWorkChain into the workflow module and widgets to app sub-module * Remove installation of workchain in pytest conftest.py * remove workchain src version bump and packages in requirements * restructure the module path
As we discussed, it is not needed now to have a separated package for the work chain plugin.
This will make our life easier to modify the work chain. I test on with running some simple calculations locally over QeApp, seems all fine.