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

Improve robustness of hwp_pcu #797

Merged
merged 4 commits into from
Nov 25, 2024
Merged

Improve robustness of hwp_pcu #797

merged 4 commits into from
Nov 25, 2024

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
Collaborator

@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!

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
5 checks passed
@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