cgse-core 0.17.2__py3-none-any.whl → 0.17.4__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.
cgse_core/_stop.py CHANGED
@@ -1,9 +1,8 @@
1
1
  import logging
2
2
  import subprocess
3
- import sys
4
- from pathlib import Path
5
3
 
6
4
  import rich
5
+ import sys
7
6
 
8
7
  from egse.log import logger
9
8
  from egse.process import is_process_running
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cgse-core
3
- Version: 0.17.2
3
+ Version: 0.17.4
4
4
  Summary: Core services for the CGSE framework
5
5
  Author: IvS KU Leuven
6
6
  Maintainer-email: Rik Huygen <rik.huygen@kuleuven.be>, Sara Regibo <sara.regibo@kuleuven.be>
@@ -1,17 +1,15 @@
1
1
  cgse_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  cgse_core/_start.py,sha256=m0JDrtEVRRmRA3nL8kQhEKq7eWiF5lf5kQ3fq9-JrkM,2126
3
3
  cgse_core/_status.py,sha256=Quz7hNtqSZPWn8xZ9ZmmF2i5hGY_bMUoybN2UNNBsHc,3259
4
- cgse_core/_stop.py,sha256=ZXTzvWjJ3bVNmNcmsP8NP5G6AHvegamyfu_cNn8qa6A,3588
4
+ cgse_core/_stop.py,sha256=MTXtnYjrqJdwPOkQ7h1Zx-C57XeXxqrL6KijYhLL6AE,3563
5
5
  cgse_core/cgse_explore.py,sha256=8jxAxYDsjPUZftUccPCneHaqijRHxBPZuaOo0ESmBUs,460
6
6
  cgse_core/services.py,sha256=_a1d1Dcf9L0F1IF3w6kHrACE5EDnqtNUd8KzrTZDu5U,8595
7
7
  cgse_core/settings.yaml,sha256=6RcZ3aI7IUSB6GaZ8e9b_JEiql0l3l7h-VowDycv5AE,3625
8
8
  egse/_setup_core.py,sha256=ei4a7tGYfDxc16kfhrF11Tm3cOSnl48MsSGfrWu0vVg,5983
9
- egse/async_control.py,sha256=V4cx89EIuohZCJEMNXiwKWQFPDWRY6Oj0w5xpo3wO3A,45274
10
- egse/async_control_claude.py,sha256=oMI_g7euQ6Z1dowmVHfijZImiB_sMQl5sHC84DMX2Fs,31609
11
9
  egse/command.py,sha256=529_T619qG3Xif9UkxZS8mj2ibr6eljfbVsMM-K_AII,21965
12
10
  egse/connect.py,sha256=QiG5G0qnCI3EeDhmfj-gBlhI9RmKvnd0dGXu0ZBIZ90,21556
13
- egse/control.py,sha256=u4bWsKNW0tl4gNMaSMyUA02xXwvcxCVe2TsdfJpTkMs,28424
14
- egse/dummy.py,sha256=VHa2Y72kXBEYUZ4ztedy2A4XXzteXGjwHeIlvmAsMIA,22503
11
+ egse/control.py,sha256=pKhQjp3YGkw8J4KyDTO3BUwBePSBJAQnfwqBPsZtpSs,28468
12
+ egse/dummy.py,sha256=N1v9bCOF3saY6J_ip2h1pbgregQNeT4YEpDIhhKUKps,22721
15
13
  egse/listener.py,sha256=kD62oD7w1yBVV0M2Eq5MNEQyVaJvlsl0RyhYCzVkgQs,6493
16
14
  egse/mixin.py,sha256=fklH61C7TtaTnXx7FQjjJCgUQ2PsQv5baw0SVBBdbH0,20265
17
15
  egse/monitoring.py,sha256=0Hbd5SHUU2YWFm8gbzlyPMUMjTezKap_q9yE4T6Vkk0,9716
@@ -22,7 +20,6 @@ egse/services.yaml,sha256=0VRxQGM0TwExJl4GEXYakWSaE9W5Tav5Og-ZV7vogto,2612
22
20
  egse/confman/__init__.py,sha256=HtLxM7u7v9mc8eJ4KTFfsWiRRAMmyvI0Blo_4Yb2nC0,39993
23
21
  egse/confman/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
22
  egse/confman/confman.yaml,sha256=CaS4potNTiy2-Qqc5Zo2Lx8c5hh4wLYhtxwifh-hP5M,3018
25
- egse/confman/confman_acs.py,sha256=Z7QfCUiAZ8tzj7ujHTpG0Kdw7VA76x-fnsWsOntHU2Y,1044
26
23
  egse/confman/confman_cs.py,sha256=JeAWC1T9RBppPVX-arWG87wS5_QrjKN8KUszQV8XBcQ,9981
27
24
  egse/icons/busy.svg,sha256=fKNR2AxNupsAga7huDQF-kEYTThMkxgqGVZvXbma0G4,2964
28
25
  egse/icons/operational-mode.svg,sha256=P6uhgnlXF5UXiJXIlpawklTcCZQePPEI5fGONtL_Y3o,5199
@@ -34,30 +31,27 @@ egse/icons/user-interface.svg,sha256=q_KWgHJ9ATdbw-HFghoaGQIBe52ZyxyAKitHpDaFWm8
34
31
  egse/logger/__init__.py,sha256=IhqNw4Yvm26Q5w7m3NuTAL8ZkywtN9dT4OaTpc3xkuo,10782
35
32
  egse/logger/__main__.py,sha256=_etegNrUM9IWHNTOObDVY1DiLn9SJyf8eHktVBbN-OQ,1765
36
33
  egse/logger/log_cs.py,sha256=3k-HUnfrJY2072cjF0TXBv9TyNd4GzCSzazx03zfJss,14296
37
- egse/metricshub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
- egse/metricshub/server.py,sha256=2arZ2OOsc7L3_tHnpXNw91joYnVo1nxzqLFuwO-GSzM,8780
39
34
  egse/notifyhub/__init__.py,sha256=pbCy5PHSR7OKcD1heaMIDO6ztkyFlpsvc-i2pyOdCpU,2438
40
35
  egse/notifyhub/client.py,sha256=VOFlxcotEm3JAe5eGMDXpCRejXzDb3-7k4gIPgcgmpY,10536
41
36
  egse/notifyhub/event.py,sha256=Yo8uvnK27uzaCLjJa8IK734Hcg3eLuD_KCd7eZ80XBQ,792
42
37
  egse/notifyhub/server.py,sha256=XW4lbmz1IUhhPUB3frbgvAWUyAXZy1Wr1ofC10vAoM0,14553
43
38
  egse/notifyhub/services.py,sha256=LpKxJfFszwoQN9Kb5f5lkjjKLbvwCfHSC2mt1WZt1wc,10494
44
- egse/notifyhub/test.py,sha256=61-hEii3KUho_nheTz6zCuUvQtIPZ_zZWt3Gpxmhk8g,9922
45
39
  egse/procman/__init__.py,sha256=w2ilHHVuznkNCK-Syd9WVayktW8um8_EsKF5JQJDZK0,13946
46
40
  egse/procman/procman.yaml,sha256=miAq3GE4PSKm8QZDfjvmtBrYCt8GyzJDJm-JzzgdznQ,847
47
- egse/procman/procman_cs.py,sha256=lvuhmGdd1GmkdkXYNS9slNT9VJF09OtffZrZmCdy97I,5390
41
+ egse/procman/procman_cs.py,sha256=2FxpDI4h-3312rt84J4rcX1QNBFFst0Q1cLy5Hex3ro,5381
48
42
  egse/procman/procman_protocol.py,sha256=kFUWQb66d5aDE7qHM9xYmsO07UB-6ro2hJ-E7o_OPlE,3778
49
- egse/procman/procman_ui.py,sha256=5pU4-Dtma5aY8k4PaHQpJUe-DSwjpP-V1sJpbuUMlLg,42070
43
+ egse/procman/procman_ui.py,sha256=IzusnQymoBsiQ50lCH7gopbmNoevotC2vmRCeTTR1F8,42184
50
44
  egse/registry/__init__.py,sha256=U7ap_245Bid74nn7Ncd0GXu0aetR95dJHltGRwBCVb8,1349
51
45
  egse/registry/backend.py,sha256=-kRXncO949YETb1S2GFedhYTt1O0teiKYUUPxeQqX9E,22120
52
- egse/registry/client.py,sha256=VR6v-IRVpY3lUB8IGIZcfLAj6PhwakZNBuX7QPYxzxY,43165
53
- egse/registry/server.py,sha256=-5f-6Rk-z-sBCmDXxHZos7u_e4P0VqsLU5av0qITnzU,22291
46
+ egse/registry/client.py,sha256=InUttsnCUDUjWHyFQ5RFAUckmFo8deQOdFshXcUVubs,43395
47
+ egse/registry/server.py,sha256=MTBS-f0kXtxgpxJWGtUNklZL405WEokS4rp_JpmIqQE,22296
54
48
  egse/registry/service.py,sha256=r6ThO_ur9WyFb_9JkpE__C5Y2P3VAeK8j_w9SFHiIBw,15375
55
49
  egse/storage/__init__.py,sha256=xtMdHdtPT9-oqTp2bpWw7Os3qUgN8TdqZNuaj3glxn0,43147
56
50
  egse/storage/__main__.py,sha256=LI9fxlsFWmEd5LcWUB0xA8i7Yt6UHgnblB4G0aTi3pI,28
57
51
  egse/storage/persistence.py,sha256=35fvuCPuGTSCc2MfmFLLNU03xYq3CEaJQspot4f-Pvw,18274
58
52
  egse/storage/storage.yaml,sha256=l3HtPx_bAbXoV4f3_PXWAa1tP-fY2S6roSBSBiOHodE,2712
59
53
  egse/storage/storage_cs.py,sha256=172llnKef1fdiDXcnzYllw_q12bVyuGJGh_3XpeDVCU,7377
60
- cgse_core-0.17.2.dist-info/METADATA,sha256=JLHz7fbDXX5hP1Q9651n2oVnQy7ZZ4rmbu886KhMZ0s,582
61
- cgse_core-0.17.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
62
- cgse_core-0.17.2.dist-info/entry_points.txt,sha256=IwIG7aGgfUehol29ufcKd559S88t3TJdh1LMJ5YymCE,976
63
- cgse_core-0.17.2.dist-info/RECORD,,
54
+ cgse_core-0.17.4.dist-info/METADATA,sha256=PXVDvD8f0HKRijUPFn_fq2Kt42FYPTE3oI9EyMbujCA,582
55
+ cgse_core-0.17.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
56
+ cgse_core-0.17.4.dist-info/entry_points.txt,sha256=IwIG7aGgfUehol29ufcKd559S88t3TJdh1LMJ5YymCE,976
57
+ cgse_core-0.17.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
egse/control.py CHANGED
@@ -558,7 +558,8 @@ class ControlServer(metaclass=abc.ABCMeta):
558
558
  try:
559
559
  hk_dict = save_average_execution_time(self.device_protocol.get_housekeeping)
560
560
 
561
- self.store_housekeeping_information(hk_dict)
561
+ if storage_manager:
562
+ self.store_housekeeping_information(hk_dict)
562
563
  self.propagate_metrics(hk_dict)
563
564
  except Exception as exc:
