-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Creating a valohai step and running it locally using python raises an error when the data type is meant to be anything that is not NoneType but the default value is None.
The following step can be used to test this.
"""Test Valohai step that prints an integer parameter with default value None."""
import valohai
def main() -> None:
"""Main execution function that prints the test parameter."""
# Get the parameter value
test_param = valohai.parameters("test_int_param").value
# Print the parameter value and its type
print(f"Parameter value: {test_param}")
print(f"Parameter type: {type(test_param)}")
print(f"Is None: {test_param is None}")
if __name__ == "__main__":
default_parameters = {
"test_int_param": {
"type": "integer",
"default": None,
"optional": True,
"description": "Test integer parameter with default value None.",
},
}
valohai.prepare(
step="test-int-none-param",
image="python:3.12-slim",
default_parameters=default_parameters,
)
main()Run command:
python python valohai/test_int_none_param.py --test_int_param=1
Output:
usage: test_int_none_param.py [-h] [--test_int_param TEST_INT_PARAM]
test_int_none_param.py: error: argument --test_int_param: invalid NoneType value: '1'Expected behavior:
The script should still run even when the default value is None as long as the parameter type matches the type specified in the step.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels