Permalink
Browse files
Merge branch 'master' into byor
- Loading branch information...
Showing
with
8 additions
and
3 deletions.
-
+3
−1
everware/spawner.py
-
+5
−2
everware/stats_handler.py
|
|
@@ -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