airflow.hooks.subprocess¶
Module Contents¶
-
class
airflow.hooks.subprocess.SubprocessHook[source]¶ Bases:
airflow.hooks.base.BaseHookHook for running processes with the
subprocessmodule-
run_command(self, command: List[str], env: Optional[Dict[str, str]] = None, output_encoding: str = 'utf-8', cwd: str = None)[source]¶ Execute the command.
If
cwdis None, execute the command in a temporary directory which will be cleaned afterwards. Ifenvis not supplied,os.environis passed- Parameters
command – the command to run
env – Optional dict containing environment variables to be made available to the shell environment in which
commandwill be executed. If omitted,os.environwill be used. Note, that in case you have Sentry configured, original variables from the environment will also be passed to the subprocess withSUBPROCESS_prefix. See Error Tracking for details.output_encoding – encoding to use for decoding stdout
cwd – Working directory to run the command in. If None (default), the command is run in a temporary directory.
- Returns
namedtuplecontainingexit_codeandoutput, the last line from stderr or stdout
-