Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces comprehensive improvements to the protocol proxy codebase focused on subprocess logging, type safety, and code cleanup. The changes implement unified logging for proxy subprocess output, improve type usage with proper abstract base class semantics, and simplify the codebase by removing unused functionality.
- Unified subprocess logging implementation across asyncio and gevent managers with JSON log parsing
- Enhanced type safety through proper ABCMeta usage and explicit type casting
- Code cleanup including typo fixes, unused code removal, and improved error handling
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/protocol_proxy/proxy/launch.py | Adds structured JSON logging configuration and fixes UUID token parsing |
| src/protocol_proxy/proxy/gevent.py | Removes manager_token parameter and adds type casting for peer objects |
| src/protocol_proxy/proxy/base.py | Updates class inheritance to use ABCMeta and removes manager_token parameter |
| src/protocol_proxy/proxy/asyncio.py | Adds type casting and removes manager_token parameter |
| src/protocol_proxy/manager/gevent.py | Implements subprocess output logging with stdout/stderr capture |
| src/protocol_proxy/manager/base.py | Adds abstract logging methods and JSON log parsing functionality |
| src/protocol_proxy/manager/asyncio.py | Implements async subprocess logging and improves process handling |
| src/protocol_proxy/ipc/headers.py | Converts to ABCMeta and fixes typo in repr method |
| src/protocol_proxy/ipc/gevent.py | Updates default value for io_wait_time |
| src/protocol_proxy/ipc/decorator.py | Fixes type annotation from 'any' to 'Any' and adds return statements |
| src/protocol_proxy/ipc/base.py | Updates IPCConnector to use ABCMeta |
| src/protocol_proxy/ipc/asyncio.py | Fixes typos in debug comments |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a00ee0c to
e7f6e12
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
81336e7 to
e9a167f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and refactorings across the protocol proxy codebase, focusing on better subprocess logging, more robust type usage, and code simplification. The most significant changes are the introduction of unified logging for subprocess output in both asyncio and gevent managers, adjustments to class inheritance and typing for clarity and correctness, and removal of unused or redundant code related to environment setup.
Subprocess Logging Improvements
log_subprocess_outputandlog_subprocess_output_line) to both asyncio and gevent managers for capturing and logging output from proxy subprocesses, improving error visibility and debugging. These methods decode log lines, attempt JSON parsing for structured logs, and handle errors gracefully. ([[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7cc95dd544d0240549121729661d1b6426981ec7e0c69b56fbb681eaeb22f298L44-R63),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-2e6cfb07631679361fbd1b2a7683bea829e7c63941ad6e87f1b1b98416af7af7R136-R156),[[3]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-f3f5fdb921c083c2a7637eb19da8ddfb7e91e629dee75b66392a233b8dca8852L46-R50),[[4]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-f3f5fdb921c083c2a7637eb19da8ddfb7e91e629dee75b66392a233b8dca8852R65-R69))stdoutandstderrstreams in both asyncio and gevent implementations, replacing previous placeholder or commented-out code. ([[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7cc95dd544d0240549121729661d1b6426981ec7e0c69b56fbb681eaeb22f298L44-R63),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-f3f5fdb921c083c2a7637eb19da8ddfb7e91e629dee75b66392a233b8dca8852L46-R50))Class and Type Refactoring
IPCConnector,ProtocolHeaders,ProtocolProxy) to useABCMetafor proper abstract base class semantics, and replacedabc.abstractmethodwith direct imports where needed. ([[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-48848710903864c51c9baf618d21fa5d744d45f6d493dc1b7d158fb3fbea8d2bL3-R3),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-48848710903864c51c9baf618d21fa5d744d45f6d493dc1b7d158fb3fbea8d2bL53-R53),[[3]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-5499c571be0e7952b96e4f48f4059032399a671a61a59a3eb8701aa8900d2d8dL1-R16),[[4]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-5499c571be0e7952b96e4f48f4059032399a671a61a59a3eb8701aa8900d2d8dL31-R44),[[5]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-cb234840c21bd35447934a39a12a73e46e32d9f0b172e56f008e558449cdaafbL13-R14))Anyinstead ofanyin decorators, and added explicitcastusage for peer objects to ensure correct typing in proxy registration logic. ([[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-88f3a5c7266a8db92630b70c66cc3bafb9da6b1ce9210283f74ff9bb5da65502R3-R20),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-99fbed7b4cbb6da3388477fe7398856815aade43958605b0a8390243743f5745R5),[[3]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-99fbed7b4cbb6da3388477fe7398856815aade43958605b0a8390243743f5745L46-R47),[[4]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-ed340393b11be1e7b9da559c373a92d396377ded0894345787d776a09a10e9acR6),[[5]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-ed340393b11be1e7b9da559c373a92d396377ded0894345787d776a09a10e9acL21-R26))Code Simplification and Cleanup
[src/protocol_proxy/manager/base.pyL48-R50](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-2e6cfb07631679361fbd1b2a7683bea829e7c63941ad6e87f1b1b98416af7af7L48-R50))[[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7a0ff7402f41977000969720ca23cac62ce0a21b756190a1d61328dd101a09d8L111-R111),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7a0ff7402f41977000969720ca23cac62ce0a21b756190a1d61328dd101a09d8L142-R142),[[3]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-5499c571be0e7952b96e4f48f4059032399a671a61a59a3eb8701aa8900d2d8dL31-R44))[[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7cc95dd544d0240549121729661d1b6426981ec7e0c69b56fbb681eaeb22f298L71-R88),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-f3f5fdb921c083c2a7637eb19da8ddfb7e91e629dee75b66392a233b8dca8852L82-R88))Minor Improvements
[[1]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7cc95dd544d0240549121729661d1b6426981ec7e0c69b56fbb681eaeb22f298L4-R7),[[2]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-7e96d363ef2d96b3c8b721798a827290f735d8befb8ca4e72fd52886ed8ae670L170-R170),[[3]](https://github.com/eclipse-volttron/lib-protocol-proxy/pull/2/files#diff-99fbed7b4cbb6da3388477fe7398856815aade43958605b0a8390243743f5745L17-R18))These changes collectively improve maintainability, error handling, and the overall robustness of the protocol proxy framework.