Skip to content

Commit

Permalink
Merge branch 'main' into 824_mjpg-async-device
Browse files Browse the repository at this point in the history
  • Loading branch information
noemifrisina committed Oct 21, 2024
2 parents d321c16 + 32d252c commit d316812
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/dodal/devices/zocalo/zocalo_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,16 +229,19 @@ async def trigger(self):
source_of_second_results = source_from_results(
raw_results_two_sources[1]
)

# Compare results from both sources and warn if they aren't the same
differences_str = get_dict_differences(
raw_results_two_sources[0]["results"][0],
source_of_first_results,
raw_results_two_sources[1]["results"][0],
source_of_second_results,
)
if differences_str:
LOGGER.warning(differences_str)
first_results = raw_results_two_sources[0]["results"]
second_results = raw_results_two_sources[1]["results"]

if first_results and second_results:
# Compare results from both sources and warn if they aren't the same
differences_str = get_dict_differences(
first_results[0],
source_of_first_results,
second_results[0],
source_of_second_results,
)
if differences_str:
LOGGER.warning(differences_str)

# Always use CPU results
raw_results = (
Expand Down
15 changes: 15 additions & 0 deletions tests/devices/unit_tests/test_zocalo_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,18 @@ def zocalo_plan():
)

RE(zocalo_plan())


async def test_given_gpu_enabled_when_no_results_found_then_returns_no_results(
zocalo_results: ZocaloResults,
):
zocalo_results.use_cpu_and_gpu = True
await zocalo_results.stage()
zocalo_results._raw_results_received.get = MagicMock(
side_effect=[
{"recipe_parameters": {"dcgid": 0, "dcid": 0, "gpu": True}, "results": []},
{"recipe_parameters": {"dcgid": 0, "dcid": 0}, "results": []},
]
)
await zocalo_results.trigger()
assert len(await zocalo_results.centres_of_mass.get_value()) == 0

0 comments on commit d316812

Please sign in to comment.