Aller au contenu principal

Script Exec

Category: Data
Node id: script-exec

Executes an inline bash or Python script. Pipeline inputs are available as $HYDRA_INPUTS (JSON), delivered on standard input and set inside the process, never in its exec environment. If stdout is valid JSON it is returned as a structured result; otherwise it is returned as plain text.

What it does​

  • Inline bash and Python script execution
  • Pipeline inputs available as HYDRA_INPUTS (delivered on stdin)
  • JSON stdout auto-parsed to structured result
  • Configurable execution timeout
  • Extra environment variable injection

Use cases​

  • Custom data transformations not covered by built-in nodes
  • Shell commands: file conversion, compression, system calls
  • Python data processing with pandas, numpy, or custom logic
  • Calling CLI tools in a pipeline step

Runtime​

  • Performance tier: variable

Input ports​

NameTypeRequiredDescription
inputanyNoOptional data passed to the script as HYDRA_INPUTS JSON

Output ports​

NameTypeRequiredDescription
resultjsonNoParsed JSON output from stdout (nil if stdout is not JSON)
stdouttextNoRaw standard output
stderrtextNoStandard error output
exit_codejsonNoProcess exit code (0 = success)
successbooleanNoTrue when exit code is 0

Settings​

Basic​

SettingNameTypeRequiredDefaultAllowed valuesDescription
InterpreterinterpreterenumYesbashbash, sh, python3, python
ScriptscripttextYesScript source code. Access pipeline inputs via $HYDRA_INPUTS (bash) or os.environ['HYDRA_INPUTS'] (Python).

Advanced​

SettingNameTypeRequiredDefaultAllowed valuesDescription
Timeout (seconds)timeout_secondsstringNo30Maximum execution time before the script is killed
Extra Environment Variablesenv_varsjsonNoJSON object of additional environment variables to inject

Errors​

CodeDescription
SCRIPT_REQUIREDscript config field is missing or empty
INVALID_INTERPRETERinterpreter is not one of bash, sh, python3, python
SCRIPT_TIMEOUTscript exceeded the configured timeout
EXEC_NOT_FOUNDinterpreter binary is not installed on the host

Runtime notes​

  • Pipeline inputs are available as $HYDRA_INPUTS (bash/sh: an unexported shell variable; export it to hand it to a child) or os.environ['HYDRA_INPUTS'] (Python); they reach the interpreter on stdin, so they are not in /proc/<pid>/environ and have no 128 KiB limit
  • Executor context (__caller__, org_id) is not part of HYDRA_INPUTS
  • If stdout is valid JSON it populates result; otherwise result is nil and stdout has the raw text
  • Scripts run in a temp directory and are deleted after execution
  • Non-zero exit codes set success=false but do not produce an error; check exit_code and stderr

See Build any workflow for how to put nodes together and Ports, types and data flow for how port types connect.

Quelque chose n'est pas clair ? Envoyez vos commentaires sur la documentation par courriel.