Skip to content

Commit

Permalink
Rejigged transcal OK/Cancel signal
Browse files Browse the repository at this point in the history
  • Loading branch information
rhfogh committed Dec 12, 2023
1 parent 38d246e commit 63c887b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions mxcubecore/HardwareObjects/Gphl/GphlWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ def process_centring_request(self, payload, correlation_id):
self._return_parameters = gevent.event.AsyncResult()
try:
dispatcher.connect(
self.receive_pre_transcal_data,
self.receive_ok_cancel,
self.PARAMETER_RETURN_SIGNAL,
dispatcher.Any,
)
Expand All @@ -2288,7 +2288,7 @@ def process_centring_request(self, payload, correlation_id):
return StopIteration
finally:
dispatcher.disconnect(
self.receive_pre_transcal_data,
self.receive_ok_cancel,
self.PARAMETER_RETURN_SIGNAL,
dispatcher.Any,
)
Expand Down Expand Up @@ -2667,16 +2667,18 @@ def receive_pre_strategy_data(self, instruction, parameters):
)
)

def receive_pre_transcal_data(self, instruction, parameters):
def receive_ok_cancel(self, instruction, parameters):

if instruction == self.PARAMETERS_READY:
self._return_parameters.set(parameters)
elif instruction == self.PARAMETERS_CANCELLED:
self._return_parameters.set(StopIteration)
else:
raise ValueError(
"Illegal return instruction %s for transcal parameter query"
% instruction
self._return_parameters.set_exception(
ValueError(
"Illegal return instruction %s for Ok/Cancel query"
% instruction
)
)

def receive_pre_collection_data(self, instruction, parameters):
Expand Down

0 comments on commit 63c887b

Please sign in to comment.