diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 169c97f..55e97aa 100755 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.1 +current_version = 0.1.2 commit = False message = service version: {current_version} → {new_version} tag = False diff --git a/.osparc/osparc-meta-parallelrunner/metadata.yml b/.osparc/osparc-meta-parallelrunner/metadata.yml index 44f2347..56030cb 100755 --- a/.osparc/osparc-meta-parallelrunner/metadata.yml +++ b/.osparc/osparc-meta-parallelrunner/metadata.yml @@ -1,7 +1,7 @@ name: Parallel Runner description: "ParallelRunnerService" key: simcore/services/dynamic/osparc-meta-parallelrunner -version: 0.1.1 +version: 0.1.2 integration-version: 2.0.0 type: dynamic authors: diff --git a/Makefile b/Makefile index 0fc5911..0a56e5f 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SHELL = /bin/sh MAKEFLAGS += -j2 export DOCKER_IMAGE_NAME ?= osparc-meta-parallelrunner -export DOCKER_IMAGE_TAG ?= 0.1.1 +export DOCKER_IMAGE_TAG ?= 0.1.2 export MASTER_AWS_REGISTRY ?= registry.osparc-master-zmt.click export MASTER_REGISTRY ?= registry.osparc-master.speag.com diff --git a/docker-compose-local.yml b/docker-compose-local.yml index 8418fa0..6e5610d 100755 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -1,7 +1,7 @@ version: '3.7' services: osparc-meta-parallelrunner: - image: simcore/services/dynamic/osparc-meta-parallelrunner:0.1.1 + image: simcore/services/dynamic/osparc-meta-parallelrunner:0.1.2 ports: - "8888:8888" environment: diff --git a/docker_scripts/main.py b/docker_scripts/main.py index 78e0604..d3e1a86 100755 --- a/docker_scripts/main.py +++ b/docker_scripts/main.py @@ -26,16 +26,6 @@ def main(): settings = MainSettings() config_path = settings.input_path / INPUT_CONF_KEY / "parallelrunner.json" - waiter = 0 - while not config_path.exists(): - if waiter % 10 == 0: - logger.info("Waiting for parallelrunner.json to exist ...") - time.sleep(settings.file_polling_interval) - waiter += 1 - - settings = settings.parse_file(config_path) - logging.info(f"Received the following settings: {settings}") - http_dir_path = pl.Path(__file__).parent / "http" class HTTPHandler(http.server.SimpleHTTPRequestHandler): @@ -44,18 +34,32 @@ def __init__(self, *args, **kwargs): *args, **kwargs, directory=http_dir_path.resolve() ) - maprunner = parallelrunner.ParallelRunner(**settings.dict()) - try: logger.info( f"Starting http server at port {HTTP_PORT} and serving path {http_dir_path}" ) with socketserver.TCPServer(("", HTTP_PORT), HTTPHandler) as httpd: + # First start the empty web server httpd_thread = threading.Thread(target=httpd.serve_forever) httpd_thread.start() + + # Now start the real parallel runner + waiter = 0 + while not config_path.exists(): + if waiter % 10 == 0: + logger.info("Waiting for parallelrunner.json to exist ...") + time.sleep(settings.file_polling_interval) + waiter += 1 + + settings = settings.parse_file(config_path) + logging.info(f"Received the following settings: {settings}") + + maprunner = parallelrunner.ParallelRunner(**settings.dict()) + maprunner.setup() maprunner.start() maprunner.teardown() + httpd.shutdown() except Exception as err: # pylint: disable=broad-except logger.error(f"{err} . Stopping %s", exc_info=True)