Skip to content

Expose node commands at the layer level

Patrick Godwin requested to merge cli_arguments_node into main

This MR defines a new method within Layer, command(), which writes out the command that would be run for a given node. This command takes in a node as well an optional keyword argument, readjust_paths, which controls whether the command is what would be executed on the EP (default) or whether it would be executed on the AP instead. If file transfer is disabled, this option has no effect.

Example:

process_layer = Layer("process_bins", submit_description=requirements)
...    
node = Node(
    arguments=[
        Argument("job-index", 1),
        Option("verbose"),
        Option("bins", [1, 2, 3]),
    ],
    inputs=Option("input", "data.txt"),
    outputs=Argument("output", "output.txt")
)
process_layer.append(node)
...
print(process_layer.command(node))

This should output the following:

process_bins 1 --verbose --bins 1 --bins 2 --bins 3 --input data.txt output.txt

Closes #1 (closed).

Merge request reports