| :py:mod:`airflow.hooks.subprocess` |
| ================================== |
| |
| .. py:module:: airflow.hooks.subprocess |
| |
| |
| Module Contents |
| --------------- |
| |
| Classes |
| ~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.hooks.subprocess.SubprocessHook |
| |
| |
| |
| |
| Attributes |
| ~~~~~~~~~~ |
| |
| .. autoapisummary:: |
| |
| airflow.hooks.subprocess.SubprocessResult |
| |
| |
| .. py:data:: SubprocessResult |
| |
| |
| |
| |
| .. py:class:: SubprocessHook |
| |
| Bases: :py:obj:`airflow.hooks.base.BaseHook` |
| |
| Hook for running processes with the ``subprocess`` module |
| |
| .. py:method:: run_command(self, command: List[str], env: Optional[Dict[str, str]] = None, output_encoding: str = 'utf-8', cwd: str = None) -> SubprocessResult |
| |
| Execute the command. |
| |
| If ``cwd`` is None, execute the command in a temporary directory which will be cleaned afterwards. |
| If ``env`` is not supplied, ``os.environ`` is passed |
| |
| :param command: the command to run |
| :param 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. |
| Note, that in case you have Sentry configured, original variables from the environment |
| will also be passed to the subprocess with ``SUBPROCESS_`` prefix. See |
| :doc:`/logging-monitoring/errors` for details. |
| :param output_encoding: encoding to use for decoding stdout |
| :param cwd: Working directory to run the command in. |
| If None (default), the command is run in a temporary directory. |
| :return: :class:`namedtuple` containing ``exit_code`` and ``output``, the last line from stderr |
| or stdout |
| |
| |
| .. py:method:: send_sigterm(self) |
| |
| Sends SIGTERM signal to ``self.sub_process`` if one exists. |
| |
| |
| |