mxcubecore 1.387.0__py3-none-any.whl → 1.389.0__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.
Potentially problematic release.
This version of mxcubecore might be problematic. Click here for more details.
- mxcubecore/HardwareRepository.py +29 -2
- mxcubecore/__init__.py +22 -3
- {mxcubecore-1.387.0.dist-info → mxcubecore-1.389.0.dist-info}/METADATA +1 -1
- {mxcubecore-1.387.0.dist-info → mxcubecore-1.389.0.dist-info}/RECORD +7 -7
- {mxcubecore-1.387.0.dist-info → mxcubecore-1.389.0.dist-info}/COPYING +0 -0
- {mxcubecore-1.387.0.dist-info → mxcubecore-1.389.0.dist-info}/COPYING.LESSER +0 -0
- {mxcubecore-1.387.0.dist-info → mxcubecore-1.389.0.dist-info}/WHEEL +0 -0
mxcubecore/HardwareRepository.py
CHANGED
|
@@ -79,7 +79,11 @@ _instance = None
|
|
|
79
79
|
TIMERS = []
|
|
80
80
|
|
|
81
81
|
beamline = None
|
|
82
|
-
|
|
82
|
+
#
|
|
83
|
+
# Supported beamline configuration filenames.
|
|
84
|
+
# The first name in the list takes precedence.
|
|
85
|
+
#
|
|
86
|
+
BEAMLINE_CONFIG_FILES = ["beamline.yaml", "beamline_config.yml"]
|
|
83
87
|
|
|
84
88
|
|
|
85
89
|
def load_from_yaml(
|
|
@@ -394,8 +398,16 @@ def init_hardware_repository(
|
|
|
394
398
|
logging.getLogger("HWR").info("Hardware repository: %s", configuration_path)
|
|
395
399
|
_instance = __HardwareRepositoryClient(configuration_path)
|
|
396
400
|
_instance.connect()
|
|
401
|
+
|
|
402
|
+
beamline_config_file = _instance.find_beamline_config_file()
|
|
403
|
+
if beamline_config_file.endswith(".yml"):
|
|
404
|
+
warn( # noqa: B028 we don't care about stacklevel for this warning
|
|
405
|
+
f"Config file '{beamline_config_file}' have deprecated extension 'yml', "
|
|
406
|
+
"change to 'yaml'."
|
|
407
|
+
)
|
|
408
|
+
|
|
397
409
|
beamline = load_from_yaml(
|
|
398
|
-
|
|
410
|
+
beamline_config_file,
|
|
399
411
|
role="beamline",
|
|
400
412
|
yaml_export_directory=yaml_export_directory,
|
|
401
413
|
)
|
|
@@ -455,6 +467,21 @@ class __HardwareRepositoryClient:
|
|
|
455
467
|
finally:
|
|
456
468
|
self.__connected = True
|
|
457
469
|
|
|
470
|
+
def find_beamline_config_file(self) -> str | None:
|
|
471
|
+
"""Find beamline configuration file name.
|
|
472
|
+
|
|
473
|
+
Look in the repository paths for beamline config file.
|
|
474
|
+
|
|
475
|
+
Returns:
|
|
476
|
+
The found config file name, or None if not found.
|
|
477
|
+
"""
|
|
478
|
+
for file_name in BEAMLINE_CONFIG_FILES:
|
|
479
|
+
file = self.find_in_repository(file_name)
|
|
480
|
+
if file is not None:
|
|
481
|
+
return Path(file).name
|
|
482
|
+
|
|
483
|
+
return None
|
|
484
|
+
|
|
458
485
|
def find_in_repository(self, relative_path):
|
|
459
486
|
"""Finds absolute path of a file or directory matching relativePath
|
|
460
487
|
in one of the hardwareRepository directories
|
mxcubecore/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@ import functools
|
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
6
|
import sys
|
|
7
|
+
import time
|
|
7
8
|
from logging.handlers import RotatingFileHandler
|
|
8
9
|
|
|
9
10
|
from colorama import (
|
|
@@ -50,9 +51,10 @@ def trace_call_log(_func=None, *, level: int = logging.DEBUG):
|
|
|
50
51
|
" HardwareObject instance's methods only"
|
|
51
52
|
)
|
|
52
53
|
raise TypeError(err_msg)
|
|
54
|
+
|
|
53
55
|
args = list(args)
|
|
54
56
|
self = args.pop(0)
|
|
55
|
-
|
|
57
|
+
|
|
56
58
|
# Remove named parameters which are not in the signature of the method
|
|
57
59
|
code_obj = func.__code__
|
|
58
60
|
kwargs = {
|
|
@@ -61,13 +63,30 @@ def trace_call_log(_func=None, *, level: int = logging.DEBUG):
|
|
|
61
63
|
if k in code_obj.co_varnames[: code_obj.co_argcount]
|
|
62
64
|
}
|
|
63
65
|
|
|
66
|
+
hwo_name = f" ({self.name.strip('/')})" if self.name else ""
|
|
64
67
|
args_str = ",".join([str(arg) for arg in args])
|
|
65
68
|
kwargs_str = ",".join(["%s=%s" % (k, v) for k, v in kwargs.items()])
|
|
66
69
|
params_str = f"{args_str}{', ' if args and kwargs else ''}{kwargs_str}"
|
|
67
70
|
method_name = func.__name__
|
|
68
71
|
signature = f"{method_name}({params_str})"
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
|
|
73
|
+
t0 = time.time()
|
|
74
|
+
try:
|
|
75
|
+
result = func(self, *args, **kwargs)
|
|
76
|
+
except Exception:
|
|
77
|
+
self.log.log(
|
|
78
|
+
level,
|
|
79
|
+
f"{hwo_name} In {signature} -> ! Raise exception ! "
|
|
80
|
+
f"[Execution time: {time.time() - t0} sec]",
|
|
81
|
+
)
|
|
82
|
+
raise
|
|
83
|
+
else:
|
|
84
|
+
self.log.log(
|
|
85
|
+
level,
|
|
86
|
+
f"{hwo_name} In {signature} -> {result} "
|
|
87
|
+
f"[Execution time: {time.time() - t0} sec]",
|
|
88
|
+
)
|
|
89
|
+
return result
|
|
71
90
|
|
|
72
91
|
return fun_wrapper
|
|
73
92
|
|
|
@@ -427,10 +427,10 @@ mxcubecore/HardwareObjects/mockup/XrayCentringMockup.py,sha256=b7LTjBL_1EhX4H4CX
|
|
|
427
427
|
mxcubecore/HardwareObjects/mockup/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
428
428
|
mxcubecore/HardwareObjects/mockup/sample.jpg,sha256=7ztjjtAk5c0T2lmJOySAyXjJFFUklKLJnAv4NqdL1y8,81093
|
|
429
429
|
mxcubecore/HardwareObjects/sample_centring.py,sha256=iAIZn5UiBsxuZMVxtZtAleRRqjcZnUoMT71Mvutn7ng,18922
|
|
430
|
-
mxcubecore/HardwareRepository.py,sha256=
|
|
430
|
+
mxcubecore/HardwareRepository.py,sha256=9ndIfoHBbzAXj2k28YHnldJ4iqFYcTdITbAo0EkPe48,38533
|
|
431
431
|
mxcubecore/Poller.py,sha256=ImsmlvJVutzJSix3Pvr_DNUcPQJZcDSI-LwESjji0rA,5654
|
|
432
432
|
mxcubecore/TaskUtils.py,sha256=nheMRSsNuYnbH-2yKTPdb1ua6UYAdYBXcYqbDiIHCEY,3891
|
|
433
|
-
mxcubecore/__init__.py,sha256=
|
|
433
|
+
mxcubecore/__init__.py,sha256=C9iqd79UY9AVijPg0xBKodGkG0g_G0-YJH5fP2ktaoQ,4813
|
|
434
434
|
mxcubecore/__version__.py,sha256=1McIKkf_3i3aywS_FJiFvAWjVJ8DxAY2V6j_kvGC1m8,945
|
|
435
435
|
mxcubecore/dispatcher.py,sha256=LL3SZtn9M1aTBYTqYWkTCzlw7iiMyF3VsTIZ-oi0e60,1567
|
|
436
436
|
mxcubecore/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -467,8 +467,8 @@ mxcubecore/utils/conversion.py,sha256=G1bk2Mi2ZwGbZa5pEeiFaKWxhSVXVGqu1L9_SioyUO
|
|
|
467
467
|
mxcubecore/utils/qt_import.py,sha256=0lPmqok_oYQZ059kJCq7RWdg490T8YKyRvoZGyWDy4M,14486
|
|
468
468
|
mxcubecore/utils/tango.py,sha256=vwEVrIrWKEFaeaJUz3xbaC7XWHY8ZeJ-pfcSrTfZPIE,2114
|
|
469
469
|
mxcubecore/utils/units.py,sha256=Gh7ovTUN00XBMUoyDG5W7akCx1pROL-M6pK2z1ouemg,1361
|
|
470
|
-
mxcubecore-1.
|
|
471
|
-
mxcubecore-1.
|
|
472
|
-
mxcubecore-1.
|
|
473
|
-
mxcubecore-1.
|
|
474
|
-
mxcubecore-1.
|
|
470
|
+
mxcubecore-1.389.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
|
|
471
|
+
mxcubecore-1.389.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
|
|
472
|
+
mxcubecore-1.389.0.dist-info/METADATA,sha256=DLdn2P8xIB3ITPJRy87F2gtrRESC1JuNYY_0EXwCIg8,4259
|
|
473
|
+
mxcubecore-1.389.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
474
|
+
mxcubecore-1.389.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|