You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some components have many arguments associated with them. It is not always necessary for the end-user to define all of them and we might want to stick with default values. Currently this is not available and all the components require an argument.
This feature should enable users to set default values for certain components while defining the components. Those values can then be optionally passed during the pipeline definition.
Proposed Approach
We first define the default arguments at the component_spec level:
compnent_spec.yaml
name:componentdescription: Component that downloads images based on URLsimage: ghcr.io/ml6team/download_images:latestconsumes:
...produces:
...args:
min_image_size: #mandatory argumentdescription: Minimum size of the images.type: inttimeout: #optional argumentdescription: Maximum time (in seconds) to wait when trying to download an image default: 3type: int
Then, at the step when we add and parse the arguments in component.py
we check if a default argument is provided, if so we set the optional field when adding the argument:
def_add_and_parse_args(self):
parser=argparse.ArgumentParser()
component_arguments=self._get_component_arguments()
forargincomponent_arguments.values():
# Input manifest is not required for loading componentifarg.name=="input_manifest_path":
input_required=Falseelse:
input_required=Trueifarg.defaultisnotNone:
default=arg.defaultelse:
default=Noneparser.add_argument(
f"--{arg.name}",
type=kubeflow2python_type[arg.type],
required=input_required,
default=default,
help=arg.description,
)
returnparser.parse_args()
Additionally, we need to make the necessary changes to the component_spec.py by adding an optional default field to the Argument dataclass as well as modifying the KubeflowComponentSpec as specified here to include default arguments.
Create a component with optional argument and test whether omitting the argument will return the default values. Also test if we can override the default values successfully.
Additional testing will have to be done when running kubeflow but difficult to test with tests (has to be done manually with a mock submitted pipeline).
Documentation
Extend the Argsdocumentation with examples of default pipelines.
Feedback and Suggestions
Dependent features
None
Additional Notes
The text was updated successfully, but these errors were encountered:
PR that enables adding default arguments as discussed in #179.
Users can now define default arguments in the component specs. Those
arguments do not have to be explicitly defined in the `ComponentOp` but
could still be overridden.
Note: please review this
[PR](#196) beforehand since I am
branched off from it.
Created a separate ticket to do the necessary changes #198. Best to
handle it in a separate PR.
---------
Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
PR that enables adding default arguments as discussed in #179.
Users can now define default arguments in the component specs. Those
arguments do not have to be explicitly defined in the `ComponentOp` but
could still be overridden.
Note: please review this
[PR](#196) beforehand since I am
branched off from it.
Created a separate ticket to do the necessary changes #198. Best to
handle it in a separate PR.
---------
Co-authored-by: Robbe Sneyders <robbe.sneyders@gmail.com>
Problem Statement
Some components have many arguments associated with them. It is not always necessary for the end-user to define all of them and we might want to stick with default values. Currently this is not available and all the components require an argument.
This feature should enable users to set default values for certain components while defining the components. Those values can then be optionally passed during the pipeline definition.
Proposed Approach
We first define the default arguments at the
component_spec
level:compnent_spec.yaml
Then, at the step when we add and parse the arguments in
component.py
we check if a default argument is provided, if so we set the optional field when adding the argument:
Additionally, we need to make the necessary changes to the
component_spec.py
by adding an optionaldefault
field to theArgument
dataclass as well as modifying theKubeflowComponentSpec
as specified here to include default arguments.Implementation Steps/Tasks
component_spec.json
to accept an optionaldefault
fieldcomponent.py
component_spec.py
Potential Impact
Testing
Create a component with optional argument and test whether omitting the argument will return the default values. Also test if we can override the default values successfully.
Additional testing will have to be done when running kubeflow but difficult to test with tests (has to be done manually with a mock submitted pipeline).
Documentation
Extend the
Args
documentation with examples of default pipelines.Feedback and Suggestions
Dependent features
None
Additional Notes
The text was updated successfully, but these errors were encountered: