Permalink
Browse files

Merge branch 'master' into byor

  • Loading branch information...
2 parents 183c60f + 4b874f2 commit d579b5f783f20c5c8fbf9f47dcbfad6d21c37136 @anaderi anaderi committed on GitHub Jun 30, 2017
Showing with 8 additions and 3 deletions.
  1. +3 −1 everware/spawner.py
  2. +5 −2 everware/stats_handler.py
View
@@ -45,7 +45,6 @@ def __init__(self, **kwargs):
ContainerHandler.__init__(self, **kwargs) ContainerHandler.__init__(self, **kwargs)
EmailNotificator.__init__(self) EmailNotificator.__init__(self)
-
# We override the executor here to increase the number of threads # We override the executor here to increase the number of threads
@property @property
def executor(self): def executor(self):
@@ -55,6 +54,9 @@ def executor(self):
cls._executor = ThreadPoolExecutor(20) cls._executor = ThreadPoolExecutor(20)
return cls._executor return cls._executor
+ @staticmethod
+ def get_global_client():
+ return CustomDockerSpawner._client
def _docker(self, method, *args, **kwargs): def _docker(self, method, *args, **kwargs):
"""wrapper for calling docker methods """wrapper for calling docker methods
@@ -38,5 +38,8 @@ def get(self, *args, **kwargs):
@gen.coroutine @gen.coroutine
def get_running_container_count(self): def get_running_container_count(self):
"""Get the number of currently running containers.""" """Get the number of currently running containers."""
- return len(Client().containers( + client = self.spawner_class.get_global_client()
- filters={'status': self.container_statuses['running']})) + if client is None:
+ # None means that there were no launches
+ return 0
+ return len(client.containers(filters={'status': self.container_statuses['running']}))

0 comments on commit d579b5f

Please sign in to comment.