Module Contents

class airflow.hooks.subprocess.SubprocessHook[source]

Bases: airflow.hooks.base.BaseHook

Hook for running processes with the subprocess module

run_command(self, command: List[str], env: Optional[Dict[str, str]] = None, output_encoding: str = 'utf-8')[source]

Execute the command in a temporary directory which will be cleaned afterwards

If env is not supplied, os.environ is passed

  • command -- the command to run

  • env -- Optional dict containing environment variables to be made available to the shell environment in which command will be executed. If omitted, os.environ will be used.

  • output_encoding -- encoding to use for decoding stdout


namedtuple containing exit_code and output, the last line from stderr or stdout


Sends SIGTERM signal to self.sub_process if one exists.

Was this entry helpful?