Skip to content

tpg366: Make acq process robust to network disruptions#1066

Merged
BrianJKoopman merged 11 commits into
mainfrom
koopman/pfeiffer-tpg366-refactor
May 22, 2026
Merged

tpg366: Make acq process robust to network disruptions#1066
BrianJKoopman merged 11 commits into
mainfrom
koopman/pfeiffer-tpg366-refactor

Conversation

@BrianJKoopman
Copy link
Copy Markdown
Member

@BrianJKoopman BrianJKoopman commented May 20, 2026

Description

This PR adds error handling to the Pfeiffer TPG366 agent. I separated the driver class out to its own module, renamed it to something more specific (since we have other Pfeiffer devices), and made it a subclass of TCPInterface to enable error handling.

Motivation and Context

Resolves #1000.

How Has This Been Tested?

This has been tested in the following scenarios:

  • Test error handling when the device is offline during agent startup
  • Test error handling with acq running when network connection is interrupted
  • Test error handling with acq running when the device is power cycled

From power off:

2026-05-22T17:35:58-0400 startup-op: launching acq
2026-05-22T17:35:58-0400 start called for acq
2026-05-22T17:35:58-0400 acq:0 Status is now "starting".
2026-05-22T17:35:58-0400 acq:0 Status is now "running".
2026-05-22T17:35:58-0400 Connection not established.
2026-05-22T17:35:58-0400 Resetting the connection to the device.
2026-05-22T17:36:08-0400 Connection not established within 10 seconds.
2026-05-22T17:36:08-0400 Failed to get data from device. Check network connection.
2026-05-22T17:36:09-0400 Connection not established.
2026-05-22T17:36:09-0400 Resetting the connection to the device.
2026-05-22T17:36:13-0400 Connection re-established.

Through network disconnect:

2026-05-22T17:32:31-0400 startup-op: launching acq
2026-05-22T17:32:31-0400 start called for acq
2026-05-22T17:32:31-0400 acq:0 Status is now "starting".
2026-05-22T17:32:31-0400 acq:0 Status is now "running".
2026-05-22T17:32:52-0400 Failed to get data from device. Check network connection.
2026-05-22T17:33:03-0400 Failed to get data from device. Check network connection.
2026-05-22T17:33:08-0400 Caught unexpected error: invalid literal for int() with base 10: '\x06'
2026-05-22T17:33:09-0400 WARN: Did not receive ACK. Attempting to drain buffer.
2026-05-22T17:33:09-0400 Buffer contents: b'\x06\r\n'
2026-05-22T17:33:09-0400 Resending command: b'PRX\r\n'
2026-05-22T17:33:09-0400 Connection re-established.

Through power cycle:

2026-05-22T17:33:54-0400 Failed to get data from device. Check network connection.
2026-05-22T17:34:05-0400 Failed to get data from device. Check network connection.
2026-05-22T17:34:10-0400 Connection error: [Errno 104] Connection reset by peer
2026-05-22T17:34:10-0400 Failed to get data from device. Check network connection.
2026-05-22T17:34:11-0400 Connection error: [Errno 32] Broken pipe
2026-05-22T17:34:11-0400 Resetting the connection to the device.
2026-05-22T17:34:11-0400 Connection re-established.

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.

@BrianJKoopman BrianJKoopman force-pushed the koopman/tcpinterface-recv-reset branch 2 times, most recently from 5bcf917 to 77b25d6 Compare May 22, 2026 15:51
@BrianJKoopman BrianJKoopman force-pushed the koopman/pfeiffer-tpg366-refactor branch 3 times, most recently from 7fea643 to 6223882 Compare May 22, 2026 21:38
@BrianJKoopman BrianJKoopman marked this pull request as ready for review May 22, 2026 21:48
Base automatically changed from koopman/tcpinterface-recv-reset to main May 22, 2026 21:56
@BrianJKoopman BrianJKoopman force-pushed the koopman/pfeiffer-tpg366-refactor branch from 6223882 to 8c36b3b Compare May 22, 2026 22:08
@BrianJKoopman BrianJKoopman changed the title Use TCPInterface in Pfeiffer TPG366 drivers tpg366: Make acq process robust to network disruptions May 22, 2026
@BrianJKoopman BrianJKoopman merged commit 3c2ea30 into main May 22, 2026
18 checks passed
@BrianJKoopman BrianJKoopman deleted the koopman/pfeiffer-tpg366-refactor branch May 22, 2026 22:29
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.

TPG366 Agent network interruption crash

1 participant