Comments (2)
Hello @elliotgunton, thank you for the quick reply. I start to get more visibility on this.
- This was also my outcome, it doesnt seems yet supported under RunnerInput specific context usage.
- Just mixed my explanation. I thought this specific "output=True" would generate an "artifact" under the hood (since it provide a Path i would "write_text" to) without having to explicitly declare it in my "outputs" arguments.
- Awesome
- Oh, make sense now, thanks!
Following my exploration, It seems that the RunnerInput documentation sample is not working out-the-box. I used the documentation example:
class MyInput(RunnerInput):
param_int: Annotated[int, Parameter(name="param-input")] = 42
an_object: Annotated[MyObject, Parameter(name="obj-input")] = MyObject(
a_dict={"my-key": "a-value"}, a_str="hello world!"
)
artifact_int: Annotated[int, Artifact(name="artifact-input", loader=ArtifactLoader.json)]
class MyOutput(RunnerOutput):
param_int: Annotated[int, Parameter(name="param-output")]
artifact_int: Annotated[int, Artifact(name="artifact-output")]
@script(constructor="runner")
def pydantic_io(
my_input: MyInput,
) -> MyOutput:
return MyOutput(exit_code=1, result="Test!", param_int=42, artifact_int=my_input.param_int)
And in my workflow I tried several way to submit the pydantic_io :
t_pydantic = pydantic_io()
Code | Result | Observation |
---|---|---|
pydantic_io() |
inputs.artifacts.artifact-input was not supplied` | Legit, since there isn't default value and we haven't pass any value for artifact_int. But the doc doesnt mention anything about it. |
pydantic_io(arguments=MyInput()) |
ValidationError: 1 validation error for MyInput artifact_int field required (type=value_error.missing) | Similar call, so validation error make sense so far to me |
pydantic_io(arguments=MyInput(artifact_int=0)) |
_Parameter.check_name (parameter.py:29) ValueError: name cannot be None or empty when used |
Expected, arguments is expected a dict of parameters/artifacts |
pydantic_io(arguments={'my_input':MyInput(artifact_int=0)}) |
BadRequest: Server returned status code 400 with message: templates.main.tasks.pydantic-io templates.pydantic-io inputs.artifacts.artifact-input was not supplied |
I was hoping this one to work |
args=MyInput(param_input=0, artifact_int=0) pydantic_io(arguments=args._get_parameters()) |
templates.main.tasks.pydantic-io.arguments.param-input.value is required |
Lost on this one, param-input is supposed to have default value already set, but i guess i am calling it wrongly |
- Is there a working way to pass the missing value artifact_int ?
- What is the conventional way to "overwrite" a specific parameter (such as "my_object") ?
Thank you
from hera.
Hi @sam2x - thank you for the feedback on this new feature! I will answer your questions numbered 1-4:
- Currently, the use of
output=True
is not explicitly supported by theRunnerInput
class (and I haven't tested it). You would need to workaround Pydantic's validation by setting a default value. I think it might work this way, but no guarantees!
class MyDefaultInput (RunnerInput):
stdout: Annotated[Path, Parameter(global_name="stdout", name="stdout", output=True)] = Path("/tmp/stdout.txt")
- I think the answer is "no" but I'm not exactly clear on what you're asking - "If i use an artifact declaration in the function signature" vs "here I declare it as "Parameter" - you can only declare it as one or the other? Hera does different things for you automatically based on the type of function parameter, so you would have to use
S3Artifact
to "be recorded automatically". - Yes that should work - I can add a test to confirm it
- The
result
is meant to emulate the script result (see docs) - to allow steps/dags to use the syntax of{{steps.my-step.outputs.result}}
from hera.
Related Issues (20)
- Create a hera mypy plugin HOT 1
- Error messages improvement
- Arguments mapping is very verbose depending on use case HOT 2
- 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/Output feedback/issues HOT 2
- Docs feedback
- Remove Python 3.8 support HOT 3
- Reusable "mock" task/step HOT 2
- Hera runner debug log mode
- Example "user_container.py" doesn't work
- Incorrect linting for DAG/Steps input list HOT 1
- Pydantic should default to v2, or hera should allow it to be configured HOT 6
- Add a local runner for better testing and local development HOT 1
- Upgrade Argo >= 3.5 HOT 3
- Workflow parameter interpolation issue in WorkflowTemplates HOT 4
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.