bec-ipython-client 3.78.1__tar.gz → 3.79.0__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.
Files changed (40) hide show
  1. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/PKG-INFO +1 -1
  2. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/pyproject.toml +1 -1
  3. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/end-2-end/test_procedures_e2e.py +26 -17
  4. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/.gitignore +0 -0
  5. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/__init__.py +0 -0
  6. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/beamline_mixin.py +0 -0
  7. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/bec_magics.py +0 -0
  8. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/bec_startup.py +0 -0
  9. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/__init__.py +0 -0
  10. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/device_progress.py +0 -0
  11. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/ipython_live_updates.py +0 -0
  12. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/live_table.py +0 -0
  13. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/move_device.py +0 -0
  14. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/callbacks/utils.py +0 -0
  15. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/high_level_interfaces/__init__.py +0 -0
  16. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/high_level_interfaces/bec_hli.py +0 -0
  17. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/high_level_interfaces/spec_hli.py +0 -0
  18. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/main.py +0 -0
  19. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/SLS/__init__.py +0 -0
  20. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/SLS/sls_info.py +0 -0
  21. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/XTreme/__init__.py +0 -0
  22. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/XTreme/x-treme.py +0 -0
  23. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/__init__.py +0 -0
  24. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/plugins/flomni/flomni_config.yaml +0 -0
  25. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/prettytable.py +0 -0
  26. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/progressbar.py +0 -0
  27. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/bec_ipython_client/signals.py +0 -0
  28. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/demo.py +0 -0
  29. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/conftest.py +0 -0
  30. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_beamline_mixins.py +0 -0
  31. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_bec_client.py +0 -0
  32. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_device_progress.py +0 -0
  33. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_ipython_live_updates.py +0 -0
  34. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_live_table.py +0 -0
  35. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_move_callback.py +0 -0
  36. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/client_tests/test_pretty_table.py +0 -0
  37. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/conftest.py +0 -0
  38. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/end-2-end/_ensure_requirements_container.py +0 -0
  39. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/end-2-end/test_scans_e2e.py +0 -0
  40. {bec_ipython_client-3.78.1 → bec_ipython_client-3.79.0}/tests/end-2-end/test_scans_lib_e2e.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_ipython_client
3
- Version: 3.78.1
3
+ Version: 3.79.0
4
4
  Summary: BEC IPython client
5
5
  Project-URL: Bug Tracker, https://github.com/bec-project/bec/issues
6
6
  Project-URL: Homepage, https://github.com/bec-project/bec
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_ipython_client"
7
- version = "3.78.1"
7
+ version = "3.79.0"
8
8
  description = "BEC IPython client"
9
9
  requires-python = ">=3.11"
