feat: stream output of executed commands#37
Closed
iamjpotts wants to merge 1 commit intolablup:mainfrom
Closed
Conversation
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
|
|
1 similar comment
|
|
50 tasks
inureyes
added a commit
that referenced
this pull request
Oct 29, 2025
This commit implements the core streaming infrastructure for real-time SSH command output, enabling future interactive UI features while maintaining full backward compatibility. ## Key Changes ### Core Streaming Infrastructure - Add `CommandOutput` enum for stdout/stderr streaming events - Add `CommandOutputBuffer` for internal output collection - Implement `execute_streaming()` method with tokio channel-based architecture - Refactor existing `execute()` to use streaming internally (zero breaking changes) ### Public API Addition - New `connect_and_execute_with_output_streaming()` method in SshClient - Streaming API respects timeout configuration - Channel capacity: 100 events with efficient memory usage (~16KB per command) ### Architecture Documentation - Document streaming design patterns in ARCHITECTURE.md - Include performance characteristics and memory overhead analysis - Document backward compatibility guarantees - Add implementation details for future phases ### Error Handling - Add `JoinError` variant to tokio_client::Error - Graceful handling of task join failures - Silent handling of send errors when receiver is dropped ### Testing - Add comprehensive streaming integration tests (tests/streaming_test.rs) - Test stdout/stderr separation and ordering - Test backward compatibility of refactored execute() - All existing tests pass without modification (100% compatibility) ## Implementation Details The streaming implementation uses a producer-consumer pattern: - Background tokio task collects output chunks via bounded channel - Zero-copy data transfer using russh's CryptoVec - Graceful degradation if receiver drops early - No performance impact on non-streaming usage ## Related Issues - Implements Phase 1 of #68 (Core Streaming Infrastructure) - Foundation for Phase 2 (Multi-node executor integration) - Foundation for Phase 3 (Interactive TUI) - Based on design concepts from PR #37
inureyes
added a commit
that referenced
this pull request
Oct 29, 2025
) This commit implements the core streaming infrastructure for real-time SSH command output, enabling future interactive UI features while maintaining full backward compatibility. ## Key Changes ### Core Streaming Infrastructure - Add `CommandOutput` enum for stdout/stderr streaming events - Add `CommandOutputBuffer` for internal output collection - Implement `execute_streaming()` method with tokio channel-based architecture - Refactor existing `execute()` to use streaming internally (zero breaking changes) ### Public API Addition - New `connect_and_execute_with_output_streaming()` method in SshClient - Streaming API respects timeout configuration - Channel capacity: 100 events with efficient memory usage (~16KB per command) ### Architecture Documentation - Document streaming design patterns in ARCHITECTURE.md - Include performance characteristics and memory overhead analysis - Document backward compatibility guarantees - Add implementation details for future phases ### Error Handling - Add `JoinError` variant to tokio_client::Error - Graceful handling of task join failures - Silent handling of send errors when receiver is dropped ### Testing - Add comprehensive streaming integration tests (tests/streaming_test.rs) - Test stdout/stderr separation and ordering - Test backward compatibility of refactored execute() - All existing tests pass without modification (100% compatibility) ## Implementation Details The streaming implementation uses a producer-consumer pattern: - Background tokio task collects output chunks via bounded channel - Zero-copy data transfer using russh's CryptoVec - Graceful degradation if receiver drops early - No performance impact on non-streaming usage ## Related Issues - Implements Phase 1 of #68 (Core Streaming Infrastructure) - Foundation for Phase 2 (Multi-node executor integration) - Foundation for Phase 3 (Interactive TUI) - Based on design concepts from PR #37
Member
|
@iamjpotts CLA is not signed yet, therefore I advanced the topic to the full multi-terminal implementation issue and covered this topic on #69 |
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.
Wanted to gauge interest in accepting a PR that would stream the output of a command as it executes, rather than waiting for it to finish before returning its
stdout/stderroutput.Useful for watching long running commands, such as for installing packages on a remote server.
Also useful for assessing if a remote command is hung, for example, if it is waiting for user input (which can happen when a dpkg install detects a changed config file and asks you if you want to keep or overwrite it, and you have not used the env vars or arguments to make that choice automatic).
So far this pr only adds two methods on public apis, and adds one test, but does not change the behavior of the cli tool.