airflow.providers.singularity.operators.singularity¶
类¶
在 Singularity 容器内执行命令。 |
模块内容¶
- class airflow.providers.singularity.operators.singularity.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)[source]¶
基类:
airflow.models.BaseOperator
在 Singularity 容器内执行命令。
与 Docker 相比,Singularity 与主机的连接更无缝,因此无需特殊绑定即可确保在用户 $HOME 和临时目录中绑定内容。如果用户需要自定义绑定,可以通过 –volumes 实现。
- 参数:
image (str) – 用于创建容器的 Singularity 镜像或 URI。
auto_remove (bool | None) – 进程退出时删除容器。默认值为 False。
working_dir (str | None) – 为实例设置工作目录。
force_pull (bool | None) – 每次运行时都拉取镜像。默认值为 False。
volumes (list[str] | None) – 要挂载到容器中的卷列表,例如
['/host/path:/container/path', '/host/path2:/container/path2']
。working_dir – 在容器上设置的工作目录(相当于 docker 客户端的 -w 开关)。
- template_fields: collections.abc.Sequence[str] = ('command', 'environment')[source]¶
- template_ext: collections.abc.Sequence[str] = ('.sh', '.bash')[source]¶