cgse-common 2025.0.3__tar.gz → 2025.0.4__tar.gz
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.
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/PKG-INFO +1 -1
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/pyproject.toml +1 -1
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/command.py +1 -1
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/env.py +10 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/hk.py +11 -13
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/setup.py +1 -1
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/.gitignore +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/README.md +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/bits.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/calibration.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/config.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/control.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/decorators.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/device.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/exceptions.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/metrics.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/mixin.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/monitoring.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/observer.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/obsid.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/persistence.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/plugin.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/process.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/protocol.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/proxy.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/reload.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/resource.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/response.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/services.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/services.yaml +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/settings.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/settings.yaml +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/state.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/system.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/version.py +0 -0
- {cgse_common-2025.0.3 → cgse_common-2025.0.4}/src/egse/zmq_ser.py +0 -0
|
@@ -40,6 +40,8 @@ WARNING:
|
|
|
40
40
|
from __future__ import annotations
|
|
41
41
|
|
|
42
42
|
__all__ = [
|
|
43
|
+
"get_project_name",
|
|
44
|
+
"get_site_id",
|
|
43
45
|
"get_data_storage_location",
|
|
44
46
|
"set_data_storage_location",
|
|
45
47
|
"get_data_storage_location_env_name",
|
|
@@ -164,6 +166,14 @@ def _check_no_value(var_name, value):
|
|
|
164
166
|
)
|
|
165
167
|
|
|
166
168
|
|
|
169
|
+
def get_project_name():
|
|
170
|
+
return _env.get("PROJECT") or None
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def get_site_id():
|
|
174
|
+
return _env.get("SITE_ID") or None
|
|
175
|
+
|
|
176
|
+
|
|
167
177
|
def get_data_storage_location_env_name() -> str:
|
|
168
178
|
"""Returns the name of the environment variable for the project."""
|
|
169
179
|
project = _env.get("PROJECT")
|
|
@@ -16,9 +16,9 @@ import dateutil.parser as date_parser
|
|
|
16
16
|
import numpy as np
|
|
17
17
|
from egse.config import find_files
|
|
18
18
|
from egse.env import get_data_storage_location
|
|
19
|
+
from egse.env import get_site_id
|
|
19
20
|
from egse.obsid import ObservationIdentifier
|
|
20
21
|
from egse.obsid import obsid_from_storage
|
|
21
|
-
from egse.settings import Settings
|
|
22
22
|
from egse.setup import Setup
|
|
23
23
|
from egse.setup import SetupError
|
|
24
24
|
from egse.setup import load_setup
|
|
@@ -30,8 +30,6 @@ from egse.system import time_since_epoch_1958
|
|
|
30
30
|
|
|
31
31
|
_LOGGER = logging.getLogger(__name__)
|
|
32
32
|
|
|
33
|
-
SITE_ID = Settings.load("SITE").ID
|
|
34
|
-
|
|
35
33
|
|
|
36
34
|
class TmDictionaryColumns(str, Enum):
|
|
37
35
|
""" Enumeration of the relevant columns in the TM dictionary spreadsheet.
|
|
@@ -50,7 +48,7 @@ class TmDictionaryColumns(str, Enum):
|
|
|
50
48
|
STORAGE_MNEMONIC = "Storage mnemonic"
|
|
51
49
|
CORRECT_HK_NAMES = "CAM EGSE mnemonic"
|
|
52
50
|
ORIGINAL_EGSE_HK_NAMES = "Original name in EGSE"
|
|
53
|
-
SYNOPTICS_ORIGIN = f"Origin of synoptics at {
|
|
51
|
+
SYNOPTICS_ORIGIN = f"Origin of synoptics at {get_site_id()}"
|
|
54
52
|
TIMESTAMP_NAMES = "Name of corresponding timestamp"
|
|
55
53
|
DESCRIPTION = "Description"
|
|
56
54
|
DASHBOARD = "MON screen"
|
|
@@ -120,7 +118,7 @@ def get_housekeeping(hk_name: str, obsid: Union[ObservationIdentifier, str, int]
|
|
|
120
118
|
try:
|
|
121
119
|
return _get_housekeeping_obsid(hk_name, data_dir, obsid=obsid, time_window=time_window, setup=setup)
|
|
122
120
|
except (ValueError, StopIteration, FileNotFoundError) as exc:
|
|
123
|
-
raise HKError(f"No HK found for {hk_name} for obsid {obsid} at {
|
|
121
|
+
raise HKError(f"No HK found for {hk_name} for obsid {obsid} at {get_site_id()}") from exc
|
|
124
122
|
|
|
125
123
|
# Specified OD
|
|
126
124
|
|
|
@@ -129,14 +127,14 @@ def get_housekeeping(hk_name: str, obsid: Union[ObservationIdentifier, str, int]
|
|
|
129
127
|
try:
|
|
130
128
|
return _get_housekeeping_od(hk_name, data_dir, od=od, time_window=time_window, setup=setup)
|
|
131
129
|
except (ValueError, StopIteration, FileNotFoundError) as exc:
|
|
132
|
-
raise HKError(f"No HK found for {hk_name} for OD {od} at {
|
|
130
|
+
raise HKError(f"No HK found for {hk_name} for OD {od} at {get_site_id()}") from exc
|
|
133
131
|
|
|
134
132
|
# Didn't specify neither the obsid nor the OD
|
|
135
133
|
|
|
136
134
|
try:
|
|
137
135
|
return _get_housekeeping_daily(hk_name, data_dir, time_window=time_window, setup=setup)
|
|
138
136
|
except (ValueError, StopIteration, FileNotFoundError) as exc:
|
|
139
|
-
raise HKError(f"No HK found for {hk_name} for today at {
|
|
137
|
+
raise HKError(f"No HK found for {hk_name} for today at {get_site_id()}") from exc
|
|
140
138
|
|
|
141
139
|
|
|
142
140
|
def _get_housekeeping(hk_name: str, timestamp_name: str, hk_dir: str, files, time_window: int = None):
|
|
@@ -272,7 +270,7 @@ def _get_housekeeping_od(hk_name: str, data_dir, od: str, time_window: int = Non
|
|
|
272
270
|
raise HKError(f"Cannot determine which EGSE component generated HK parameter {hk_name}")
|
|
273
271
|
|
|
274
272
|
hk_dir += f"{od}/"
|
|
275
|
-
hk_files = [f"{od}_{
|
|
273
|
+
hk_files = [f"{od}_{get_site_id()}_{origin}.csv"]
|
|
276
274
|
|
|
277
275
|
return _get_housekeeping(hk_name, timestamp_name, hk_dir, hk_files, time_window=time_window)
|
|
278
276
|
|
|
@@ -326,7 +324,7 @@ def _get_housekeeping_obsid(hk_name: str, data_dir, obsid: Union[ObservationIden
|
|
|
326
324
|
|
|
327
325
|
if len(hk_files) == 0:
|
|
328
326
|
|
|
329
|
-
raise HKError(f"No HK found for the {origin} at {
|
|
327
|
+
raise HKError(f"No HK found for the {origin} at {get_site_id()} for obsid {obsid}")
|
|
330
328
|
|
|
331
329
|
hk_files = [hk_files[-1].name]
|
|
332
330
|
|
|
@@ -387,7 +385,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
|
|
|
387
385
|
|
|
388
386
|
timestamp = datetime.datetime.now(tz=datetime.timezone.utc).strftime("%Y%m%d")
|
|
389
387
|
hk_dir += f"{timestamp}/"
|
|
390
|
-
filename = f"{timestamp}_{
|
|
388
|
+
filename = f"{timestamp}_{get_site_id()}_{origin}.csv"
|
|
391
389
|
|
|
392
390
|
timestamp_index, hk_index = get_indices(hk_dir + filename, hk_name, timestamp_name)
|
|
393
391
|
return get_last_non_empty(hk_dir + filename, timestamp_index, hk_index)
|
|
@@ -412,7 +410,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
|
|
|
412
410
|
|
|
413
411
|
# Determine which columns will be needed from which file
|
|
414
412
|
|
|
415
|
-
filename = f"{start_od}/{start_od}_{
|
|
413
|
+
filename = f"{start_od}/{start_od}_{get_site_id()}_{origin}.csv"
|
|
416
414
|
|
|
417
415
|
if Path(hk_dir + filename).exists():
|
|
418
416
|
|
|
@@ -456,7 +454,7 @@ def _get_housekeeping_daily(hk_name: str, data_dir, time_window: int = None, set
|
|
|
456
454
|
while day <= last_day:
|
|
457
455
|
|
|
458
456
|
od = f"{day.year}{day.month:02d}{day.day:02d}"
|
|
459
|
-
filename = f"{od}/{od}_{
|
|
457
|
+
filename = f"{od}/{od}_{get_site_id()}_{origin}.csv"
|
|
460
458
|
|
|
461
459
|
if Path(hk_dir + filename).exists():
|
|
462
460
|
|
|
@@ -684,7 +682,7 @@ def read_conversion_dict(storage_mnemonic: str, use_site: bool = False, setup: O
|
|
|
684
682
|
|
|
685
683
|
if use_site:
|
|
686
684
|
|
|
687
|
-
th_prefix = f"G{
|
|
685
|
+
th_prefix = f"G{get_site_id()}_"
|
|
688
686
|
|
|
689
687
|
th_conversion_dict = {}
|
|
690
688
|
|
|
@@ -237,7 +237,7 @@ def _load_pandas(resource_name: str, separator: str):
|
|
|
237
237
|
|
|
238
238
|
parts = resource_name[8:].rsplit("/", 1)
|
|
239
239
|
[in_dir, fn] = parts if len(parts) > 1 else [None, parts[0]]
|
|
240
|
-
conf_location =
|
|
240
|
+
conf_location = get_conf_data_location()
|
|
241
241
|
|
|
242
242
|
try:
|
|
243
243
|
pandas_file_location = Path(conf_location) / in_dir / fn
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|