pypeline: allow arbitrary config objects

Allow the `configuration` field of a pipe in a pipeline yaml file to be
of any type. When constructing the pipe object, the object will be
re-serialized via `yaml.dump` before being passed to the constructor.
This commit is contained in:
Giacomo Vercesi
2025-10-20 18:03:34 +02:00
parent c0e35d080e
commit d42cd5aeab
2 changed files with 14 additions and 6 deletions
+9 -2
View File
@@ -55,9 +55,16 @@ def parse_pipe(
)
bindings.append(container_decls[arg])
configuration = task.get("configuration", "")
configuration = task.get("configuration")
if configuration is None:
configuration_string = ""
elif isinstance(configuration, str):
configuration_string = configuration
else:
configuration_string = yaml.safe_dump(configuration)
return PipelineNode(
task=pipe_type(configuration),
task=pipe_type(configuration_string),
bindings=bindings,
)
+5 -4
View File
@@ -76,10 +76,11 @@ $defs:
description: The name of the pipe.
example: my_pipe
configuration:
type: string
description: The static configuration for the pipe, if any.
default: ""
example: intel_asm=1
type: [string, object]
description: |
The static configuration for the pipe, if any. Can be either a string
or an object. If an object the content will be re-serialized in YAML
and passed to the pipe constructor as a string.
arguments:
$ref: "#/$defs/args"
description: The names of the containers to pass to the pipe.