From 6d540e6864d918a2a442135e885589aad84ebf73 Mon Sep 17 00:00:00 2001 From: nkumar2 Date: Fri, 6 Oct 2023 12:37:48 +0100 Subject: [PATCH] add version to config --- cli/docker_validator.py | 8 ++++---- cli/eva_sub_cli.py | 6 +++--- cli/submit.py | 6 +++--- tests/test_submit.py | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cli/docker_validator.py b/cli/docker_validator.py index abe6c3f..740d1ab 100644 --- a/cli/docker_validator.py +++ b/cli/docker_validator.py @@ -4,12 +4,12 @@ import subprocess import time -from cli import ETC_DIR, SUB_CLI_CONFIG_FILE +from ebi_eva_common_pyutils.WritableConfig import WritableConfig + +from cli import ETC_DIR, SUB_CLI_CONFIG_FILE, __version__ from cli.reporter import Reporter from ebi_eva_common_pyutils.logger import logging_config -from cli.writable_config import WritableConfig - logger = logging_config.get_logger(__name__) docker_path = 'docker' @@ -65,7 +65,7 @@ def __init__(self, mapping_file, output_dir, metadata_json=None, metadata_xlsx=N self.sub_config = submission_config else: config_file = os.path.join(output_dir, SUB_CLI_CONFIG_FILE) - self.sub_config = WritableConfig(config_file) + self.sub_config = WritableConfig(config_file, version=__version__) super().__init__(self._find_vcf_file(), output_dir) def _validate(self): diff --git a/cli/eva_sub_cli.py b/cli/eva_sub_cli.py index 32cedf5..80d90c0 100644 --- a/cli/eva_sub_cli.py +++ b/cli/eva_sub_cli.py @@ -1,12 +1,12 @@ import os from argparse import ArgumentParser +from ebi_eva_common_pyutils.WritableConfig import WritableConfig from ebi_eva_common_pyutils.logger import logging_config -from cli import SUB_CLI_CONFIG_FILE +from cli import SUB_CLI_CONFIG_FILE, __version__ from cli.docker_validator import DockerValidator, docker_path, container_image from cli.submit import StudySubmitter -from cli.writable_config import WritableConfig VALIDATION_OUTPUT_DIR = "validation_output" VALIDATE = 'validate' @@ -46,7 +46,7 @@ def get_docker_validator(vcf_files_mapping, output_dir, metadata_json, metadata_ # load config config_file_path = os.path.join(args.submission_dir, SUB_CLI_CONFIG_FILE) - sub_config = WritableConfig(config_file_path) + sub_config = WritableConfig(config_file_path, version=__version__) if args.task == RESUME: submitter = StudySubmitter(args.submission_dir, submission_config=sub_config) diff --git a/cli/submit.py b/cli/submit.py index ede00b9..83712f7 100644 --- a/cli/submit.py +++ b/cli/submit.py @@ -2,12 +2,12 @@ import os import requests +from ebi_eva_common_pyutils.WritableConfig import WritableConfig from ebi_eva_common_pyutils.logger import logging_config -from cli import SUB_CLI_CONFIG_FILE +from cli import SUB_CLI_CONFIG_FILE, __version__ from cli.auth import get_auth from cli.docker_validator import READY_FOR_SUBMISSION_TO_EVA -from cli.writable_config import WritableConfig logger = logging_config.get_logger(__name__) SUB_CLI_CONFIG_KEY_SUBMISSION_ID = "submission_id" @@ -23,7 +23,7 @@ def __init__(self, submission_dir, submission_initiate_url=SUBMISSION_INITIATE_U self.sub_config = submission_config else: config_file = os.path.join(submission_dir, SUB_CLI_CONFIG_FILE) - self.sub_config = WritableConfig(config_file) + self.sub_config = WritableConfig(config_file, version=__version__) def update_config_with_submission_id_and_upload_url(self, submission_id, upload_url): self.sub_config.set(SUB_CLI_CONFIG_KEY_SUBMISSION_ID, value=submission_id) diff --git a/tests/test_submit.py b/tests/test_submit.py index 37c36c3..1225c37 100644 --- a/tests/test_submit.py +++ b/tests/test_submit.py @@ -5,13 +5,13 @@ from unittest.mock import MagicMock, patch, Mock, PropertyMock import yaml +from ebi_eva_common_pyutils.WritableConfig import WritableConfig from cli import LSRI_CLIENT_ID from cli.auth import WebinAuth, LSRIAuth from cli.docker_validator import READY_FOR_SUBMISSION_TO_EVA from cli.eva_sub_cli import SUB_CLI_CONFIG_FILE from cli.submit import StudySubmitter, SUB_CLI_CONFIG_KEY_SUBMISSION_ID, SUB_CLI_CONFIG_KEY_SUBMISSION_UPLOAD_URL -from cli.writable_config import WritableConfig class TestSubmit(unittest.TestCase): @@ -59,7 +59,7 @@ def test_submit(self): "submissionId": "mock_submission_id", "uploadUrl": "directory to use for upload", } - sub_config = WritableConfig(self.config_file) + sub_config = WritableConfig(self.config_file, version='version1.0') sub_config.set(READY_FOR_SUBMISSION_TO_EVA, value=True) sub_config.write()