From a9cf5158824cfa299599eb00321f00cee7037f8c Mon Sep 17 00:00:00 2001 From: Sylvain <35365065+sanderegg@users.noreply.github.com> Date: Wed, 14 Oct 2020 13:37:26 +0200 Subject: [PATCH] Is1877/allow constraints on director services (#1878) * added DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS variable --- .github/workflows/ci-release.yml | 8 +-- .github/workflows/ci-staging.yml | 6 +- .github/workflows/ci-testing-deploy.yml | 62 +++++++++---------- .../src/pytest_simcore/postgres_service.py | 6 +- .../src/pytest_simcore/rabbit_service.py | 11 +++- services/catalog/docker-compose-extra.yml | 1 + .../src/simcore_service_director/config.py | 7 ++- .../src/simcore_service_director/producer.py | 22 +++++-- .../registry_proxy.py | 5 +- .../rest/node_validator.py | 2 +- services/docker-compose.yml | 3 +- tests/swarm-deploy/test_swarm_runs.py | 8 ++- 12 files changed, 85 insertions(+), 56 deletions(-) diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 4adc39a89ca..2bca51c004b 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -24,17 +24,17 @@ jobs: - name: set target variable run: | target=$(git name-rev --refs="refs/remotes/origin/*" --name-only ${GITHUB_SHA}) - echo ::set-env name=TARGET::${target} + echo "TARGET=${target}" >> $GITHUB_ENV - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: set owner variable - run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*} + run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV - name: set git tag - run: echo ::set-env name=GIT_TAG::${GITHUB_REF##*/} + run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - if: env.TARGET == 'remotes/origin/master' env: FROM_TAG_PREFIX: staging-github diff --git a/.github/workflows/ci-staging.yml b/.github/workflows/ci-staging.yml index 82626103db1..3f146d98d8e 100644 --- a/.github/workflows/ci-staging.yml +++ b/.github/workflows/ci-staging.yml @@ -26,10 +26,10 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: set owner variable - run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*} + run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV - name: set git tag - run: echo ::set-env name=GIT_TAG::${GITHUB_REF##*/} + run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV - name: deploy run: ./ci/deploy/dockerhub-tag-version.bash diff --git a/.github/workflows/ci-testing-deploy.yml b/.github/workflows/ci-testing-deploy.yml index 0950ef109af..deeb00acbd9 100644 --- a/.github/workflows/ci-testing-deploy.yml +++ b/.github/workflows/ci-testing-deploy.yml @@ -49,7 +49,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -85,7 +85,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -134,7 +134,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -189,7 +189,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -238,7 +238,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -287,7 +287,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node }} @@ -317,7 +317,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -353,7 +353,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -402,7 +402,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -451,7 +451,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -500,7 +500,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -549,7 +549,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -599,7 +599,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -649,7 +649,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -699,7 +699,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -749,7 +749,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -795,7 +795,7 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: show system environs if: github.event_name == 'push' run: ./ci/helpers/show_system_versions.bash @@ -807,7 +807,7 @@ jobs: run: ./ci/build/test-images.bash build_images - name: set owner variable if: github.event_name == 'push' - run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*} + run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV - name: push images # only pushes have access to the docker credentials if: github.event_name == 'push' @@ -828,14 +828,14 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -893,14 +893,14 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -958,14 +958,14 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -1023,14 +1023,14 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -1072,14 +1072,14 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup docker run: | sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: setup python environment uses: actions/setup-python@v2 with: @@ -1152,7 +1152,7 @@ jobs: if: github.event_name == 'pull_request' run: | export TMP_DOCKER_REGISTRY=${GITHUB_REPOSITORY%/*} - echo ::set-env name=DOCKER_REGISTRY::${TMP_DOCKER_REGISTRY,,} + echo "DOCKER_REGISTRY=${TMP_DOCKER_REGISTRY,,}" >> $GITHUB_ENV - uses: actions/checkout@v2 - name: setup python environment uses: actions/setup-python@v2 @@ -1307,9 +1307,9 @@ jobs: sudo ./ci/github/helpers/setup_docker_compose.bash ./ci/github/helpers/setup_docker_experimental.bash ./ci/github/helpers/setup_docker_buildx.bash - echo ::set-env name=DOCKER_BUILDX::1 + echo "DOCKER_BUILDX=1" >> $GITHUB_ENV - name: set owner variable - run: echo ::set-env name=OWNER::${GITHUB_REPOSITORY%/*} + run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV - name: deploy master if: github.ref == 'refs/heads/master' env: diff --git a/packages/pytest-simcore/src/pytest_simcore/postgres_service.py b/packages/pytest-simcore/src/pytest_simcore/postgres_service.py index 585b1d4cc22..b6bf5ea1bc0 100644 --- a/packages/pytest-simcore/src/pytest_simcore/postgres_service.py +++ b/packages/pytest-simcore/src/pytest_simcore/postgres_service.py @@ -43,7 +43,7 @@ def create_template_db(postgres_dsn: Dict, postgres_engine: sa.engine.Engine) -> queries = [ # disconnect existing users f""" - SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity + SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '{postgres_dsn["database"]}' AND pid <> pg_backend_pid(); """, # drop template database @@ -116,7 +116,7 @@ def database_from_template_before_each_function( queries = [ # terminate existing connections to the database f""" - SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity + SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '{postgres_dsn["database"]}'; """, # drop database @@ -209,7 +209,7 @@ def postgres_session(postgres_db: sa.engine.Engine) -> sa.orm.session.Session: @tenacity.retry( wait=tenacity.wait_fixed(5), - stop=tenacity.stop_after_attempt(20), + stop=tenacity.stop_after_attempt(60), before_sleep=tenacity.before_sleep_log(log, logging.INFO), reraise=True, ) diff --git a/packages/pytest-simcore/src/pytest_simcore/rabbit_service.py b/packages/pytest-simcore/src/pytest_simcore/rabbit_service.py index c258fc53460..2a97059814c 100644 --- a/packages/pytest-simcore/src/pytest_simcore/rabbit_service.py +++ b/packages/pytest-simcore/src/pytest_simcore/rabbit_service.py @@ -2,6 +2,7 @@ # pylint:disable=unused-argument # pylint:disable=redefined-outer-name +import logging import os import socket from typing import Any, Dict, Optional, Tuple @@ -9,11 +10,12 @@ import aio_pika import pytest import tenacity -from servicelib.rabbitmq_utils import RabbitMQRetryPolicyUponInitialization from simcore_sdk.config.rabbit import Config from .helpers.utils_docker import get_service_published_port +log = logging.getLogger(__name__) + @pytest.fixture(scope="module") def rabbit_config(docker_stack: Dict, devel_environ: Dict) -> Config: @@ -127,7 +129,12 @@ async def rabbit_queue( # HELPERS -- -@tenacity.retry(**RabbitMQRetryPolicyUponInitialization().kwargs) +@tenacity.retry( + wait=tenacity.wait_fixed(5), + stop=tenacity.stop_after_attempt(60), + before_sleep=tenacity.before_sleep_log(log, logging.INFO), + reraise=True, +) async def wait_till_rabbit_responsive(url: str) -> None: connection = await aio_pika.connect(url) await connection.close() diff --git a/services/catalog/docker-compose-extra.yml b/services/catalog/docker-compose-extra.yml index a9e24129004..bdc4736f630 100644 --- a/services/catalog/docker-compose-extra.yml +++ b/services/catalog/docker-compose-extra.yml @@ -45,6 +45,7 @@ services: - REGISTRY_SSL=${REGISTRY_SSL} - DIRECTOR_REGISTRY_CACHING=${DIRECTOR_REGISTRY_CACHING} - DIRECTOR_REGISTRY_CACHING_TTL=${DIRECTOR_REGISTRY_CACHING_TTL} + - DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=${DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS} - DIRECTOR_SELF_SIGNED_SSL_SECRET_ID=${DIRECTOR_SELF_SIGNED_SSL_SECRET_ID} - DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME=${DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME} - DIRECTOR_SELF_SIGNED_SSL_FILENAME=${DIRECTOR_SELF_SIGNED_SSL_FILENAME} diff --git a/services/director/src/simcore_service_director/config.py b/services/director/src/simcore_service_director/config.py index 27fe50f7f98..d2179b7bba4 100644 --- a/services/director/src/simcore_service_director/config.py +++ b/services/director/src/simcore_service_director/config.py @@ -11,7 +11,8 @@ LOGLEVEL_STR = os.environ.get("LOGLEVEL", "WARNING").upper() log_level = getattr(logging, LOGLEVEL_STR) logging.basicConfig( - level=log_level, format="%(levelname)s:%(name)s-%(lineno)d: %(message)s", + level=log_level, + format="%(levelname)s:%(name)s-%(lineno)d: %(message)s", ) logging.root.setLevel(log_level) @@ -38,6 +39,10 @@ os.environ.get("DIRECTOR_REGISTRY_CACHING_TTL", 15 * 60) ) +DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS: str = os.environ.get( + "DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS", "" +) + # for passing self-signed certificate to spawned services DIRECTOR_SELF_SIGNED_SSL_SECRET_ID: str = os.environ.get( "DIRECTOR_SELF_SIGNED_SSL_SECRET_ID", "" diff --git a/services/director/src/simcore_service_director/producer.py b/services/director/src/simcore_service_director/producer.py index c3e2553cac3..6032679f78b 100644 --- a/services/director/src/simcore_service_director/producer.py +++ b/services/director/src/simcore_service_director/producer.py @@ -6,13 +6,14 @@ import re from distutils.version import StrictVersion from enum import Enum +from pprint import pformat from typing import Dict, List, Optional, Tuple -import aiodocker import tenacity from aiohttp import ClientConnectionError, ClientSession, web -from servicelib.async_utils import run_sequentially_in_context +import aiodocker +from servicelib.async_utils import run_sequentially_in_context from servicelib.monitor_services import service_started, service_stopped from . import config, docker_utils, exceptions, registry_proxy @@ -106,7 +107,7 @@ async def _read_service_settings( json.loads(image_labels[settings_name]) if settings_name in image_labels else {} ) - log.debug("Retrieved %s settings: %s", settings_name, settings) + log.debug("Retrieved %s settings: %s", settings_name, pformat(settings)) return settings @@ -217,6 +218,14 @@ async def _create_docker_service_params( "networks": [internal_network_id] if internal_network_id else [], } + if config.DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS: + log.debug( + "adding custom constraints %s ", config.DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS + ) + docker_params["task_template"]["Placement"]["Constraints"] += [ + config.DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS + ] + if reverse_proxy_settings: # some services define strip_path:true if they need the path to be stripped away if ( @@ -307,8 +316,6 @@ async def _create_docker_service_params( except exceptions.DirectorException: log.exception("Could not find swarm network") - log.debug("Converted labels to docker runtime parameters: %s", docker_params) - # set labels for CPU and Memory limits container_spec["Labels"]["nano_cpus_limit"] = str( docker_params["task_template"]["Resources"]["Limits"]["NanoCPUs"] @@ -317,6 +324,9 @@ async def _create_docker_service_params( docker_params["task_template"]["Resources"]["Limits"]["MemoryBytes"] ) + log.debug( + "Converted labels to docker runtime parameters: %s", pformat(docker_params) + ) return docker_params @@ -352,7 +362,7 @@ async def _get_swarm_network(client: aiodocker.docker.Docker) -> Dict: async def _get_docker_image_port_mapping( service: Dict, ) -> Tuple[Optional[str], Optional[int]]: - log.debug("getting port published by service: %s", service) + log.debug("getting port published by service: %s", pformat(service)) published_ports = list() target_ports = list() diff --git a/services/director/src/simcore_service_director/registry_proxy.py b/services/director/src/simcore_service_director/registry_proxy.py index 1ac07e5973d..59ed6ffd05e 100644 --- a/services/director/src/simcore_service_director/registry_proxy.py +++ b/services/director/src/simcore_service_director/registry_proxy.py @@ -5,6 +5,7 @@ import logging import re from http import HTTPStatus +from pprint import pformat from typing import Dict, List, Tuple from aiohttp import BasicAuth, ClientSession, client_exceptions, web @@ -210,7 +211,7 @@ async def get_image_labels(app: web.Application, image: str, tag: str) -> Dict: "container_config", v1_compatibility_key["config"] ) labels = container_config["Labels"] - logger.debug("retrieved labels of image %s:%s: %s", image, tag, request_result) + logger.debug("retrieved labels of image %s:%s", image, tag) return labels @@ -337,7 +338,7 @@ async def get_service_extras( ) -> Dict[str, str]: result = {} labels = await get_image_labels(app, image_key, image_tag) - logger.debug("Compiling service extras from labels %s", labels) + logger.debug("Compiling service extras from labels %s", pformat(labels)) # check physical node requirements # all nodes require "CPU" diff --git a/services/director/src/simcore_service_director/rest/node_validator.py b/services/director/src/simcore_service_director/rest/node_validator.py index 45c07732c9a..bb93c06f785 100644 --- a/services/director/src/simcore_service_director/rest/node_validator.py +++ b/services/director/src/simcore_service_director/rest/node_validator.py @@ -17,7 +17,7 @@ def is_service_valid(service: Dict): log.debug("service [%s] validated", service["key"]) return True except ValidationError as exc: - log.debug("Node validation error: %s", exc.message) + log.debug("service [%s] validation error: %s", service["key"], exc.message) return False except SchemaError as exc: log.exception("Schema error:") diff --git a/services/docker-compose.yml b/services/docker-compose.yml index 077f481ac9e..3ad5eacb222 100644 --- a/services/docker-compose.yml +++ b/services/docker-compose.yml @@ -50,6 +50,7 @@ services: - REGISTRY_SSL=${REGISTRY_SSL} - DIRECTOR_REGISTRY_CACHING=${DIRECTOR_REGISTRY_CACHING} - DIRECTOR_REGISTRY_CACHING_TTL=${DIRECTOR_REGISTRY_CACHING_TTL} + - DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS=${DIRECTOR_SERVICES_CUSTOM_CONSTRAINTS} - DIRECTOR_SELF_SIGNED_SSL_SECRET_ID=${DIRECTOR_SELF_SIGNED_SSL_SECRET_ID} - DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME=${DIRECTOR_SELF_SIGNED_SSL_SECRET_NAME} - DIRECTOR_SELF_SIGNED_SSL_FILENAME=${DIRECTOR_SELF_SIGNED_SSL_FILENAME} @@ -102,7 +103,7 @@ services: deploy: placement: constraints: - - node.platform.os == linux + - node.platform.os == linux labels: - io.simcore.zone=${TRAEFIK_SIMCORE_ZONE} # gzip compression diff --git a/tests/swarm-deploy/test_swarm_runs.py b/tests/swarm-deploy/test_swarm_runs.py index 99592e061eb..805f0401d83 100644 --- a/tests/swarm-deploy/test_swarm_runs.py +++ b/tests/swarm-deploy/test_swarm_runs.py @@ -22,7 +22,7 @@ current_dir = Path(sys.argv[0] if __name__ == "__main__" else __file__).resolve().parent -WAIT_TIME_SECS = 20 +WAIT_TIME_SECS = 40 RETRY_COUNT = 7 MAX_WAIT_TIME = 240 @@ -157,7 +157,11 @@ def test_core_service_running( ], ) def test_product_frontend_app_served( - make_up_prod: Dict, traefik_service: URL, test_url: str, expected_in_content: str, loop + make_up_prod: Dict, + traefik_service: URL, + test_url: str, + expected_in_content: str, + loop, ): # NOTE: it takes a bit of time until traefik sets up the correct proxy and # the webserver takes time to start