From 0069a24675a4286a74ef089326bffb0bdb0c22fe Mon Sep 17 00:00:00 2001 From: Heet Sankesara Date: Wed, 19 Jul 2023 11:01:36 +0100 Subject: [PATCH] Minor changes in updated mock data --- mockdata | 2 +- radarpipeline/project/validations.py | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mockdata b/mockdata index 17e9ff9..c791236 160000 --- a/mockdata +++ b/mockdata @@ -1 +1 @@ -Subproject commit 17e9ff951ea125dea0c9e65a5695d707749fdc84 +Subproject commit c7912366b946edc8a7e51bbde6b41ae4a248c995 diff --git a/radarpipeline/project/validations.py b/radarpipeline/project/validations.py index 06f6a29..68b130b 100644 --- a/radarpipeline/project/validations.py +++ b/radarpipeline/project/validations.py @@ -36,19 +36,23 @@ def _update_mock_data(self) -> None: Updates the mock data submodule of the åproject """ - repo = Repo( - os.path.dirname(os.path.abspath(__file__)), - search_parent_directories=True, - ) - sms = repo.submodules try: - mock_data_submodule = sms["mockdata"] + MOCK_URL = "https://github.com/RADAR-base-Analytics/mockdata" + cache_dir = os.path.join( + os.path.expanduser("~"), ".cache", "radarpipeline", "mockdata") + if not os.path.exists(cache_dir): + logger.info("Mock data submodule not found. Cloning it...") + Repo.clone_from(MOCK_URL, cache_dir) + logger.info("Mock data input cloned") + else: + repo = Repo( + cache_dir, + search_parent_directories=True, + ) + repo.remotes.origin.pull() + except IndexError: - raise ValueError("mockdata submodule not found in the repository") - if not (mock_data_submodule.exists() and mock_data_submodule.module_exists()): - logger.info("Mock data submodule not found. Cloning it...") - repo.git.submodule("update", "--init", "--recursive") - logger.info("Mock data input cloned") + raise ValueError("mockdata submodule not found") def _validate_input(self) -> None: """