-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
and add changes from test_fgs_communicator to appropriate individual callback test files Squashed commit of the following: commit 59739c2 Merge: 0a0c534 67c49cc Author: David Perl <[email protected]> Date: Fri Nov 18 11:31:31 2022 +0000 Merge pull request #371 from DiamondLightSource/353_merge_smargons commit 67c49cc Author: Dominic Oram <[email protected]> Date: Fri Nov 18 11:23:07 2022 +0000 (#353) Merged smargons into one commit 0a0c534 Merge: 8b58b3d 0172183 Author: Dominic Oram <[email protected]> Date: Thu Nov 17 15:40:52 2022 +0000 Merge pull request #362 from DiamondLightSource/361_default_interpreter (#361) updating default python interpreter commit 8b58b3d Merge: b65f8f0 4f2de21 Author: Dominic Oram <[email protected]> Date: Thu Nov 17 15:17:35 2022 +0000 Merge pull request #347 from DiamondLightSource/231_adjust_zocalo_coords commit 0172183 Author: Neil.Smith <[email protected]> Date: Thu Nov 17 14:56:51 2022 +0000 (#361) updating default python interpreter commit 4f2de21 Author: David Perl <[email protected]> Date: Thu Nov 17 14:44:58 2022 +0000 commit b65f8f0 Merge: 2bb56e8 9c2d58d Author: Dominic Oram <[email protected]> Date: Thu Nov 17 13:54:07 2022 +0000 Merge pull request #360 from DiamondLightSource/344_update_nexgen 344 update nexgen commit 9c2d58d Author: David Perl <[email protected]> Date: Thu Nov 17 11:58:02 2022 +0000 commit 0baf4f4 Author: David Perl <[email protected]> Date: Thu Nov 17 11:53:33 2022 +0000 commit 0e27def Author: David Perl <[email protected]> Date: Thu Nov 17 11:51:59 2022 +0000 commit 2c8d12e Author: David Perl <[email protected]> Date: Thu Nov 17 09:59:01 2022 +0000 commit a7f94b7 Author: David Perl <[email protected]> Date: Fri Nov 11 14:44:37 2022 +0000 commit a5896ab Author: David Perl <[email protected]> Date: Fri Nov 11 14:40:37 2022 +0000 and update tests to match
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a lot cleaner, thank you. Mostly minor comments:
- Can you fix the merge conflicts?
- I think it makes sense for the callbacks to be next to the thing they are handling e.g. the zocalo callback in
zocalo_interaction
- I really like the
external_interaction
folder, I thinkzocalo_interaction
should live in it and it would be nice to have a description in the__init__
of what it contains testdata.py
looks like an empty file, is this required?
datacollection_ids = self.ispyb.ispyb_ids[0] | ||
for id in datacollection_ids: | ||
run_end(id) | ||
self.processing_start_time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: remove line doing nothing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, was meant to be =time.time()
def __init__(self, parameters: FullParameters, ispyb_handler: ISPyBHandlerCallback): | ||
self.params = parameters | ||
self.processing_start_time = 0.0 | ||
self.processing_time = 0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This doesn't have to be an instance variable, we only use it in one method
dc_ids = [1, 2] | ||
dcg_id = 4 | ||
|
||
mock_ispyb_store_grid_scan.return_value = [dc_ids, None, dcg_id] | ||
mock_ispyb_get_time.return_value = td.DUMMY_TIME_STRING | ||
mock_ispyb_update_time_and_status.return_value = None | ||
|
||
params = FullParameters() | ||
ispyb_handler = ISPyBHandlerCallback(params) | ||
ispyb_handler.start(td.test_start_document) | ||
ispyb_handler.descriptor(td.test_descriptor_document) | ||
ispyb_handler.event(td.test_event_document) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I would pull the common bit of these two tests out into a function/fixture
|
||
from artemis.external_interaction.communicator_callbacks import ISPyBHandlerCallback | ||
from artemis.parameters import FullParameters | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think we could test:
- The exception on a stop w/o ids
- That ispyb only gets triggered on the correct plan
from artemis.utils import Point3D | ||
|
||
|
||
def test_run_gridscan_zocalo_calls( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we change the name of this test to be a bit more descriptive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I didn't name it :p
from unittest.mock import MagicMock, call | ||
|
||
from artemis.external_interaction.communicator_callbacks import FGSCallbackCollection | ||
from artemis.parameters import FullParameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Can we also test that the exceptions are thrown by the zocalo handler if ispyb has not been called correctly yet?
Codecov Report
@@ Coverage Diff @@
## main #357 +/- ##
==========================================
+ Coverage 85.94% 86.60% +0.66%
==========================================
Files 43 44 +1
Lines 1601 1680 +79
==========================================
+ Hits 1376 1455 +79
Misses 225 225
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I don't know why it's still saying there are conflicts - I merged main in dcb4316. I figure it's because I squashed 13 commits into one for that - but now when I try to merge again I can't commit it because there are no changes, and the diff shows me a bunch of things which are actually identical. All the conflicts can be safely accepted from this branch into main, all the changes are on this branch already. |
Not sure what was going on here. I managed to merge fine doing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, code looks good. I think we discussed refactoring to have the dc_id
in the plan metadata or in the zocalo constructor. Is there an issue for this?
yes, #372 |
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
…ource/315_split_fgs_communicator 315 split fgs communicator NOTE: Commit originally came from https://github.com/DiamondLightSource/python-artemis
Fixes #315
Separates the FGSCommunicator into three callback classes, adds a collection for easy subscription and handling the connection between the ispyb and zocalo components
To test: