-
Notifications
You must be signed in to change notification settings - Fork 192
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 support for process classes to QueryBuilder.append #2421
add support for process classes to QueryBuilder.append #2421
Conversation
@sphuber This PR is now basically ready for review. There are some strange test failures (only 2 tests, only on python2.7) It's not clear to me how they relate to the changes I'm making here -- |
4dde4e5
to
9e95feb
Compare
@ltalirz I took the liberty to squash and rebase your commits onto I have two questions still:
The entry point names here could function just as the node type strings, as in when appending the |
I think it works as long as what you are querying for resolves to "Nodes", which is the case in your example. I didn't modify the logic for handling lists - if you would like to modify it, let me know.
That's a valid point. I skipped this for the moment, since I didn't know whether there was any kind of standardization of the The only thing is that there is currently only one |
Any `Process` class will have an associated `ProcessNode` sub class associated with it that it will use to store its provenance when ran. In addition with the `process_type`, determined by its specific process sub class entry point, defines a set of nodes that correspond to that process class. For example: the `ArithmeticAddCalculation` will use a `CalcJobNode` to store its executions and has a process type according to its entry point: `aiida.calculations:arithmetic.add` This commit implements the functionality necessary that allows a user to append the `ArithmeticAddCalculation` process class to a query builder instance directly.
9e95feb
to
b948b2a
Compare
So, to sum up:
@sphuber Is this correct, and is that how we should proceed? Looking at this mess, I think users will rightfully ask why it has to be so complicated and unintuitive. I'm ok to go with this for the moment, though, to get the 1.0 beta out. |
For 2. the type string is never an entry point string but always one that is based on the module path of the node class. For For the
|
Hm... in the end I don't think it is a good rule. What if someone specifies only a process_type_string (and no orm class type)? Instead of using no filter, for |
You mean you will enable the same subclassing on the |
The process_type of
This is what would be passed to the QueryBuilder
I was thinking more of the usecase where you want to catch aiida-internal subclasses. |
+ start adding tests dirty commit - first need to get a working test database
* set_process_type => build_process_type * move call to build_process_type outside _set_process_type
…rz/aiida_core into issue_2400_process_in_querybuilder
3070d37
to
15e500b
Compare
remove unnecessary code duplication by moving the teardownclass_method from the backend into the base class
+ fix wrong reference in docs
Hm... after some digging, it turns out that For the record: Deleting the travis cache did change something (perhaps it changes some order):
|
Edit: scratch the comment below, I just checked and you have that fix commit. The problem is rather related to the user not being present anymore, like in Django.
|
Just an update - I'm finally able to reproduce the tests locally (not when running |
@sphuber We discussed at some point you wanted to use I therefore propose to get rid of |
If it is a proper setter, as in it gets a value and sets it, then it is fine to get rid of |
use setter from top-level Node class
@sphuber @giovannipizzi I believe I finally found the cause of the failing tests. The problem is that WorkChain classes can store references to ORM objects, such as here.
It's just the database clearing that is an issue... |
+ use locally defined WorkChain to avoid problems with references to ORM objects stored inside WorkChain class
otherwise, pylint may update on travis but not locally (not even after pip install -e .[dev_precommit])
Tests are passing now; also added some (relatively minimal) documentation. |
actually, one is still failing... |
One of these "no output for 10 minutes" cases. Also, should I open an issue for the problem mentioned above? |
I think the problem of node references is something that has caused problems before, for example it was also related to the creation of duplicate node UUIDs. I think we should maybe disallow adding Node instances as defaults in the classmethods like the |
Ok, I'll open an issue for it. |
…ida_core into issue_2400_process_in_querybuilder
closing until final merge to avoid blocking builds |
not sure why this was not fixed automatically...
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.
Few minor comments and a question
else: | ||
if ":" in value: | ||
# if value is an entry point, do usual subclassing | ||
filter = {'or': [ |
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.
Why do we need an or
statement again in the case of sub classing on the process_type
but not in the case of the type
? I forgot
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 process_type
is stored in the database without a .
at the end.
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.
Ah right, if you push the small changes for the other comments I will approve and merge
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've addressed your comments now.
Your comment made me realize an issue - it seems to me one should use get_query_type_from_type_string
also here but when adding it, some tests fail.
I currently don't understand why (perhaps I'm also mistaken). If it is an issue, I'll prefer to fix this in a separate PR.
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.
Yes, let's get this merged and address any issues that may arise later
Thanks a lot @ltalirz , great work! |
fix #2400
fix #2418
classifiers
dictionaryquery_type_string
from classifiers (can be deduced fromormclass_type_string
)process_type_string
To do