Move CalcJob
spec validator to corresponding namespaces
#3702
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 #3449 and fixes #3431
The
CalcJob
process had a single validator defined on the top levelinput namespace, which validated many ports scattered across the
namespace, such as the
metadata.options.parser_name
as well as themetadata.options.resources
. The validator assumed that all of theseports would always be present, however, this is not necessarily true.
The expose functionality allows a wrapping process to expose only part
of the namespace but the validator remains the same.
To ammeliorate this, the signature of validators is updated to also
receive a
context
in the form of a second argumentport
in additionto the value passed to the port. This
port
will be the instance of theport to which the validator is assigned. This allows the validator
implementation to first check whether a specific port is present before
trying to validate the corresponding value.
Note that the
port
will represent the port to which the validator isattached and so it will have no knowledge of any namespace it might be
embedded in, as it shouldn't, because that will break the portability of
the namespace.
The
port
argument being passed to the validator call was introduced inplumpy==0.14.5
so we upgrade the minimum requirement here. Since thatversion also requires
pyyaml~=5.1.2
we also update that explicitversion in
aiida-core
. Going topyyaml==5.2
will break until we fixthe serialization and deserialization of process instances that are
currently using the
FullLoader
that is no longer allowed to serializearbitrary python objects as we do.