See comments in code below
def shelljob(
*,
command: str,
name: Optional[str] = None, # <- add this, or `identifier`
arguments: Optional[List[str]] = None,
nodes: Optional[Dict[str, Any]] = None,
filenames: Optional[Dict[str, str]] = None,
outputs: Optional[List[Union[str, Dict[str, Any]]]] = None,
parser: Optional[Callable] = None,
parser_outputs: Optional[SocketSpec | List[str]] = None,
metadata: Optional[Dict[str, Any]] = None,
resolve_command: bool = True,
):
"""Create a ShellJob node in the active WorkGraph and return its outputs handle.
Usage:
with WorkGraph(name="test_shell_date_with_arguments") as wg:
outs = shelljob(command="date", arguments=["--iso-8601"]) # returns handle
wg.run()
"""
spec = _build_shelljob_TaskSpec(
identifier=name, # <- add this, which this function already accepts
outputs=outputs,
parser_outputs=parser_outputs,
)
handle = TaskHandle(spec)
return handle(
command=command,
arguments=arguments,
nodes=nodes,
filenames=filenames,
outputs=outputs,
parser=parser,
metadata=metadata,
resolve_command=resolve_command,
)
See comments in code below