mxcubecore 1.377.0__py3-none-any.whl → 1.379.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.

@@ -41,7 +41,6 @@ from py4j import (
41
41
  clientserver,
42
42
  java_gateway,
43
43
  )
44
- from py4j.protocol import Py4JJavaError
45
44
 
46
45
  from mxcubecore import HardwareRepository as HWR
47
46
  from mxcubecore.BaseHardwareObjects import (
@@ -96,7 +95,7 @@ class GphlWorkflowConnection(HardwareObject):
96
95
  super().__init__(name)
97
96
  # Py4J gateway to external workflow program
98
97
  self._gateway = None
99
- self.msg_class_imported = False
98
+ self.jvm_imports_checked = False
100
99
 
101
100
  # ID for current workflow calculation
102
101
  self._enactment_id = None
@@ -221,7 +220,7 @@ class GphlWorkflowConnection(HardwareObject):
221
220
  # so we are never in state 'ON'/STANDBY
222
221
  raise RuntimeError("Workflow is already running, cannot be started")
223
222
 
224
- self.msg_class_imported = False
223
+ self.jvm_imports_checked = False
225
224
 
226
225
  # Cannot be done in init, where the api.sessions link is not yet ready
227
226
  self.config.software_paths["GPHL_WDIR"] = os.path.join(
@@ -479,30 +478,36 @@ class GphlWorkflowConnection(HardwareObject):
479
478
  if self.get_state() is self.STATES.OFF:
480
479
  return None
481
480
 
482
- if not self.msg_class_imported:
483
- # Guard agaiunst Java classes being moved to different packages
484
- try:
485
- msg_class = (
486
- self._gateway.jvm.py4j.reflection.ReflectionUtil.classForName(
487
- "co.gphl.sdcp.astra.service.py4j.Py4jMessage"
488
- )
481
+ if not self.jvm_imports_checked:
482
+ # We need to use dir to check for the presence or absence of an imported
483
+ # class. hasattr/getattr don't do what is needed here, because if the
484
+ # attribute name is not present java_gateway receives proto.SUCCESS_PACKAGE
485
+ # from the Java side and instantiates a JavaPackage with the name, even
486
+ # though no such package exists in the JVM. See:
487
+ # https://github.com/py4j/py4j/blob/cb9e392d8fc5bec6b99a612e2911017900061628/py4j-python/src/py4j/java_gateway.py#L1748
488
+ # This looks like a py4j bug on the Java side but needs more investigation.
489
+
490
+ # The Py4jMessage class is used as the indicator class here: we assume that
491
+ # if it has been imported, all other unqualified Java classnames used via
492
+ # the default JVM view have been imported, otherwise none of them have been
493
+ # imported and we need to do it here.
494
+ if "Py4jMessage" not in dir(self._gateway.jvm):
495
+ for qualified_class_name in (
496
+ "co.gphl.sdcp.astra.service.py4j.Py4jMessage",
497
+ "co.gphl.beamline.v2_unstable.instrumentation.CentringStatus",
498
+ "co.gphl.beamline.v2_unstable.domain_types.CrystalClass",
499
+ "co.gphl.beamline.v2_unstable.domain_types.ChemicalElement",
500
+ "co.gphl.beamline.v2_unstable.domain_types.AbsorptionEdge",
501
+ ):
502
+ java_gateway.java_import(self._gateway.jvm, qualified_class_name)
503
+ logging.getLogger("HWR").warning(
504
+ "Importing required unqualified class names from the JVM explicitly"
489
505
  )
490
- java_gateway.java_import(
491
- self._gateway.jvm, "co.gphl.sdcp.astra.service.py4j.Py4jMessage"
492
- )
493
- except Py4JJavaError:
494
- msg_class = (
495
- self._gateway.jvm.py4j.reflection.ReflectionUtil.classForName(
496
- "co.gphl.sdcp.py4j.Py4jMessage"
497
- )
506
+ logging.getLogger("HWR").warning(
507
+ "Please consider upgrading the GPhL workflow application"
498
508
  )
499
- java_gateway.java_import(
500
- self._gateway.jvm, "co.gphl.sdcp.py4j.Py4jMessage"
501
- )
502
- logging.getLogger("HWR").debug(
503
- "GΦL workflow Py4jMessage class is: %s" % msg_class
504
- )
505
- self.msg_class_imported = True
509
+
510
+ self.jvm_imports_checked = True
506
511
 
507
512
  xx0 = self._decode_py4j_message(py4j_message)
508
513
  message_type = xx0.message_type
@@ -923,9 +928,7 @@ class GphlWorkflowConnection(HardwareObject):
923
928
  py4j_payload = self._payload_to_java(payload)
924
929
 
925
930
  try:
926
- response = self._gateway.jvm.co.gphl.sdcp.astra.service.py4j.Py4jMessage(
927
- py4j_payload, correlation_id
928
- )
931
+ response = self._gateway.jvm.Py4jMessage(py4j_payload, correlation_id)
929
932
  except:
930
933
  self.abort_workflow(
931
934
  message="Error creating Java message (%s) to send to workflow"
@@ -938,9 +941,7 @@ class GphlWorkflowConnection(HardwareObject):
938
941
  def _CentringDone_to_java(self, centringDone):
939
942
  jvm = self._gateway.jvm
940
943
  return jvm.astra.messagebus.messages.information.CentringDoneImpl(
941
- jvm.co.gphl.beamline.v2_unstable.instrumentation.CentringStatus.valueOf(
942
- centringDone.status
943
- ),
944
+ jvm.CentringStatus.valueOf(centringDone.status),
944
945
  self.to_java_time(centringDone.timestamp),
945
946
  self._GoniostatTranslation_to_java(centringDone.goniostatTranslation),
946
947
  )
@@ -1042,9 +1043,7 @@ class GphlWorkflowConnection(HardwareObject):
1042
1043
  crystal_classes = selectedLattice.userCrystalClasses
1043
1044
  if crystal_classes:
1044
1045
  ccset = set(
1045
- jvm.co.gphl.beamline.v2_unstable.domain_types.CrystalClass.fromStringList(
1046
- self.toJStringArray(crystal_classes)
1047
- )
1046
+ jvm.CrystalClass.fromStringList(self.toJStringArray(crystal_classes))
1048
1047
  )
1049
1048
  builder = builder.userCrystalClasses(ccset)
1050
1049
  urlstrings = selectedLattice.referenceReflectionFiles
@@ -1093,9 +1092,7 @@ class GphlWorkflowConnection(HardwareObject):
1093
1092
  crystal_classes = userProvidedInfo.crystalClasses
1094
1093
  if crystal_classes:
1095
1094
  ccset = set(
1096
- jvm.co.gphl.beamline.v2_unstable.domain_types.CrystalClass.fromStringList(
1097
- self.toJStringArray(crystal_classes)
1098
- )
1095
+ jvm.CrystalClass.fromStringList(self.toJStringArray(crystal_classes))
1099
1096
  )
1100
1097
  builder = builder.crystalClasses(ccset)
1101
1098
  xx0 = userProvidedInfo.spaceGroup
@@ -1122,12 +1119,8 @@ class GphlWorkflowConnection(HardwareObject):
1122
1119
  if anomalousScatterer is None:
1123
1120
  return None
1124
1121
 
1125
- element = jvm.co.gphl.beamline.v2_unstable.domain_types.ChemicalElement.valueOf(
1126
- anomalousScatterer.element
1127
- )
1128
- edge = jvm.co.gphl.beamline.v2_unstable.domain_types.AbsorptionEdge.valueOf(
1129
- anomalousScatterer.edge
1130
- )
1122
+ element = jvm.ChemicalElement.valueOf(anomalousScatterer.element)
1123
+ edge = jvm.AbsorptionEdge.valueOf(anomalousScatterer.edge)
1131
1124
  return jvm.astra.messagebus.messages.domain_types.AnomalousScattererImpl(
1132
1125
  element, edge
1133
1126
  )
mxcubecore/utils/tango.py CHANGED
@@ -14,7 +14,7 @@ def add_attribute_channel(
14
14
  hwo: HardwareObject,
15
15
  tango_device: str,
16
16
  attribute_name: str,
17
- polling: int,
17
+ polling: int | None = None,
18
18
  update_callback=None,
19
19
  ) -> TangoChannel:
20
20
  """Utility function to add Tango attribute Channel to a hardware object.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mxcubecore
3
- Version: 1.377.0
3
+ Version: 1.379.0
4
4
  Summary: Core libraries for the MXCuBE application
5
5
  License: LGPL-3.0-or-later
6
6
  Keywords: mxcube,mxcube3,mxcubecore
@@ -187,7 +187,7 @@ mxcubecore/HardwareObjects/Gphl/CollectEmulator.py,sha256=iiH6EblDwEMdxl44BswHJE
187
187
  mxcubecore/HardwareObjects/Gphl/GphlMessages.py,sha256=3WSBmUGLka4gilfwpqXyc4SJMlOt9y2sRNrOiE0-DaM,35759
188
188
  mxcubecore/HardwareObjects/Gphl/GphlQueueEntry.py,sha256=Rwu6YL8U4knibWI9yOXBoUVuayL6O0rHQWQuEP2Hu_g,2309
189
189
  mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py,sha256=vlNhXkP2Ob-bvOuRY5rYVTSgZ8ZULrSQYYhtSS9V4fA,132177
190
- mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py,sha256=qnr_Vqv4AFOLKCrUUf11HxflpO4NCGk9OYnflvLNt9s,49898
190
+ mxcubecore/HardwareObjects/Gphl/GphlWorkflowConnection.py,sha256=s6B8BdgU6IYeGxi69QqJiM-ZUu34c-ZlaX3S5yRl4wo,50316
191
191
  mxcubecore/HardwareObjects/Gphl/Transcal2MiniKappa.py,sha256=Dzf05WSRC5vtOOluZ69f5xZrr6BmT7ITu-OfrKMqemc,9777
192
192
  mxcubecore/HardwareObjects/Gphl/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
193
193
  mxcubecore/HardwareObjects/Gphl/run_mxcube_test.csh,sha256=IvrrFiuRS7c6kYD_FflVc0WINr7oOCBEryAOtMk5zqQ,1233
@@ -467,10 +467,10 @@ mxcubecore/saferef.py,sha256=lbUbzojjg1XM6gKtGKug48CD_LeuQXpZ7R3r1fMjCKw,7164
467
467
  mxcubecore/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
468
468
  mxcubecore/utils/conversion.py,sha256=G1bk2Mi2ZwGbZa5pEeiFaKWxhSVXVGqu1L9_SioyUOk,4513
469
469
  mxcubecore/utils/qt_import.py,sha256=0lPmqok_oYQZ059kJCq7RWdg490T8YKyRvoZGyWDy4M,14486
470
- mxcubecore/utils/tango.py,sha256=lAl7Su_GgyXFEEKZ1yu_2gU18wXHVaBbGR8RYcIOVYk,2100
470
+ mxcubecore/utils/tango.py,sha256=vwEVrIrWKEFaeaJUz3xbaC7XWHY8ZeJ-pfcSrTfZPIE,2114
471
471
  mxcubecore/utils/units.py,sha256=Gh7ovTUN00XBMUoyDG5W7akCx1pROL-M6pK2z1ouemg,1361
472
- mxcubecore-1.377.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
473
- mxcubecore-1.377.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
474
- mxcubecore-1.377.0.dist-info/METADATA,sha256=w5bWtSmJvquae8bGr7aKvSBAdMXL-4WKiqjiYHvQhl8,4259
475
- mxcubecore-1.377.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
476
- mxcubecore-1.377.0.dist-info/RECORD,,
472
+ mxcubecore-1.379.0.dist-info/COPYING,sha256=u-Mc8zCecwyo4YoP8UulmzCiZZ_MmCLROd_NBtOcRj0,35148
473
+ mxcubecore-1.379.0.dist-info/COPYING.LESSER,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
474
+ mxcubecore-1.379.0.dist-info/METADATA,sha256=Hw8bAfncOB3DfUvGPo_2AYfoxKx2Y9soX1q6A18Pmrk,4259
475
+ mxcubecore-1.379.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
476
+ mxcubecore-1.379.0.dist-info/RECORD,,