-
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
Overload PortNamespace mutable properties upon exposing #1635
Overload PortNamespace mutable properties upon exposing #1635
Conversation
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.
Are the fixes in plumpy
the reason why the tests still fail? Otherwise looks good to me, feel free to merge when the tests pass.
Yes |
eb85fa5
to
fdff746
Compare
155ce7c
to
5ccf592
Compare
When exposing the ports of a process one would expect that the receiving port namespace would not just inherit the ports but also the mutable properties of the PortNamespace, such as the default, valid_type, help, validator and required attribute. The method that was responsible for creating the new namespace and exposing the ports, ProcessSpec._expose_ports, failed to do this. However, plumpy already defined a method that did just this, PortNamespace.absorb(). To fix this problem, we decided to move the expose functionality to plumpy and leverage the absorb method, which already properly overloaded mutable properties of the donor namespace to the host namespace. The only other addition is that the implementation of exposing ports in plumpy did not yet have a memory, as required by the implementation in aiida-core. This implementation, along with the proper namespace property inheritance has now been released with plumpy v0.10.3, which is the new dependency. The expose methods in plumpy now also takes an optional dictionary namespace_options which can be used to override even the properties of the source namespace that would be inherited. If the ports are exposed into a namespace that does not yet exist in the target namespace, it will be constructed using this namespace_options dictionary as constructor keyword arguments. Note that these namespace options will *not* be used for any sub namespaces that will have to be created along the way, nor will they be used to override any of the properties of already existing sub namespaces.
5ccf592
to
458ea02
Compare
Codecov Report
@@ Coverage Diff @@
## develop #1635 +/- ##
==========================================
+ Coverage 57.06% 57.1% +0.04%
==========================================
Files 275 274 -1
Lines 33923 33874 -49
==========================================
- Hits 19357 19343 -14
+ Misses 14566 14531 -35
Continue to review full report at Codecov.
|
Fixes #1634
Note: relies on fixes in
plumpy
that have not yet been released.When exposing the ports of a process one would expect that the
receiving port namespace would not just inherit the ports but
also the mutable properties of the PortNamespace, such as the
default, valid_type, help, validator and required attribute.
Therefore the _expose_ports method is adapted to overload the
mutable properties from the source namespace to the target
namespace.
The method now also takes an optional dictionary namespace_options
which can be used to override even the properties of the source
namespace. If the ports are exposed into a namespace that does not
yet exist in the target namespace, it will be constructed using
this namespace_options dictionary as constructor keyword arguments.
Note that these namespace options will not be used for any sub
namespace that will have to be created along the way, nor will they
be used to override any of the properties of already existing sub
namespaces