Overload PortNamespace mutable properties upon exposing#1635
Merged
sphuber merged 1 commit intoJun 21, 2018
Merged
Conversation
greschd
previously approved these changes
Jun 10, 2018
Member
greschd
left a comment
There was a problem hiding this comment.
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.
Contributor
Author
|
Yes |
eb85fa5 to
fdff746
Compare
muhrin
approved these changes
Jun 21, 2018
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1634
Note: relies on fixes in
plumpythat 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