2026-06-22 15:15:58 +08:00

23 lines
599 B
Python

from __future__ import annotations
from typing import Any, Callable
HelperMap = dict[str, Callable[..., Any]]
def run(
run_id: str,
node_id: str,
output_dir: Any,
node_data: dict[str, Any],
inputs: list[dict[str, Any]],
helpers: HelperMap,
) -> list[dict[str, Any]]:
del inputs
params = helpers["hyperparams"](node_data)
command = params.get("COMMAND") or params.get("SCRIPT")
if not command:
raise RuntimeError("Shell 命令执行需要 COMMAND 或 SCRIPT")
return helpers["execute_command"](run_id, node_id, output_dir, node_data, command)