@@ -60,9 +60,11 @@ class DockerSwarmOperator(DockerOperator):
60
60
If image tag is omitted, "latest" will be used.
61
61
:param api_version: Remote API version. Set to ``auto`` to automatically
62
62
detect the server's version.
63
- :param auto_remove: Auto-removal of the container on daemon side when the
64
- container's process exits.
65
- The default is False.
63
+ :param auto_remove: Enable removal of the service when the service has terminated. Possible values:
64
+
65
+ - ``never``: (default) do not remove service
66
+ - ``success``: remove on success
67
+ - ``force``: always remove service
66
68
:param command: Command to be run in the container. (templated)
67
69
:param args: Arguments to the command.
68
70
:param docker_url: URL of the host running the docker daemon.
@@ -221,12 +223,12 @@ def _run_service(self) -> None:
221
223
if self .retrieve_output :
222
224
return self ._attempt_to_retrieve_results ()
223
225
224
- self .log .info ("auto_removeauto_removeauto_removeauto_removeauto_remove : %s" , str (self .auto_remove ))
226
+ self .log .info ("auto_remove : %s" , str (self .auto_remove ))
225
227
if self .service and self ._service_status () != "complete" :
226
- if self .auto_remove == "success " :
228
+ if self .auto_remove == "force " :
227
229
self .cli .remove_service (self .service ["ID" ])
228
230
raise AirflowException (f"Service did not complete: { self .service !r} " )
229
- elif self .auto_remove == "success" :
231
+ elif self .auto_remove in [ "success" , "force" ] :
230
232
if not self .service :
231
233
raise RuntimeError ("The 'service' should be initialized before!" )
232
234
self .cli .remove_service (self .service ["ID" ])
0 commit comments