[ARVADOS] updated: 9b48b17eddea5e366e0c59ed9f3540793550256c

git at public.curoverse.com git at public.curoverse.com
Mon Nov 2 15:53:06 EST 2015


Summary of changes:
 services/dockercleaner/arvados_docker/cleaner.py | 11 +++++------
 services/dockercleaner/tests/test_cleaner.py     |  2 +-
 2 files changed, 6 insertions(+), 7 deletions(-)

       via  9b48b17eddea5e366e0c59ed9f3540793550256c (commit)
      from  82b7adbaf524d6e7fd2b9a6403f9e490dcb3ac85 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 9b48b17eddea5e366e0c59ed9f3540793550256c
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon Nov 2 15:53:05 2015 -0500

    7444: Rename kwarg remove_stopped_containers -> remove_containers_onexit

diff --git a/services/dockercleaner/arvados_docker/cleaner.py b/services/dockercleaner/arvados_docker/cleaner.py
index f9d727f..2435e6d 100755
--- a/services/dockercleaner/arvados_docker/cleaner.py
+++ b/services/dockercleaner/arvados_docker/cleaner.py
@@ -177,10 +177,10 @@ class DockerImageUseRecorder(DockerEventListener):
 class DockerImageCleaner(DockerImageUseRecorder):
     event_handlers = DockerImageUseRecorder.event_handlers.copy()
 
-    def __init__(self, images, docker_client, events, remove_stopped_containers=False):
+    def __init__(self, images, docker_client, events, remove_containers_onexit=False):
         super().__init__(images, docker_client, events)
         self.logged_unknown = set()
-        self.remove_stopped_containers = remove_stopped_containers
+        self.remove_containers_onexit = remove_containers_onexit
 
     def new_container(self, event, container_hash):
         container_image_id = container_hash['Image']
@@ -199,9 +199,8 @@ class DockerImageCleaner(DockerImageUseRecorder):
 
     @event_handlers.on('die')
     def clean_container(self, event=None):
-        if not self.remove_stopped_containers:
-            return
-        self._remove_container(event['id'])
+        if self.remove_containers_onexit:
+            self._remove_container(event['id'])
 
     def check_stopped_containers(self, remove=False):
         logger.info("Checking for stopped containers")
@@ -278,7 +277,7 @@ def run(args, docker_client):
     use_recorder.run()
     cleaner = DockerImageCleaner(
         images, docker_client, docker_client.events(since=start_time),
-        remove_stopped_containers=args.remove_stopped_containers != 'never')
+        remove_containers_onexit=args.remove_stopped_containers != 'never')
     cleaner.check_stopped_containers(
         remove=args.remove_stopped_containers == 'always')
     logger.info("Checking image quota at startup")
diff --git a/services/dockercleaner/tests/test_cleaner.py b/services/dockercleaner/tests/test_cleaner.py
index a9ecc92..43abe4f 100644
--- a/services/dockercleaner/tests/test_cleaner.py
+++ b/services/dockercleaner/tests/test_cleaner.py
@@ -313,7 +313,7 @@ class DockerImageCleanerTestCase(DockerImageUseRecorderTestCase):
 
 class DockerContainerCleanerTestCase(DockerImageUseRecorderTestCase):
     TEST_CLASS = cleaner.DockerImageCleaner
-    TEST_CLASS_INIT_KWARGS = {'remove_stopped_containers': True}
+    TEST_CLASS_INIT_KWARGS = {'remove_containers_onexit': True}
 
     @mock.patch('arvados_docker.cleaner.logger')
     def test_failed_container_deletion_handling(self, mockLogger):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list