From 35e6dd7a52fa6162d1daaae52ce27b7c0d200a0c Mon Sep 17 00:00:00 2001 From: nadgowdas Date: Tue, 13 Feb 2018 15:13:23 -0500 Subject: [PATCH] disabling docker events (#359) * disabling docker events Signed-off-by: Shripad Nadgowda * disabling docker events Signed-off-by: Shripad Nadgowda * disabling docker events Signed-off-by: Shripad Nadgowda * disabling docker events Signed-off-by: Shripad Nadgowda --- crawler/dockercontainer.py | 23 +++++++++++-------- .../test_functional_dockerevents.py | 6 ++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/crawler/dockercontainer.py b/crawler/dockercontainer.py index 7f9c8eed..a874e8e4 100644 --- a/crawler/dockercontainer.py +++ b/crawler/dockercontainer.py @@ -6,6 +6,7 @@ import logging import os import shutil +import time from requests.exceptions import HTTPError @@ -21,8 +22,7 @@ from utils.dockerutils import (exec_dockerps, get_docker_container_json_logs_path, get_docker_container_rootfs_path, - exec_dockerinspect, - poll_container_create_events) + exec_dockerinspect) try: basestring # Python 2 @@ -83,14 +83,17 @@ def poll_docker_containers(timeout, user_list=None, host_namespace=''): return None try: - cEvent = poll_container_create_events(timeout) - - if not cEvent: - return None - c = DockerContainer(cEvent.get_containerid(), inspect=None, - host_namespace=host_namespace) - if c.namespace: - return c + # We are currently throttling docker events + # so instead of polling we will just sleep for timeout interval + time.sleep(timeout) + # cEvent = poll_container_create_events(timeout) + + # if not cEvent: + # return None + # c = DockerContainer(cEvent.get_containerid(), inspect=None, + # host_namespace=host_namespace) + # if c.namespace: + # return c except ContainerInvalidEnvironment as e: logger.exception(e) diff --git a/tests/functional/test_functional_dockerevents.py b/tests/functional/test_functional_dockerevents.py index aa320c8a..f837e0d8 100644 --- a/tests/functional/test_functional_dockerevents.py +++ b/tests/functional/test_functional_dockerevents.py @@ -71,7 +71,7 @@ def __exec_kill_crawlers(self): In this case, crawler would miss the create event, but it should be able to discover already running containers and snapshot them ''' - def testCrawlContainer0(self): + def _noexec_testCrawlContainer0(self): env = os.environ.copy() mypath = os.path.dirname(os.path.realpath(__file__)) os.makedirs(self.tempd + '/out') @@ -114,7 +114,7 @@ def testCrawlContainer0(self): crawler should get intrupptted and start snapshotting container immediately. ''' - def testCrawlContainer1(self): + def _noexec_testCrawlContainer1(self): env = os.environ.copy() mypath = os.path.dirname(os.path.realpath(__file__)) os.makedirs(self.tempd + '/out') @@ -169,7 +169,7 @@ def testCrawlContainer1(self): And then we will wait for crawler's next iteration to ensure, w/o docker event, crawler will timeout and snapshot container periodically ''' - def testCrawlContainer2(self): + def _noexec_testCrawlContainer2(self): env = os.environ.copy() mypath = os.path.dirname(os.path.realpath(__file__)) os.makedirs(self.tempd + '/out')