From 4588ad184c4464560c1d5c9b2f5d03da41b2eebb Mon Sep 17 00:00:00 2001 From: Paul Cuzner Date: Wed, 23 Dec 2020 17:04:50 +1300 Subject: [PATCH] mgr/orchestrator: rebase patch Signed-off-by: Paul Cuzner --- src/pybind/mgr/cephadm/module.py | 6 ++++++ src/pybind/mgr/orchestrator/_interface.py | 6 ++++++ src/pybind/mgr/orchestrator/module.py | 14 +++++++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index a6ffdb4a037..afd0292c45d 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -529,6 +529,12 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule, # start the process self._kick_serve_loop() + def is_paused(self) -> bool: + return self.paused + + def worker_pool_size(self) -> int: + return self._worker_pool._processes # type: ignore + def pause(self) -> None: if not self.paused: self.log.info('Paused') diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 6034e219daf..b7444c04aaa 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -786,6 +786,12 @@ class Orchestrator(object): def resume(self) -> None: raise NotImplementedError() + def is_paused(self) -> bool: + raise NotImplementedError() + + def worker_pool_size(self) -> int: + raise NotImplementedError() + def add_host(self, host_spec: HostSpec) -> Completion[str]: """ Add a host to the orchestrator inventory. diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 534da49bde4..c33d00a3a57 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1351,8 +1351,17 @@ Usage: avail, why = self.available() result: Dict[str, Any] = { - "backend": o + "backend": o, + "paused": self.is_paused(), } + + try: + num_workers = self.worker_pool_size() + except NotImplementedError: + pass + else: + result['workers'] = num_workers + if avail is not None: result['available'] = avail if not avail: @@ -1366,6 +1375,9 @@ Usage: output += "\nAvailable: {0}".format(result['available']) if 'reason' in result: output += ' ({0})'.format(result['reason']) + output += f"\nPaused: {'Yes' if result['paused'] else 'No'}" + if 'workers' in result: + output += f"\nHost Parallelism: {result['workers']}" return HandleCommandResult(stdout=output) def self_test(self) -> None: -- 2.47.3