From 0e2c302440352a9a7573c0358af7299cb8c78a42 Mon Sep 17 00:00:00 2001 From: Vincent Janvid <69356202+Vince-janv@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:57:26 +0100 Subject: [PATCH] Feat(Hermes) Allow container path to be configured (#4136)(minor) ## Description The path of the Hermes container is hard-coded into the HermesAPI. This prevents any testing of changes in hermes without actually changing this string in a separate cg PR. This PR allows it to be set in the config instead. ### Changed - Allows the container path to be configured in the config of the CLI --- cg/apps/hermes/hermes_api.py | 3 ++- cg/models/cg_config.py | 10 ++++++---- tests/conftest.py | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cg/apps/hermes/hermes_api.py b/cg/apps/hermes/hermes_api.py index 3bae253f18..fec6968e15 100644 --- a/cg/apps/hermes/hermes_api.py +++ b/cg/apps/hermes/hermes_api.py @@ -18,6 +18,7 @@ def __init__(self, config: dict): self.process = Process( binary=config["hermes"]["binary_path"], ) + self.container_path: str = config["hermes"]["container_path"] self.container_mount_volume = config["hermes"]["container_mount_volume"] def convert_deliverables( @@ -33,7 +34,7 @@ def convert_deliverables( "run", "--bind", self.container_mount_volume, - "/home/proj/stage/singularity_containers/hermes_latest.sif", + self.container_path, "convert", "deliverables", "--workflow", diff --git a/cg/models/cg_config.py b/cg/models/cg_config.py index 54cea8deb1..803c7d0d9d 100644 --- a/cg/models/cg_config.py +++ b/cg/models/cg_config.py @@ -27,9 +27,7 @@ from cg.meta.delivery.delivery import DeliveryAPI from cg.services.analysis_service.analysis_service import AnalysisService from cg.services.decompression_service.decompressor import Decompressor -from cg.services.deliver_files.factory import ( - DeliveryServiceFactory, -) +from cg.services.deliver_files.factory import DeliveryServiceFactory from cg.services.deliver_files.rsync.models import RsyncDeliveryConfig from cg.services.deliver_files.rsync.service import DeliveryRsyncService from cg.services.fastq_concatenation_service.fastq_concatenation_service import ( @@ -147,6 +145,10 @@ class CommonAppConfig(BaseModel): container_mount_volume: str | None = None +class HermesConfig(CommonAppConfig): + container_path: str + + class FluffyUploadConfig(BaseModel): user: str password: str @@ -425,7 +427,7 @@ class CGConfig(BaseModel): genotype_api_: GenotypeAPI = None gens: CommonAppConfig = None gens_api_: GensAPI = None - hermes: CommonAppConfig = None + hermes: HermesConfig = None hermes_api_: HermesApi = None janus: ClientConfig | None = None janus_api_: JanusAPIClient | None = None diff --git a/tests/conftest.py b/tests/conftest.py index 59dd031208..8174ffccf0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1227,6 +1227,7 @@ def hermes_api(hermes_process: ProcessMock) -> HermesApi: "hermes": { "binary_path": "/bin/true", "container_mount_volume": "a_str", + "container_path": "/singularity_cache", } } hermes_api = HermesApi(config=hermes_config) @@ -2051,7 +2052,7 @@ def context_config( "upload_password": "pass", "submitter": "s.submitter", }, - "hermes": {"binary_path": "hermes"}, + "hermes": {"binary_path": "hermes", "container_path": "/singularity_cache"}, "housekeeper": {"database": hk_uri, "root": str(housekeeper_dir)}, "lims": { "host": "https://lims.scilifelab.se",