Replies: 3 comments 4 replies
-
I have dig a bit into this. Apparently Hera doesn't support "nested" object (or more precisely List of Input). That would be a game changer to me and all if Hera would let me build dynamically "Parameter/Artifact". In my case, I don't know in advance how many "Input" are provided. Using "List" of Input approach bring a lot of advantage/use-case (intersection/processing of data result coming from an unknown number of task, but also inscreasing performance). The relevant code is located in "/src/hera/workflows/script.py", in the function _get_inputs_from_callable:
The key point (that was already mentioned by @elliotgunton on my last issue) make sense. "Input" itself is not mapped, but the attributes having Input subclass are. I understand why my attempts fail. Would you consider adapting the logic to the following approach?
I believe no change would be required later on, since Parameter/Artifacts have been standardized in specific inputs arrays, so the routine should detect any missing ones from user side. So, this would cover the following case:
What do you think ? I may help on this. Br, |
Beta Was this translation helpful? Give feedback.
-
Hey, Providing an update after analyzing in details the code. Currently, not only the previous function needs to be modified, but either an array-capabilities would be used or a naming convention would be defined to avoid conflict since all parameters are mapped into the callable function. So, this is more tricky than expected and require more important change, i discontinued this approach. Therefore, and until more features gets included along Hera versions, I use an alternative solution: using a temporaring shared storage for each tasks(item of my list), and then passing a list of related ID pointing to those filename for my merge. More safe and conflict-proof, since I can call multiple same tasks dynamically and just pass the generated id to my aggregating task. Br, |
Beta Was this translation helpful? Give feedback.
-
Can you give a bit more information about your exact use-case? For instance, do you know at the time you're creating your workflow how many parameters/artifacts you have, and you just want a script function that can take a varying number of inputs for reusability/readability? Or do you only discover the number of artifacts as part of running the workflow? Perhaps you could give a complete skeleton workflow that roughly matches your goal? |
Beta Was this translation helpful? Give feedback.
-
What is the best way to pass list of "Input" arguments (some fields of my Input class are Artifact) ?
I have the following case:
I can't play with kargs (due to inherent hera script arguments logics) or multiple arguments (would raise error since i can pass only one argument with Script-runner feature):
Example when I try this:
When I try to pass this list inside arguments of the task, I have correctly the "some_struct" accessible, however "data" Artifact Object contains the "full" attribute Hera Artifact class instead of the loaded artifact, so it s not "transposed/interpreted" correctly by Hera stub when compiled.
I was expecting it to link and load the TaskX artifact.
Any pointers please ?
Thank you,
Sam
Beta Was this translation helpful? Give feedback.
All reactions