blob: b6fed8b6255344167c936b7783442421b07a1e0f [file] [log] [blame]
:mod:`airflow.operators.bash_operator`
======================================
.. py:module:: airflow.operators.bash_operator
Module Contents
---------------
.. py:class:: BashOperator(bash_command, xcom_push=False, env=None, output_encoding='utf-8', *args, **kwargs)
Bases: :class:`airflow.models.BaseOperator`
Execute a Bash script, command or set of commands.
.. seealso::
For more information on how to use this operator, take a look at the guide:
:ref:`howto/operator:BashOperator`
:param bash_command: The command, set of commands or reference to a
bash script (must be '.sh') to be executed. (templated)
:type bash_command: str
:param xcom_push: If xcom_push is True, the last line written to stdout
will also be pushed to an XCom when the bash command completes.
:type xcom_push: bool
:param env: If env is not None, it must be a mapping that defines the
environment variables for the new process; these are used instead
of inheriting the current process environment, which is the default
behavior. (templated)
:type env: dict
:param output_encoding: Output encoding of bash command
:type output_encoding: str
.. attribute:: template_fields
:annotation: = ['bash_command', 'env']
.. attribute:: template_ext
:annotation: = ['.sh', '.bash']
.. attribute:: ui_color
:annotation: = #f0ede4
.. method:: execute(self, context)
Execute the bash command in a temporary directory
which will be cleaned afterwards
.. method:: on_kill(self)