mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
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:
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user