zenml icon indicating copy to clipboard operation
zenml copied to clipboard

Cannot pass a list as a parameter to a step

Open Mathis-Z opened this issue 9 months ago • 5 comments

I would like to run some jobs that return a string each. Then I want to pass these as a list to another step. This does not work though because the list is reportedly not JSON-serializable. The problem is that validate_input in zenml.steps.entrypoint_function_utils exits early if the passed parameter is a StepArtifact but when a list of StepArtifact is passed, the function does not exit early. The same goes for other collections.

Mathis-Z avatar Mar 12 '25 17:03 Mathis-Z

The underlying problem is not the input validation but rather that passing collections of artifacts (=outputs of other steps) is currently not supported. It's on our list of todos in the near future though.

schustmi avatar Mar 12 '25 17:03 schustmi

Ok, that is unfortunate. Is there some kind of workaround available?

Mathis-Z avatar Mar 15 '25 19:03 Mathis-Z

@Mathis-Z You can use the pattern described here - its in our near future too improve this but in the meanwhile this should suffice for many use-cases: https://docs.zenml.io/how-to/pipeline-development/build-pipelines/fan-in-fan-out

htahir1 avatar Mar 17 '25 19:03 htahir1

why don't you use zenml.io.Serializable to wrap custom types

satya23web avatar Jun 14 '25 06:06 satya23web

why don't you use zenml.io.Serializable to wrap custom types

Because it doesn't exist?

schustmi avatar Jun 14 '25 07:06 schustmi