From 2b60de1a00ace10aa5ccae2d860e3259d235545d Mon Sep 17 00:00:00 2001 From: stefanhellander <59477428+stefanhellander@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:43:01 +0100 Subject: [PATCH] Feature/SK-559 | Dispatcher works on Windows (#489) Small change to not attempt to force execution in a unix shell on Windows. --- fedn/fedn/network/clients/client.py | 6 +++--- fedn/fedn/utils/dispatcher.py | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/fedn/fedn/network/clients/client.py b/fedn/fedn/network/clients/client.py index 44b8e8a4e..b45a71c91 100644 --- a/fedn/fedn/network/clients/client.py +++ b/fedn/fedn/network/clients/client.py @@ -750,11 +750,11 @@ def run(self): old_state = self.state while True: time.sleep(1) - cnt += 1 + if cnt == 0: + logger.info("Client is active, waiting for model update requests.") + cnt = 1 if self.state != old_state: logger.info("Client in {} state.".format(ClientStateToString(self.state))) - if cnt > 5: - cnt = 0 if not self._attached: logger.info("Detached from combiner.") # TODO: Implement a check/condition to ulitmately close down if too many reattachment attepts have failed. s diff --git a/fedn/fedn/utils/dispatcher.py b/fedn/fedn/utils/dispatcher.py index 8b80a5e16..c7ace0ab5 100644 --- a/fedn/fedn/utils/dispatcher.py +++ b/fedn/fedn/utils/dispatcher.py @@ -1,3 +1,5 @@ +import os + from fedn.common.log_config import logger from fedn.utils.process import run_process @@ -32,7 +34,10 @@ def run_cmd(self, cmd_type): args = cmdsandargs[1:] # shell (this could be a venv, TODO: parametrize) - shell = ['/bin/sh', '-c'] + if os.name == "nt": + shell = [] + else: + shell = ['/bin/sh', '-c'] # add the corresponding process defined in project.yaml and append arguments from invoked command args = shell + [' '.join(cmd + args)]