ctao-bdms-clients 0.1.0rc3__py3-none-any.whl → 0.2.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bdms/_version.py +9 -4
- bdms/acada_ingestion.py +435 -0
- bdms/tests/conftest.py +41 -0
- bdms/tests/test_acada_ingestion.py +501 -0
- bdms/tests/test_basic_rucio_functionality.py +15 -27
- bdms/tests/test_onsite_storage.py +119 -0
- bdms/tests/utils.py +112 -0
- {ctao_bdms_clients-0.1.0rc3.dist-info → ctao_bdms_clients-0.2.0rc1.dist-info}/METADATA +9 -4
- ctao_bdms_clients-0.2.0rc1.dist-info/RECORD +18 -0
- {ctao_bdms_clients-0.1.0rc3.dist-info → ctao_bdms_clients-0.2.0rc1.dist-info}/WHEEL +1 -1
- bdms/_dev_version/__init__.py +0 -9
- ctao_bdms_clients-0.1.0rc3.dist-info/RECORD +0 -15
- {ctao_bdms_clients-0.1.0rc3.dist-info → ctao_bdms_clients-0.2.0rc1.dist-info/licenses}/LICENSE +0 -0
- {ctao_bdms_clients-0.1.0rc3.dist-info → ctao_bdms_clients-0.2.0rc1.dist-info}/top_level.txt +0 -0
bdms/tests/utils.py
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
"""Utility functions for BDMS tests."""
|
2
|
+
|
3
|
+
import logging
|
4
|
+
import os
|
5
|
+
import time
|
6
|
+
from pathlib import Path
|
7
|
+
|
8
|
+
from dotenv import load_dotenv
|
9
|
+
from minio import Minio
|
10
|
+
from rucio.client.ruleclient import RuleClient
|
11
|
+
from rucio.common.exception import RucioException
|
12
|
+
|
13
|
+
# Default timeout and polling interval (in seconds) for waiting for replication
|
14
|
+
DEFAULT_TIMEOUT = 1000
|
15
|
+
DEFAULT_POLL_INTERVAL = 30
|
16
|
+
LOGGER = logging.getLogger(__name__)
|
17
|
+
|
18
|
+
|
19
|
+
def wait_for_replication_status(
|
20
|
+
rule_client: RuleClient,
|
21
|
+
rule_id: str,
|
22
|
+
expected_status: str = "OK",
|
23
|
+
timeout: int = DEFAULT_TIMEOUT,
|
24
|
+
poll_interval: int = DEFAULT_POLL_INTERVAL,
|
25
|
+
logger: logging.Logger = None,
|
26
|
+
) -> None:
|
27
|
+
if logger is None:
|
28
|
+
logger = LOGGER
|
29
|
+
|
30
|
+
start_time = time.perf_counter()
|
31
|
+
current_status = None
|
32
|
+
result = None
|
33
|
+
max_retries = 3
|
34
|
+
|
35
|
+
while (time.perf_counter() - start_time) < timeout:
|
36
|
+
retries = 0
|
37
|
+
while retries < max_retries:
|
38
|
+
try:
|
39
|
+
result = rule_client.get_replication_rule(rule_id)
|
40
|
+
current_status = result["state"]
|
41
|
+
break
|
42
|
+
except RucioException as e:
|
43
|
+
retries += 1
|
44
|
+
if retries == max_retries:
|
45
|
+
raise RuntimeError(
|
46
|
+
f"Failed to check replication rule status for rule {rule_id} after {max_retries} retries: {str(e)}"
|
47
|
+
) from e
|
48
|
+
logger.warning(
|
49
|
+
"Failed to check rule %s status (attempt %s/%s): %s. Retrying...",
|
50
|
+
rule_id,
|
51
|
+
retries,
|
52
|
+
max_retries,
|
53
|
+
str(e),
|
54
|
+
)
|
55
|
+
time.sleep(1)
|
56
|
+
|
57
|
+
if current_status == expected_status:
|
58
|
+
logger.info(
|
59
|
+
"Replication rule %s reached status '%s'", rule_id, expected_status
|
60
|
+
)
|
61
|
+
return
|
62
|
+
|
63
|
+
logger.debug(
|
64
|
+
"Rule %s is in state %s, waiting for %s (elapsed: %.2f seconds)",
|
65
|
+
rule_id,
|
66
|
+
current_status,
|
67
|
+
expected_status,
|
68
|
+
time.perf_counter() - start_time,
|
69
|
+
)
|
70
|
+
time.sleep(poll_interval)
|
71
|
+
|
72
|
+
msg = (
|
73
|
+
f"Replication rule {rule_id} did not reach status '{expected_status}' within {timeout} seconds. "
|
74
|
+
f"Current status is '{current_status}'.\nFull output: {result}"
|
75
|
+
)
|
76
|
+
raise TimeoutError(msg)
|
77
|
+
|
78
|
+
|
79
|
+
TEST_DATA_DIR = Path(os.getenv("BDMS_TEST_DATA_DIR", "test_data")).absolute()
|
80
|
+
|
81
|
+
|
82
|
+
def download_test_file(path):
|
83
|
+
"""Get a FITS file from the MinIO server"""
|
84
|
+
|
85
|
+
load_dotenv()
|
86
|
+
|
87
|
+
access_key = os.environ["MINIO_ACCESS_KEY"]
|
88
|
+
secret_key = os.environ["MINIO_SECRET_KEY"]
|
89
|
+
|
90
|
+
output_path = TEST_DATA_DIR / path
|
91
|
+
|
92
|
+
TEST_DATA_DIR.mkdir(parents=True, exist_ok=True)
|
93
|
+
|
94
|
+
if not output_path.exists():
|
95
|
+
client = Minio(
|
96
|
+
"minio-cta.zeuthen.desy.de",
|
97
|
+
access_key,
|
98
|
+
secret_key,
|
99
|
+
secure=True,
|
100
|
+
)
|
101
|
+
|
102
|
+
LOGGER.info("Downloading %s", path)
|
103
|
+
client.fget_object(
|
104
|
+
"dpps-data-private",
|
105
|
+
path,
|
106
|
+
output_path,
|
107
|
+
)
|
108
|
+
|
109
|
+
else:
|
110
|
+
LOGGER.info("File %s already exists, skipping download", output_path)
|
111
|
+
|
112
|
+
return output_path
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: ctao-bdms-clients
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0rc1
|
4
4
|
Summary: Client module for the CTAO DPPS Bulk Data Management System
|
5
5
|
Author-email: Georgios Zacharis <georgios.zacharis@inaf.it>, Stefano Gallozzi <Stefano.gallozzi@inaf.it>, Michele Mastropietro <michele.mastropietro@inaf.it>, Syed Anwar Ul Hasan <syedanwarul.hasan@cta-consortium.org>, Maximilian Linhoff <maximilian.linhoff@cta-observatory.org>, Volodymyr Savchenko <Volodymyr.Savchenko@epfl.ch>
|
6
6
|
License: BSD-3-Clause
|
@@ -9,23 +9,28 @@ Project-URL: documentation, http://cta-computing.gitlab-pages.cta-observatory.or
|
|
9
9
|
Requires-Python: >=3.9
|
10
10
|
Description-Content-Type: text/markdown
|
11
11
|
License-File: LICENSE
|
12
|
-
Requires-Dist:
|
13
|
-
Requires-Dist: ctao-bdms-rucio-policy
|
12
|
+
Requires-Dist: astropy<8.0.0a0,>=6.0.1
|
13
|
+
Requires-Dist: ctao-bdms-rucio-policy~=0.1.0
|
14
|
+
Requires-Dist: rucio-clients~=35.7.0
|
14
15
|
Provides-Extra: test
|
15
16
|
Requires-Dist: pytest; extra == "test"
|
16
17
|
Requires-Dist: pytest-cov; extra == "test"
|
17
18
|
Requires-Dist: pytest-requirements; extra == "test"
|
19
|
+
Requires-Dist: python-dotenv; extra == "test"
|
20
|
+
Requires-Dist: minio; extra == "test"
|
18
21
|
Provides-Extra: doc
|
19
22
|
Requires-Dist: sphinx; extra == "doc"
|
20
23
|
Requires-Dist: numpydoc; extra == "doc"
|
21
24
|
Requires-Dist: ctao-sphinx-theme; extra == "doc"
|
22
25
|
Requires-Dist: myst-parser; extra == "doc"
|
23
26
|
Requires-Dist: sphinx-changelog; extra == "doc"
|
27
|
+
Requires-Dist: sphinx-automodapi; extra == "doc"
|
24
28
|
Provides-Extra: dev
|
25
29
|
Requires-Dist: setuptools_scm; extra == "dev"
|
26
30
|
Requires-Dist: sphinx-autobuild; extra == "dev"
|
27
31
|
Provides-Extra: all
|
28
32
|
Requires-Dist: bdms[dev,doc,test]; extra == "all"
|
33
|
+
Dynamic: license-file
|
29
34
|
|
30
35
|
# Bulk Data Management System
|
31
36
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
bdms/__init__.py,sha256=7btE6tNhFqXSv2eUhZ-0m1J3nTTs4Xo6HWcQI4eh5Do,142
|
2
|
+
bdms/_version.py,sha256=6j6NVXRMR-dX2osPsF0-SkvP1-ofWxEz6ew_4VL2kCY,521
|
3
|
+
bdms/acada_ingestion.py,sha256=bKnXbAYvtYHYQk6ir5Sw1YIjCXGZTyk3IpZz-XGkkPo,16248
|
4
|
+
bdms/version.py,sha256=mTfi1WzbIs991NyImM6mcMg1R39a6U1W2pKnk-Tt5Vw,765
|
5
|
+
bdms/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
bdms/tests/conftest.py,sha256=lArkd8Kn7Ef19_BhqXq77taei9LKggWUu3FDUhrt9M4,3009
|
7
|
+
bdms/tests/test_acada_ingestion.py,sha256=A0G9-ssHN3dx0Jz_eIN72dQp21gfZqdQnyAgLY3BDF4,17738
|
8
|
+
bdms/tests/test_basic_rucio_functionality.py,sha256=GFUCq2QlM0M_5k5Qz9iPXPftE6nGuGYbW_IVS76T978,3604
|
9
|
+
bdms/tests/test_dpps_rel_0_0.py,sha256=MnbuBoS_kUUiMcHE3-jqOzekQNUa-wcsjCJqJQ2J9S4,2957
|
10
|
+
bdms/tests/test_file_replicas.py,sha256=NqutrSJa5ME50JpmyATNPSLqq1AOq1ruv84XSY3PKLI,2635
|
11
|
+
bdms/tests/test_metadata.py,sha256=f0tSqNGlYe-ydoSDJw0k1De2kHoPl6g-GYBj_jP6kCY,3728
|
12
|
+
bdms/tests/test_onsite_storage.py,sha256=xBwVbr2q0KHnesIrF0I8ova_hfDXDs3CBya2Sxi6VWM,4633
|
13
|
+
bdms/tests/utils.py,sha256=fh23X6iN2-lsoRBU3WSeWkweiHZlOtIUK5xzHbWyP6c,3185
|
14
|
+
ctao_bdms_clients-0.2.0rc1.dist-info/licenses/LICENSE,sha256=Py9riZY_f0CmXbrZ5JreE3WgglyWkRnwUfqydvX6jxE,1556
|
15
|
+
ctao_bdms_clients-0.2.0rc1.dist-info/METADATA,sha256=88TkbmaMgsbU1dwCRzPHKWK-yYb323BT1HqFgsQboEg,2297
|
16
|
+
ctao_bdms_clients-0.2.0rc1.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
17
|
+
ctao_bdms_clients-0.2.0rc1.dist-info/top_level.txt,sha256=ao0U8aA33KRHpcqmr7yrK8y2AQ6ahSu514tfaN4hDV8,5
|
18
|
+
ctao_bdms_clients-0.2.0rc1.dist-info/RECORD,,
|
bdms/_dev_version/__init__.py
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# Try to use setuptools_scm to get the current version; this is only used
|
2
|
-
# in development installations from the git repository.
|
3
|
-
# see ../version.py for details
|
4
|
-
try:
|
5
|
-
from setuptools_scm import get_version
|
6
|
-
|
7
|
-
version = get_version(root="../../..", relative_to=__file__)
|
8
|
-
except Exception as e:
|
9
|
-
raise ImportError(f"setuptools_scm broken or not installed: {e}")
|
@@ -1,15 +0,0 @@
|
|
1
|
-
bdms/__init__.py,sha256=7btE6tNhFqXSv2eUhZ-0m1J3nTTs4Xo6HWcQI4eh5Do,142
|
2
|
-
bdms/_version.py,sha256=T50yPh_uNdS9vwClzyZNHuV3NjwtB-VEu54RR1k2Pr8,414
|
3
|
-
bdms/version.py,sha256=mTfi1WzbIs991NyImM6mcMg1R39a6U1W2pKnk-Tt5Vw,765
|
4
|
-
bdms/_dev_version/__init__.py,sha256=3qlzT1l_MfLxHuRphBwNwkb2WRttg3hGooj5n3BBZi4,369
|
5
|
-
bdms/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
-
bdms/tests/conftest.py,sha256=vN96UXhO2503svkg3V2jxfq5SSUtlRCWZt5MQgblu7Y,1374
|
7
|
-
bdms/tests/test_basic_rucio_functionality.py,sha256=Sm6Kif8g5xPaw6tIIJ1TavDxVje2YaYYC9PnhVbVQFI,3999
|
8
|
-
bdms/tests/test_dpps_rel_0_0.py,sha256=MnbuBoS_kUUiMcHE3-jqOzekQNUa-wcsjCJqJQ2J9S4,2957
|
9
|
-
bdms/tests/test_file_replicas.py,sha256=NqutrSJa5ME50JpmyATNPSLqq1AOq1ruv84XSY3PKLI,2635
|
10
|
-
bdms/tests/test_metadata.py,sha256=f0tSqNGlYe-ydoSDJw0k1De2kHoPl6g-GYBj_jP6kCY,3728
|
11
|
-
ctao_bdms_clients-0.1.0rc3.dist-info/LICENSE,sha256=Py9riZY_f0CmXbrZ5JreE3WgglyWkRnwUfqydvX6jxE,1556
|
12
|
-
ctao_bdms_clients-0.1.0rc3.dist-info/METADATA,sha256=XtiN3evP0TQGDRZ_M0_b9DXz1lWWjPXU2li95xj8RZs,2103
|
13
|
-
ctao_bdms_clients-0.1.0rc3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
14
|
-
ctao_bdms_clients-0.1.0rc3.dist-info/top_level.txt,sha256=ao0U8aA33KRHpcqmr7yrK8y2AQ6ahSu514tfaN4hDV8,5
|
15
|
-
ctao_bdms_clients-0.1.0rc3.dist-info/RECORD,,
|
{ctao_bdms_clients-0.1.0rc3.dist-info → ctao_bdms_clients-0.2.0rc1.dist-info/licenses}/LICENSE
RENAMED
File without changes
|
File without changes
|