From 6cc4802f0e15382beffa6ee16be7fca900b6f94e Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Thu, 3 Aug 2023 14:28:40 +0200 Subject: [PATCH] still --- integration_tests.py | 13 +++++-- .../Client/JobMonitoringClient.py | 12 ++++--- tests/CI/docker-compose.yml | 36 +------------------ 3 files changed, 19 insertions(+), 42 deletions(-) diff --git a/integration_tests.py b/integration_tests.py index ee49a19fc39..4c0e9e3cc00 100755 --- a/integration_tests.py +++ b/integration_tests.py @@ -29,11 +29,13 @@ "DIRACOSVER": "master", "DIRACOS_TARBALL_PATH": None, "TEST_HTTPS": "Yes", + "TEST_DIRACX": "No", "DIRAC_FEWER_CFG_LOCKS": None, "DIRAC_USE_JSON_ENCODE": None, "INSTALLATION_BRANCH": "", } -DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute(), "diracx": Path("/home/chaen/dirac/diracx-project/diracx")} +DIRACX_OPTIONS = ("DIRAC_ENABLE_DIRACX_JOB_MONITORING",) +DEFAULT_MODULES = {"DIRAC": Path(__file__).parent.absolute()} # Static configuration DB_USER = "Dirac" @@ -191,7 +193,6 @@ def prepare_environment( release_var: Optional[str] = None, ): """Prepare the local environment for installing DIRAC.""" - _check_containers_running(is_up=False) if editable is None: editable = sys.stdout.isatty() @@ -325,6 +326,8 @@ def install_server(): check=True, ) + # This runs a continuous loop that exports the config in yaml + # for the diracx container to use typer.secho("Starting configuration export loop for diracx", fg=c.GREEN) base_cmd = _build_docker_cmd("server", tty=False, daemon=True) subprocess.run( @@ -1017,6 +1020,12 @@ def _make_config(modules, flags, release_var, editable): except KeyError: typer.secho(f"Required feature variable {key!r} is missing", err=True, fg=c.RED) raise typer.Exit(code=1) + + # If we test DiracX, enable all the options + if config["TEST_DIRACX"].lower() in ("yes", "true"): + for key in DIRACX_OPTIONS: + config[key] = "Yes" + config["TESTREPO"] = [f"/home/dirac/LocalRepo/TestCode/{name}" for name in modules] config["ALTERNATIVE_MODULES"] = [f"/home/dirac/LocalRepo/ALTERNATIVE_MODULES/{name}" for name in modules] diff --git a/src/DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py b/src/DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py index 2a2f1505071..ecf53fa97b9 100755 --- a/src/DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py +++ b/src/DIRAC/WorkloadManagementSystem/Client/JobMonitoringClient.py @@ -1,13 +1,10 @@ """ Class that contains client access to the job monitoring handler. """ +import os from DIRAC.Core.Base.Client import Client, createClient from DIRAC.Core.Utilities.DEncode import ignoreEncodeWarning from DIRAC.Core.Utilities.JEncode import strToIntDict -from DIRAC.WorkloadManagementSystem.FutureClient.JobMonitoringClient import ( - JobMonitoringClient as futureJobMonitoringClient, -) - @createClient("WorkloadManagement/JobMonitoring") class JobMonitoringClient(Client): @@ -15,7 +12,12 @@ def __init__(self, **kwargs): super().__init__(**kwargs) self.setServer("WorkloadManagement/JobMonitoring") - httpsClient = futureJobMonitoringClient + if os.getenv("DIRAC_ENABLE_DIRACX_JOB_MONITORING", "No").lower() in ("yes", "true"): + from DIRAC.WorkloadManagementSystem.FutureClient.JobMonitoringClient import ( + JobMonitoringClient as futureJobMonitoringClient, + ) + + httpsClient = futureJobMonitoringClient @ignoreEncodeWarning def getJobsStatus(self, jobIDs): diff --git a/tests/CI/docker-compose.yml b/tests/CI/docker-compose.yml index b6ec66356a1..86587dbd3a2 100644 --- a/tests/CI/docker-compose.yml +++ b/tests/CI/docker-compose.yml @@ -101,18 +101,6 @@ services: entrypoint: | /dockerMicroMambaEntrypoint.sh ssh-keygen -P '' -trsa -b4096 -mPEM -f/signing-key/rs256.key - # diracx-init-empty-repo: - # image: gitlab-registry.cern.ch/chaen/chrissquare-hack-a-ton/diracx - # container_name: diracx-init-empty-repo - # environment: - # - DIRACX_CONFIG_BACKEND_URL="git+file:///cs_store/initialRepo" - # volumes: - # - diracx-cs-store:/cs_store/ - # entrypoint: /dockerMicroMambaEntrypoint.sh - # command: mkdir -p /cs_store/initialRepo && cd /cs_store/initialRepo && git init - - - diracx-init-cs: image: gitlab-registry.cern.ch/chaen/chrissquare-hack-a-ton/diracx container_name: diracx-init-cs @@ -125,28 +113,6 @@ services: entrypoint: | /dockerMicroMambaEntrypoint.sh dirac internal generate-cs /cs_store/initialRepo --vo=diracAdmin --user-group=admin --idp-url=http://dsdsd.csds/a/b - - # diracx-init-cs-user: - # image: gitlab-registry.cern.ch/chaen/chrissquare-hack-a-ton/diracx - # container_name: diracx-init-cs-user - # depends_on: - # # dirac-server: - # # condition: service_healthy - # diracx-init-cs: - # condition: service_completed_successfully # Let the init container create the cs - # environment: - # - DIRACX_CONFIG_BACKEND_URL="git+file:///cs_store/initialRepo" - # - DIRACX_SERVICE_AUTH_TOKEN_KEY="file:///signing-key/rs256.key" - # volumes: - # - diracx-cs-store:/cs_store/ - # - diracx-key-store:/signing-key/ - # entrypoint: | - # /dockerMicroMambaEntrypoint.sh dirac internal add-user /cs_store/initialRepo --vo=diracAdmin --user-group=admin --sub=EgVsb2NhbA - - - - - diracx: image: gitlab-registry.cern.ch/chaen/chrissquare-hack-a-ton/diracx container_name: diracx @@ -170,7 +136,7 @@ services: # entrypoint: sleep 1000 healthcheck: - test: ["CMD", "curl", "-f", "http://localhost:8000/.well-known/openid-configuration"] + test: ["CMD", "/dockerMicroMambaEntrypoint.sh", "curl", "-f", "http://localhost:8000/.well-known/openid-configuration"] interval: 5s timeout: 2s retries: 15