Skip to content

Dev - #38

Merged
GregoryKogan merged 2 commits into
mainfrom
dev
Jul 23, 2026
Merged

Dev#38
GregoryKogan merged 2 commits into
mainfrom
dev

Conversation

@GregoryKogan

@GregoryKogan GregoryKogan commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Add optional asynchronous mode to the YT map operation helper while keeping existing synchronous behavior by default.

New Features:

  • Allow run_map to return the underlying yt.wrapper.Operation when called with sync=False instead of waiting for completion.

Enhancements:

  • Extend run_map signature and documentation to support configurable synchronous or asynchronous execution semantics.

Build:

  • Update lint configuration to ignore high-arity warning for the map command operations module.

Tests:

  • Add a test verifying that run_map with sync=False returns the submitted operation and does not wait for completion.

Когановский Григорий Игоревич added 2 commits July 23, 2026 15:33
…ission

- Updated the `run_map` function to include a `sync` parameter, allowing users to choose between waiting for operation completion or returning the operation object immediately.
- Revised the function's docstring to clarify the behavior based on the `sync` parameter, improving usability and documentation accuracy.
- Ensured backward compatibility by maintaining the original behavior when `sync` is set to True.
@GregoryKogan GregoryKogan self-assigned this Jul 23, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduce an optional asynchronous mode to run_map so callers can get the YT Operation immediately instead of blocking, and add tests and lint configuration to support it.

Sequence diagram for run_map synchronous vs asynchronous execution

sequenceDiagram
    participant Caller
    participant run_map
    participant yt_client
    participant Operation

    Caller->>run_map: run_map(context, mapper, job, sync)
    run_map->>Operation: [create operation]

    alt [sync is False]
        run_map-->>Caller: return Operation
    else [sync is True]
        run_map->>yt_client: wait_for_operation(Operation)
        yt_client-->>run_map: success: bool
        run_map-->>Caller: return success: bool
    end
Loading

File-Level Changes

Change Details Files
Add an optional non-blocking execution mode to run_map and adjust its API accordingly.
  • Import yt.wrapper.Operation and use it as a return type when not waiting for completion
  • Extend run_map signature with a keyword-only sync flag defaulting to True
  • Change run_map return annotation to bool
Operation and update docstring to document both modes
  • Short-circuit run_map to return the submitted operation immediately when sync is False, skipping wait_for_operation
  • Add test coverage for the new non-blocking behavior of run_map.
    • Add a test that calls run_map with sync=False and asserts the Operation is returned
    • Verify that wait_for_operation is not called when sync=False
    tests/test_map.py
    Update lint configuration to ignore high-arity warnings for the map command operations module.
    • Add yt_framework/operations/command_ops/map.py to the PLR0913 ignore list in the Ruff configuration
    pyproject.toml

    Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it. You can also reply to a
      review comment with @sourcery-ai issue to create an issue from it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time. You can also comment
      @sourcery-ai title on the pull request to (re-)generate the title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time exactly where you
      want it. You can also comment @sourcery-ai summary on the pull request to
      (re-)generate the summary at any time.
    • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
      request to (re-)generate the reviewer's guide at any time.
    • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
      pull request to resolve all Sourcery comments. Useful if you've already
      addressed all the comments and don't want to see them anymore.
    • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
      request to dismiss all existing Sourcery reviews. Especially useful if you
      want to start fresh with a new review - don't forget to comment
      @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    @sourcery-ai sourcery-ai Bot left a comment

    Copy link
    Copy Markdown

    Choose a reason for hiding this comment

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

    Hey - I've left some high level feedback:

    • Changing run_map to return bool | Operation based on sync may complicate call sites; consider either splitting into two functions (sync and async) or using a single return type that encapsulates both behaviors to keep usage predictable.
    • Instead of extending the parameter list and adding a new PLR0913 ignore for map.py, consider refactoring run_map to take a configuration object (e.g., a dataclass) to reduce arity and make the function signature easier to manage.
    Prompt for AI Agents
    Please address the comments from this code review:
    
    ## Overall Comments
    - Changing `run_map` to return `bool | Operation` based on `sync` may complicate call sites; consider either splitting into two functions (sync and async) or using a single return type that encapsulates both behaviors to keep usage predictable.
    - Instead of extending the parameter list and adding a new `PLR0913` ignore for `map.py`, consider refactoring `run_map` to take a configuration object (e.g., a dataclass) to reduce arity and make the function signature easier to manage.

    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    @GregoryKogan
    GregoryKogan merged commit 294843f into main Jul 23, 2026
    8 checks passed
    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.

    1 participant