diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d58bda1..23f69f5 100755 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.2.1 +current_version = 0.2.2 commit = False message = service version: {current_version} → {new_version} tag = False diff --git a/.osparc/osparc-meta-dakota/metadata.yml b/.osparc/osparc-meta-dakota/metadata.yml index 9f5ef30..c357bf7 100755 --- a/.osparc/osparc-meta-dakota/metadata.yml +++ b/.osparc/osparc-meta-dakota/metadata.yml @@ -1,8 +1,8 @@ name: DakotaService description: "DakotaServiceService" key: simcore/services/dynamic/osparc-meta-dakota -version: 0.2.1 -integration-version: 0.2.1 +version: 0.2.2 +integration-version: 0.2.2 type: dynamic authors: - name: Werner Van Geit diff --git a/Makefile b/Makefile index 5777868..b21a237 100755 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SHELL = /bin/sh MAKEFLAGS += -j3 export DOCKER_IMAGE_NAME ?= osparc-meta-dakota -export DOCKER_IMAGE_TAG ?= 0.2.1 +export DOCKER_IMAGE_TAG ?= 0.2.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 2f4c9cf..9219baa 100755 --- a/docker-compose-local.yml +++ b/docker-compose-local.yml @@ -1,6 +1,6 @@ services: osparc-meta-dakota: - image: simcore/services/dynamic/osparc-meta-dakota:0.2.1 + image: simcore/services/dynamic/osparc-meta-dakota:0.2.2 ports: - "8888:8888" environment: diff --git a/docker_scripts/main.py b/docker_scripts/main.py index bcadf9b..0f84e24 100755 --- a/docker_scripts/main.py +++ b/docker_scripts/main.py @@ -3,9 +3,9 @@ import pydantic as pyda import pydantic_settings +from osparc_filecomms import tools import dakota_start -import tools logging.basicConfig( level=logging.INFO, format="[%(filename)s:%(lineno)d] %(message)s" @@ -16,7 +16,7 @@ CONF_SCHEMA_KEY = "conf_json_schema" DEFAULT_FILE_POLLING_INTERVAL = 0.1 -RESTART_ON_ERROR_MAX_TIME = 10.0 +RESTART_ON_ERROR_MAX_TIME = 3600.0 RESTART_ON_ERROR_POLLING_INTERVAL = 1.0 @@ -36,6 +36,7 @@ def main(): dakservice = dakota_start.DakotaService(settings) dakservice.start() + class DakotaDynamicSettings: def __init__(self): self._settings = self.DakotaMainSettings() @@ -80,9 +81,7 @@ class DakotaMainSettings(pydantic_settings.BaseSettings): output_path: pyda.DirectoryPath = pyda.Field( alias="DY_SIDECAR_PATH_OUTPUTS" ) - restart_on_error: bool = pyda.Field( - default=False - ) + restart_on_error: bool = pyda.Field(default=False) restart_on_error_max_time: float = pyda.Field( default=RESTART_ON_ERROR_MAX_TIME, ge=0 ) diff --git a/docker_scripts/tools.py b/docker_scripts/tools.py deleted file mode 100755 index 00b9a67..0000000 --- a/docker_scripts/tools.py +++ /dev/null @@ -1,70 +0,0 @@ -import json -import logging -import pathlib as pl -import time - -from watchdog.events import FileSystemEventHandler -from watchdog.observers import Observer - -DEFAULT_FILE_POLLING_INTERVAL = 5 - -logging.basicConfig( - level=logging.INFO, format="[%(filename)s:%(lineno)d] %(message)s" -) -logger = logging.getLogger(__name__) - - -def wait_for_path(file_path): - path = pl.Path(file_path).resolve() - if path.exists(): - return str(path) - - # Find the closest existing parent directory - watch_dir = path - while not watch_dir.exists(): - watch_dir = watch_dir.parent - - class Handler(FileSystemEventHandler): - def __init__(self): - self.created = False - - def on_created(self, event): - nonlocal path - created_path = pl.Path(event.src_path).resolve() - if created_path == path: - self.created = True - elif path.is_relative_to(created_path): - # Update path if a parent directory was created - path = created_path / path.relative_to(created_path) - - handler = Handler() - observer = Observer() - observer.schedule(handler, str(watch_dir), recursive=True) - observer.start() - - try: - while not handler.created: - if path.exists(): - return str(path) - observer.join(0.1) - return str(path) - finally: - observer.stop() - observer.join() - - -def load_json( - file_path, wait=True, file_polling_interval=DEFAULT_FILE_POLLING_INTERVAL -): - if wait: - wait_for_path(file_path) - - while True: - try: - content = json.loads(file_path.read_text()) - break - except json.decoder.JSONDecodeError: - logger.info(f"JSON read error, retrying read from {file_path}") - time.sleep(file_polling_interval) - - return content