-
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
Implement the get_options
method for JobCalculation
#1961
Implement the get_options
method for JobCalculation
#1961
Conversation
get_options
method for JobCalculation
get_options
method for JobCalculation
Codecov Report
@@ Coverage Diff @@
## develop #1961 +/- ##
===========================================
- Coverage 67.56% 67.53% -0.04%
===========================================
Files 324 324
Lines 33342 33373 +31
===========================================
+ Hits 22529 22537 +8
- Misses 10813 10836 +23
Continue to review full report at Codecov.
|
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.
Very good for me, I was just wondering if there is a way to avoid code duplication (I was thinking to define a 'setter' and a 'getter' key-value pair inside each option, and have 'set' call through these - the only catch is that I think we still want to support the direct call of the set_*
methods).
@giovannipizzi did you see my TODO in the PR message? Ideally we remove the explicit implementations. There are just a few with some specific logic/validation. I want to double check that this not necessary. Else we could come up with another key for the options dictionary that defines a validator function or custom getter |
Ah ok thanks, actually not, I had read the message in the email before your edit ;-) |
And I think I just got your response about having the set method call through to the explicit ones, such that we keep those and can still be called directly. Do we really need to keep that baclwards compatibility? Given that this way of creating JobCalculations is deprecated anyway |
Well, I don't know - did we officially deprecate the old way? |
We didn't officially deprecate them, so I agree it is best not to remove them. I have deprecated them and point the user to the |
25c091a
to
7e742f1
Compare
get_options
method for JobCalculation
get_options
method for JobCalculation
7e742f1
to
b47454f
Compare
What is currently defined as the `options` for a `JobCalculation`, are specific attributes that were also stored as node attributes through `set_` methods. These were called setters and are all defined explicitly, along with the corresponding getters. With the introduction of the `Process` paradigm, these could no longer be called manually by the user on the calculation node, and so the `options` dictionary was invented, to allow the user to specify these attributes. However, after a calculation was completed, there was no easy way to retrieve this dictionary with the collection of these attributes. Here we implement this method the `get_options` method which by default will only return those attributes that were explicitly set, but which can be overridden to provide the default values for those that were not explicitly set. The set of available options, along with their valid types, whether they are required docstring and more, are now defined as a dictionary member of the `AbstractJobCalculation` class. The `JobProcess` now uses this to dynamically build up the `options` port namespace in its inputs specification, just like the rest of the input ports are build dynamically based on the use methods.
b47454f
to
28d6d38
Compare
Pull Request Test Coverage Report for Build 3831
💛 - Coveralls |
Fixes #1533
What is currently defined as the
options
for aJobCalculation
, are specificattributes that were also stored as node attributes through
set_
methods. Thesewere called setters and are all defined explicitly, along with the corresponding
getters. With the introduction of the
Process
paradigm, these could no longer becalled manually by the user on the calculation node, and so the
options
dictionarywas invented, to allow the user to specify these attributes.
However, after a calculation was completed, there was no easy way to retrieve this
dictionary with the collection of these attributes. Here we implement this method
the
get_options
method which by default will only return those attributes thatwere explicitly set, but which can be overridden to provide the default values for
those that were not explicitly set.
The set of available options, along with their valid types, whether they are required
docstring and more, are now defined as a dictionary member of the
AbstractJobCalculation
class. The
JobProcess
now uses this to dynamically build up theoptions
port namespacein its inputs specification, just like the rest of the input ports are build dynamically
based on the use methods.