564
565
  logger.error(
egse/dummy.py CHANGED
@@ -18,9 +18,9 @@ and stop the server with:
18
18
 
19
19
  Commands that can be used with the proxy:
20
20
 
21
- * info returns an info message from the dummy device, e.g. "Dummy Device <__version__>"
22
- * get_value returns a random float between 0.0 and 1.0
23
- * division returns the result of the division between arguments 'a' and 'b'.
21
+ * info - returns an info message from the dummy device, e.g. "Dummy Device <__version__>"
22
+ * get_value - returns a random float between 0.0 and 1.0
23
+ * division - returns the result of the division between arguments 'a' and 'b'.
24
24
  This can be used also to induce a ZeroDivisionError that should return a Failure
25
25
  object.
26
26
 
@@ -318,11 +318,10 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
318
318
  Args:
319
319
  hostname (str): the IP address or fully qualified hostname of the Dummy Device
320
320
  controller.
321
-
322
321
  port (int): the IP port number to connect to.
323
322
  """
324
323
 
325
- def __init__(self, hostname: str = None, port: int = None):
324
+ def __init__(self, hostname: str | None = None, port: int | None = None):
326
325
  super().__init__()
327
326
 
328
327
  # Basic connection settings, loaded from the configuration YAML file
@@ -359,7 +358,8 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
359
358
  try:
360
359
  self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
361
360
  except socket.error as exc:
362
- self.sock.close()
361
+ if self.sock is not None:
362
+ self.sock.close()
363
363
  raise DeviceConnectionError("Dummy Device", "Failed to create socket.") from exc
364
364
 
365
365
  # Attempt to establish a connection to the remote host
@@ -412,7 +412,8 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
412
412
  """
413
413
  try:
414
414
  logger.debug(f"Disconnecting from {self.hostname}")
415
- self.sock.close()
415
+ if self.sock is not None:
416
+ self.sock.close()
416
417
  self.is_connection_open = False
417
418
  except Exception as exc:
418
419
  raise DeviceConnectionError(DEV_NAME, f"Could not close socket to {self.hostname}") from exc
@@ -448,6 +449,8 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
448
449
  buf_size = 1024 * 10
449
450
  response = bytes()
450
451
 
452
+ assert self.sock is not None
453
+
451
454
  # Set a timeout of READ_TIMEOUT to the socket.recv
452
455
 
453
456
  saved_timeout = self.sock.gettimeout()
@@ -487,6 +490,8 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
487
490
  there was a socket related error.
488
491
  """
489
492
 
493
+ assert self.sock is not None
494
+
490
495
  # logger.debug(f"{command.encode() = }")
491
496
 
492
497
  try:
@@ -514,6 +519,9 @@ class DummyDeviceEthernetInterface(DeviceConnectionInterface, DeviceTransport):
514
519
  DeviceTimeoutError: when the sendall() timed out, and a DeviceConnectionError if
515
520
  there was a socket related error.
516
521
  """
522
+
523
+ assert self.sock is not None
524
+
517
525
  # logger.debug(f"{command.encode() = }")
518
526
 
519
527
  try:
@@ -657,7 +665,8 @@ def process_command(command_string: str) -> str | None:
657
665
 
658
666
  try:
659
667
  action, response = COMMAND_ACTIONS_RESPONSES[command_string]
660
- action and action()
668
+ if action:
669
+ action()
661
670
  if error_msg:
662
671
  return error_msg
663
672
  else:
@@ -154,7 +154,7 @@ def stop():
154
154
 
155
155
  if COMMANDING_PORT == 0:
156
156
  with RegistryClient() as reg:
157
- service = reg.discover_service(settings.SERVICE_TYPE)
157
+ service = reg.discover_service(SERVICE_TYPE)
158
158
  rich.print("service = ", service)
159
159
  if service:
160
160
  hostname = service["host"]
@@ -44,6 +44,9 @@ from egse.zmq_ser import set_address_port
44
44
 
45
45
  MAX_SLEEP = 10
46
46
 
47
+ DEVICE_CMD_ENTRY_POINT = "cgse.service.device_command"
48
+ GUI_SCRIPTS_ENTRY_POINT = "gui_scripts"
49
+
47
50
 
48
51
  class ControlServerStatus(Enum):
49
52
  """Status of the Control Server of a device."""
@@ -78,7 +81,7 @@ def get_cgse_cmd(device_proxy: str) -> str:
78
81
 
79
82
  module_name = device_proxy[7:].rsplit(".", 1)[0]
80
83
  entry_point_values = []
81
- for ep in sorted(entry_points("cgse.service"), key=lambda x: x.name):
84
+ for ep in sorted(entry_points(DEVICE_CMD_ENTRY_POINT), key=lambda x: x.name):
82
85
  entry_point_values.append(ep.value)
83
86
 
84
87
  similarity_scores = [
@@ -108,7 +111,7 @@ def get_cgse_ui(device_proxy: str) -> Union[str, None]:
108
111
 
109
112
  module_name = device_proxy[7:].rsplit(".", 1)[0]
110
113
  entry_point_values = []
111
- for ep in sorted(entry_points("gui_scripts"), key=lambda x: x.name):
114
+ for ep in sorted(entry_points(GUI_SCRIPTS_ENTRY_POINT), key=lambda x: x.name):
112
115
  entry_point_values.append(ep.name)
113
116
 
114
117
  similarity_scores = [
egse/registry/client.py CHANGED
@@ -898,7 +898,8 @@ class AsyncRegistryClient:
898
898
  """Stop the running heartbeat task."""
899
899
 
900
900
  if self._heartbeat_task is None:
901
- VERBOSE_DEBUG and self.logger.debug("Couldn't stop heartbeat, heartbeat_task is None")
901
+ if VERBOSE_DEBUG:
902
+ self.logger.debug("Couldn't stop heartbeat, heartbeat_task is None")
902
903
  return
903
904
 
904
905
  self._heartbeat_task.cancel()
@@ -915,7 +916,8 @@ class AsyncRegistryClient:
915
916
  """Stop the running event listener task."""
916
917
 
917
918
  if self._event_listener_task is None:
918
- VERBOSE_DEBUG and self.logger.debug("Couldn't stop event_listener, event_listener_task is None")
919
+ if VERBOSE_DEBUG:
920
+ self.logger.debug("Couldn't stop event_listener, event_listener_task is None")
919
921
  return
920
922
 
921
923
  self._event_listener_task.cancel()
@@ -1148,12 +1150,14 @@ class AsyncRegistryClient:
1148
1150
  self.sub_socket.close()
1149
1151
 
1150
1152
  # We can not terminate the context, because we use a global instance, i.e. a singleton context.
1151
- # When we try to terminate it, even after checking if it was closed,
1153
+ # When we try to terminate it, even after checking if it was closed, it raises an exception.
1152
1154
  if hasattr(self, "context") and self.context:
1153
1155
  self.logger.info(f"{self.context = !r}")
1154
1156
  self.logger.info(f"{self.context._sockets = !r}")
1157
+ # The zmq context instance is the global singleton instance.
1158
+ # Terminating it here would affect other parts of the application using zmq.
1155
1159
  # if not self.context.closed:
1156
- # self.context.term()
1160
+ # self.context.term()
1157
1161
  except Exception as exc:
1158
1162
  self.logger.error(f"Error during cleanup: {exc}")
1159
1163
 
egse/registry/server.py CHANGED
@@ -226,10 +226,10 @@ class AsyncRegistryServer:
226
226
  try:
227
227
  # Wait for a request with timeout to allow checking if still running
228
228
  try:
229
- self.logger.info("Waiting for a request with 1s timeout...")
229
+ # self.logger.debug("Waiting for a request with 1s timeout...")
230
230
  message_parts = await asyncio.wait_for(self.req_socket.recv_multipart(), timeout=1.0)
231
231
  except asyncio.TimeoutError:
232
- self.logger.debug("waiting for command request...")
232
+ # self.logger.debug("waiting for command request...")
233
233
  continue
234
234
 
235
235
  if len(message_parts) >= 3: