blob: 1a8ed242080faed42bf28b3bbab3342d941be524 [file] [log] [blame]
:py:mod:`airflow.providers.singularity.operators.singularity`
=============================================================
.. py:module:: airflow.providers.singularity.operators.singularity
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.singularity.operators.singularity.SingularityOperator
.. py:class:: SingularityOperator(*, image, command, start_command = None, environment = None, pull_folder = None, working_dir = None, force_pull = False, volumes = None, options = None, auto_remove = False, **kwargs)
Bases: :py:obj:`airflow.models.BaseOperator`
Execute a command inside a Singularity container
Singularity has more seamless connection to the host than Docker, so
no special binds are needed to ensure binding content in the user $HOME
and temporary directories. If the user needs custom binds, this can
be done with --volumes
:param image: Singularity image or URI from which to create the container.
:param auto_remove: Delete the container when the process exits.
The default is False.
:param command: Command to be run in the container. (templated)
:param start_command: Start command to pass to the container instance.
:param environment: Environment variables to set in the container. (templated)
:param working_dir: Set a working directory for the instance.
:param force_pull: Pull the image on every run. Default is False.
:param volumes: List of volumes to mount into the container, e.g.
``['/host/path:/container/path', '/host/path2:/container/path2']``.
:param options: Other flags (list) to provide to the instance start.
:param working_dir: Working directory to
set on the container (equivalent to the -w switch the docker client).
.. py:attribute:: template_fields
:annotation: :Sequence[str] = ['command', 'environment']
.. py:attribute:: template_ext
:annotation: :Sequence[str] = ['.sh', '.bash']
.. py:attribute:: template_fields_renderers
.. py:method:: execute(self, context)
This is the main method to derive when creating an operator.
Context is the same dictionary used as when rendering jinja templates.
Refer to get_template_context for more context.
.. py:method:: on_kill(self)
Override this method to cleanup subprocesses when a task instance
gets killed. Any use of the threading, subprocess or multiprocessing
module within an operator needs to be cleaned up or it will leave
ghost processes behind.