Comments (1)
We can show the problem with this workflow. The CustomScriptConstructor
just wraps the runner script constructor to print the incoming kwargs list for sanity checks (i.e. it does receive a json str)
import json
from typing import Annotated
from hera.workflows import Parameter, Steps, WorkflowTemplate, script
from testrunnerloading.custom_runner import CustomScriptConstructor
@script(constructor=CustomScriptConstructor())
def take_json_str(my_json: Annotated[str, Parameter(name="my-json")]):
"""Take a json string, load it and print it."""
print(json.loads(my_json))
def get_workflow_template() -> WorkflowTemplate:
"""Create and return the test-runner-loading WorkflowTemplate."""
with WorkflowTemplate(
name="mlplatform.test-runner-loading",
entrypoint="steps",
) as wt:
with Steps(name="steps"):
take_json_str(arguments={"my_json": json.dumps({"key": "value"})})
Which gets an error like:
source contents: [{"name":"my_json","value":"{\"key\": \"value\"}"}]
kwargs_list: [{'name': 'my_json', 'value': '{"key": "value"}'}]
calling function
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/workspace/testrunnerloading/custom_runner.py", line 350, in <module>
_run()
File "/workspace/testrunnerloading/custom_runner.py", line 343, in _run
result = _runner(args.entrypoint, kwargs_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/testrunnerloading/custom_runner.py", line 315, in _runner
return function(**kwargs)
^^^^^^^^^^^^^^^^^^
File "/workspace/testrunnerloading/custom_runner.py", line 58, in inner
return f(**filtered_kwargs)
^^^^^^^^^^^^^^^^^^^^
File "pydantic/decorator.py", line 40, in pydantic.decorator.validate_arguments.validate.wrapper_function
File "pydantic/decorator.py", line 133, in pydantic.decorator.ValidatedFunction.call
File "pydantic/decorator.py", line 130, in pydantic.decorator.ValidatedFunction.init_model_instance
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for TakeJsonStr
my_json
str type expected (type=type_error.str)
time="2023-11-09T11:53:38 UTC" level=info msg="sub-process exited" argo=true error="<nil>"
Error: exit status 1
from hera.
Related Issues (20)
- Lifecycle Hooks arguments and support for Steps / DAGs HOT 1
- HTTPGetAction "port: int" will output as string in yaml HOT 1
- get_workflow_link() doesn't form perfect URLs when workflows is running with BASE_HREF HOT 3
- Upgrading to 5.10 causes validation error HOT 6
- parameter output regression HOT 1
- Improve example directory structure to accommodate complex "mini projects" HOT 4
- Container ImagePullPolicy builds an incompatible type HOT 2
- On-cluster testing improvements
- Support loaders for script Parameters HOT 1
- make test is broken with cappa dependency HOT 1
- Create a hera mypy plugin HOT 1
- Error messages improvement
- Arguments mapping is very verbose depending on use case
- Remove the need to write `.value` on `Parameter`s passed to `arguments` HOT 1
- How to set a workflow parameters default value HOT 1
- VolumeMounts for sidecars disappear
- Robust validation for k8s resource requirements
- Save dummy outputs when runner script raises an exception HOT 1
- RunnerInput: Got 400 from Argo, a value was not supplied in the parameter HOT 2
- RunnerInput/Output feedback/issues HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hera.