10
10
  classifiers = [
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import time
4
+ from dataclasses import dataclass
4
5
  from importlib.metadata import version
5
6
  from typing import TYPE_CHECKING, Callable, Generator
6
7
  from unittest.mock import MagicMock, patch
@@ -11,7 +12,7 @@ from bec_ipython_client.main import BECIPythonClient
11
12
  from bec_lib import messages
12
13
  from bec_lib.endpoints import MessageEndpoints
13
14
  from bec_lib.logger import bec_logger
14
- from bec_server.scan_server.procedures.constants import PROCEDURE
15
+ from bec_server.scan_server.procedures.constants import _CONTAINER, _WORKER
15
16
  from bec_server.scan_server.procedures.container_utils import get_backend
16
17
  from bec_server.scan_server.procedures.container_worker import ContainerProcedureWorker
17
18
  from bec_server.scan_server.procedures.manager import ProcedureManager
@@ -28,6 +29,15 @@ logger = bec_logger.logger
28
29
  pytestmark = pytest.mark.random_order(disabled=True)
29
30
 
30
31
 
32
+ @dataclass(frozen=True)
33
+ class PATCHED_CONSTANTS:
34
+ WORKER = _WORKER()
35
+ CONTAINER = _CONTAINER()
36
+ MANAGER_SHUTDOWN_TIMEOUT_S = 2
37
+ BEC_VERSION = version("bec_lib")
38
+ REDIS_HOST = "localhost"
39
+
40
+
31
41
  @pytest.fixture
32
42
  def client_logtool_and_manager(
33
43
  bec_ipython_client_fixture_with_logtool: tuple[BECIPythonClient, "LogTestTool"],
@@ -52,7 +62,7 @@ def _wait_while(cond: Callable[[], bool], timeout_s):
52
62
  def test_building_worker_image():
53
63
  podman_utils = get_backend()
54
64
  build = podman_utils.build_worker_image()
55
- assert len(build._command_output.splitlines()[-1]) == 64
65
+ assert len(build._command_output.splitlines()[-1]) == 64 # type: ignore
56
66
  assert podman_utils.image_exists(f"bec_procedure_worker:v{version('bec_lib')}")
57
67
 
58
68
 
@@ -62,7 +72,7 @@ def test_procedure_runner_spawns_worker(
62
72
  client_logtool_and_manager: tuple[BECIPythonClient, "LogTestTool", ProcedureManager],
63
73
  ):
64
74
  client, _, manager = client_logtool_and_manager
65
- assert manager.active_workers == {}
75
+ assert manager._active_workers == {}
66
76
  endpoint = MessageEndpoints.procedure_request()
67
77
  msg = messages.ProcedureRequestMessage(
68
78
  identifier="sleep", args_kwargs=((), {"time_s": 2}), queue="test"
@@ -77,21 +87,22 @@ def test_procedure_runner_spawns_worker(
77
87
  manager.add_callback("test", cb)
78
88
  client.connector.xadd(topic=endpoint, msg_dict=msg.model_dump())
79
89
 
80
- _wait_while(lambda: manager.active_workers == {}, 5)
81
- _wait_while(lambda: manager.active_workers != {}, 20)
90
+ _wait_while(lambda: manager._active_workers == {}, 5)
91
+ _wait_while(lambda: manager._active_workers != {}, 20)
82
92
 
83
93
  assert logs != []
84
94
 
85
95
 
86
96
  @pytest.mark.timeout(100)
87
97
  @patch("bec_server.scan_server.procedures.manager.procedure_registry.is_registered", lambda _: True)
98
+ @patch("bec_server.scan_server.procedures.container_worker.PROCEDURE", PATCHED_CONSTANTS())
88
99
  def test_happy_path_container_procedure_runner(
89
100
  client_logtool_and_manager: tuple[BECIPythonClient, "LogTestTool", ProcedureManager],
90
101
  ):
91
102
  test_args = (1, 2, 3)
92
103
  test_kwargs = {"a": "b", "c": "d"}
93
104
  client, logtool, manager = client_logtool_and_manager
94
- assert manager.active_workers == {}
105
+ assert manager._active_workers == {}
95
106
  conn = client.connector
96
107
  endpoint = MessageEndpoints.procedure_request()
97
108
  msg = messages.ProcedureRequestMessage(
@@ -99,12 +110,15 @@ def test_happy_path_container_procedure_runner(
99
110
  )
100
111
  conn.xadd(topic=endpoint, msg_dict=msg.model_dump())
101
112
 
102
- _wait_while(lambda: manager.active_workers == {}, 5)
103
- _wait_while(lambda: manager.active_workers != {}, 20)
113
+ _wait_while(lambda: manager._active_workers == {}, 5)
114
+ _wait_while(lambda: manager._active_workers != {}, 20)
104
115
 
105
116
  logtool.fetch()
106
117
  assert logtool.is_present_in_any_message("procedure accepted: True, message:")
107
- assert logtool.is_present_in_any_message("ContainerWorker started container for queue primary")
118
+ assert logtool.is_present_in_any_message(
119
+ "ContainerWorker started container for queue primary"
120
+ ), f"Log content relating to procedures: {manager._logs}"
121
+
108
122
  res, msg = logtool.are_present_in_order(
109
123
  [
110
124
  "Container worker 'primary' status update: IDLE",
@@ -114,12 +128,7 @@ def test_happy_path_container_procedure_runner(
114
128
  ]
115
129
  )
116
130
  assert res, f"failed on {msg}"
117
- res, msg = logtool.are_present_in_order(
118
- [
119
- "Container worker 'primary' status update: IDLE",
120
- f"Builtin procedure log_message_args_kwargs called with args: {test_args} and kwargs: {test_kwargs}",
121
- "Container worker 'primary' status update: IDLE",
122
- "Container worker 'primary' status update: FINISHED",
123
- ]
131
+
132
+ assert logtool.is_present_in_any_message(
133
+ f"Builtin procedure log_message_args_kwargs called with args: {test_args} and kwargs: {test_kwargs}"
124
134
  )
125
- assert res, f"failed on {msg}"