airflow.providers.singularity.operators.singularity

Module Contents

class airflow.providers.singularity.operators.singularity.SingularityOperator(*, image: str, command: Union[str, ast.AST], start_command: Optional[Union[str, List[str]]] = None, environment: Optional[Dict[str, Any]] = None, pull_folder: Optional[str] = None, working_dir: Optional[str] = None, force_pull: Optional[bool] = False, volumes: Optional[List[str]] = None, options: Optional[List[str]] = None, auto_remove: Optional[bool] = False, **kwargs)[source]

Bases: 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

Parameters
  • image (str) -- Singularity image or URI from which to create the container.

  • auto_remove (bool) -- Delete the container when the process exits. The default is False.

  • command (str or list) -- Command to be run in the container. (templated)

  • start_command (str or list) -- Start command to pass to the container instance.

  • environment (dict) -- Environment variables to set in the container. (templated)

  • working_dir (str) -- Set a working directory for the instance.

  • force_pull (bool) -- Pull the image on every run. Default is False.

  • volumes (Optional[List[str]]) -- List of volumes to mount into the container, e.g. ['/host/path:/container/path', '/host/path2:/container/path2'].

  • options (list) -- Other flags (list) to provide to the instance start.

  • working_dir -- Working directory to set on the container (equivalent to the -w switch the docker client).

template_fields = ['command', 'environment'][source]
template_ext = ['.sh', '.bash'][source]
template_fields_renderers[source]
execute(self, context)[source]
on_kill(self)[source]

Was this entry helpful?