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

Feat: Improve progress prints #302

Merged
merged 3 commits into from
Jul 18, 2024
Merged

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Jul 18, 2024

Before After
image image

Summary by CodeRabbit

  • New Features

    • Enhanced progress tracking with detailed elapsed time calculations.
  • Bug Fixes

    • Fixed time calculation issues for short durations to ensure precision.
  • Improvements

    • Improved logging for record processing, batch writing, and cache processing with more descriptive messages.

Copy link

coderabbitai bot commented Jul 18, 2024

Walkthrough

Walkthrough

The changes enhance the Progress class in airbyte/progress.py by improving time tracking and progress reporting. Key modifications include the addition of properties to track elapsed time since specific events (like the first record received) and adjustments to the method return types to provide more precise time values. The test_progress.py file was updated to reflect these changes in the corresponding unit tests.

Changes

File Change Summary
airbyte/progress.py Added new attributes and properties for detailed time tracking, adjusted return types to floats, and refined progress reporting methods.
tests/unit_tests/... Updated unit tests to reflect changes in Progress class, including more detailed progress messages.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Progress
    participant TestProgress

    User->>Progress: Call reset()
    Progress->>Progress: Set start_time and first_record_received_time
    User->>Progress: Call log_records_read()
    Progress->>Progress: Set first_record_received_time if not set
    User->>Progress: Call elapsed_seconds()
    Progress->>Progress: Calculate elapsed time based on start_time and end_time
    User->>Progress: Call elapsed_read_time()
    Progress->>Progress: Calculate time since read operation started
    User->>Progress: Call elapsed_seconds_since_first_record()
    Progress->>Progress: Calculate time since first record received
    User->>Progress: Call _get_status_message()
    Progress->>Progress: Generate detailed progress message

    User->>TestProgress: Run unit tests
    TestProgress->>Progress: Validate time tracking and progress messages
Loading

This sequence diagram illustrates the interaction between various methods in the Progress class and the corresponding unit tests. The new methods and properties for time tracking are integrated seamlessly into the workflow, ensuring accurate and detailed progress reporting.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aaronsteers
Copy link
Contributor Author

@coderabbitai review

Copy link

coderabbitai bot commented Jul 18, 2024

Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0616d8a and 0b3df13.

Files selected for processing (1)
  • airbyte/progress.py (6 hunks)
Additional comments not posted (7)
airbyte/progress.py (7)

95-97: LGTM! Improved precision for short durations.

The added condition for handling cases where seconds are less than or equal to 2 provides more precise time reporting.


252-252: LGTM! Tracking the first record received time.

The new attribute first_record_received_time helps in tracking the time when the first record is received, improving progress reporting accuracy.


271-276: LGTM! Improved precision in elapsed seconds.

Returning a float in the elapsed_seconds property allows for more precise time tracking, enhancing progress reporting.


279-286: LGTM! Accurate time tracking since the first record.

The elapsed_seconds_since_first_record property now calculates the time elapsed since the first record was received, improving progress reporting accuracy.


315-321: LGTM! Improved precision in finalization seconds.

Returning a float in the elapsed_finalization_seconds property allows for more precise time tracking, enhancing progress reporting.


330-331: LGTM! Ensuring accurate tracking of the first record received.

The log_records_read method now sets first_record_received_time if it's not already set, ensuring accurate tracking for progress reporting.


420-463: LGTM! Enhanced progress reporting.

The refactored _get_status_message method provides detailed and informative progress reporting, including start and end times for reading and finalization, records processed, and completion status.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0b3df13 and 44524e3.

Files selected for processing (2)
  • airbyte/progress.py (7 hunks)
  • tests/unit_tests/test_progress.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • airbyte/progress.py
Additional comments not posted (9)
tests/unit_tests/test_progress.py (9)

108-110: LGTM!

The _assert_lines function is correctly asserting that expected lines are present in the actual lines.


118-119: LGTM!

The status message for starting to read from the source is clear and informative.


123-125: LGTM!

The logic for starting the "time since first record" timer is correct.


130-131: LGTM!

The status message after reading some records is clear and provides useful information about the progress.


140-141: LGTM!

The status message after resetting the progress is clear and informative.


145-147: LGTM!

The logic for starting the "time since first record" timer after resetting is correct.


155-159: LGTM!

The status messages for reading records, caching records, and starting cache processing are clear and provide detailed information about the progress.


168-173: LGTM!

The status messages for finalizing batches and processing cache files are clear and informative.


183-189: LGTM!

The final status messages after completing all records and streams are detailed and provide a comprehensive summary of the progress.

@aaronsteers aaronsteers merged commit e784ed9 into main Jul 18, 2024
18 checks passed
@aaronsteers aaronsteers deleted the feat/improved-progress-prints branch July 18, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant