Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tickets/DM-47223: Prepare _wait_hard_point_test_ok method in MTCS for parallelization #179

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

cvillalon
Copy link
Contributor

Update the wait method for hardpoint tests to be ok in order to make it compatible with concurrent executions.

Using next will pop the data from the queue so it might happen that one execution will “steal” the event for the other and vice versa. This PR changes next to aget and adds a sleep to avoid that.

Copy link
Member

@tribeiro tribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some small comments I hope you can address before I can approve it.

@@ -0,0 +1,2 @@
Update ``_wait_hard_point_test_ok`` method in ``MTCS`` to be compatible with
concurrent executions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For documentation in general we adopted something called "semantic line break". Basically it means that each phrase should be in one line. Please, make sure this is all in one line.

hp_test_state = MTM1M3.HardpointTest(
(
await self.rem.mtm1m3.evt_hardpointTestStatus.next(
await self.rem.mtm1m3.evt_hardpointTestStatus.aget(
flush=False, timeout=self.timeout_hardpoint_test_status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aget does not have a flush parameter.

@@ -1302,6 +1305,10 @@ async def _wait_hard_point_test_ok(self, hp: int) -> None:
else:
self.log.info(f"Hard point {hp} test state: {hp_test_state!r}.")

await self.rem.mtm1m3.evt_heartbeat.next(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to wrap this await here with a try/except and catch and treat timeout errors. It might be hard for users to understand why there is a heartbeat timeout coming from this loop. Consider something like:

try:
    await self.rem.mtm1m3.evt_heartbeat.next(...)
expect asyncio.TimeoutError:
    raise RuntimeError(f"No heartbeat received from M1M3 in the last {self.timeout_hardpoint_test_status}s while waiting for hard point data information. Check CSC liveliness.")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I'm also adding a unit test for this case.

Update the wait method for hardpoint tests to be ok in order to make it
compatible with concurrent executions.

Using next will pop the data from the queue so it might happen that one
execution will “steal” the event for the other and vice versa. This
commit changes next to aget and adds a sleep to avoid that.
@cvillalon cvillalon merged commit 4319525 into develop Nov 19, 2024
5 checks passed
@cvillalon cvillalon deleted the tickets/DM-47223 branch November 19, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants