Skip to content

Conversation

@ykyohei
Copy link
Contributor

@ykyohei ykyohei commented Nov 22, 2024

This PR will make the pcu agent robust against usb connection dropouts #796

Description

Improve robustness of pcu against usb connection dropouts

Motivation and Context

#796

How Has This Been Tested?

Under testing at satp3 -> tested!

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@ykyohei
Copy link
Contributor Author

ykyohei commented Nov 23, 2024

I make this PR ready, reconnection is tested as follows at satp3.

2024-11-23T14:07:26+0000 Status is failed, cleared buffer
2024-11-23T14:07:23+0000 Cleared buffer
2024-11-23T14:07:22+0000 Connected to PCU
2024-11-23T14:06:52+0000 Decive reports readiness to read but returned no data. Reconnect after 30 sec...
2024-11-23T14:00:13+0000 Status is failed, cleared buffer
2024-11-23T14:00:09+0000 Cleared buffer
2024-11-23T14:00:08+0000 Connected to PCU
2024-11-23T13:59:38+0000 Decive reports readiness to read but returned no data. Reconnect after 30 sec...
2024-11-23T13:57:41+0000 send_command:5 Status is now "done".
2024-11-23T13:57:41+0000 send_command:5 Set relays for cmd=stop
2024-11-23T13:57:41+0000 Command: stop
2024-11-23T13:57:39+0000 Running action Actions.SendCommand(command='stop')

image

@ykyohei ykyohei marked this pull request as ready for review November 23, 2024 14:38
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

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

This looks good, thanks for the PR! Just two small comments.

PCU = None
session.degraded = True
time.sleep(30)
continue
Copy link
Member

Choose a reason for hiding this comment

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

This continue isn't needed, since it's the last statement in the loop that it's continuing.

PCU.close()
PCU = None
session.degraded = True
time.sleep(30)
Copy link
Member

Choose a reason for hiding this comment

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

There's already a 30 second sleep on the reconnect logic in line 124/125, so I'd say you can drop this here. If it can reconnect it'll do so quickly, if it can't it'll wait 30 seconds already.

Copy link
Contributor

@jlashner jlashner left a comment

Choose a reason for hiding this comment

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

Thanks Kyohei, this looks good to me!

@BrianJKoopman BrianJKoopman self-requested a review November 25, 2024 17:57
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

@BrianJKoopman BrianJKoopman merged commit 843d942 into main Nov 25, 2024
@BrianJKoopman BrianJKoopman deleted the hwp_pcu_fix branch November 25, 2024 17:58
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.

3 participants