Skip to content

Add wait for events argument to operations - #346

Merged
iLLiCiTiT merged 5 commits into
developfrom
enhancement/345-expose-waitforevents-on-background-operations
Aug 21, 2026
Merged

Add wait for events argument to operations#346
iLLiCiTiT merged 5 commits into
developfrom
enhancement/345-expose-waitforevents-on-background-operations

Conversation

@iLLiCiTiT

@iLLiCiTiT iLLiCiTiT commented Aug 21, 2026

Copy link
Copy Markdown
Member

Changelog Description

Operations do define wait_for_events argument to be defined.

Additional review information

The option is available for a very long time, it was added before raise_on_fail so it does not require any additional validations (1.10.3). By default it is set to False which seems to be matching the server default.

Testing notes:

  1. Validate code changes.

Resolves #345

@iLLiCiTiT iLLiCiTiT self-assigned this Aug 21, 2026
@iLLiCiTiT
iLLiCiTiT requested a review from BigRoy August 21, 2026 11:57
@iLLiCiTiT iLLiCiTiT added the type: enhancement New feature or request label Aug 21, 2026

Copilot AI 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.

Pull request overview

This PR exposes a wait_for_events flag across the batch-operations APIs so callers can choose whether the server should wait for related events before returning/marking operations complete, and wires that option through OperationsSession.commit().

Changes:

  • Add wait_for_events argument to batch/background operations methods and their _api.py convenience wrappers.
  • Propagate waitForEvents into the REST payload for operations endpoints.
  • Add a session-level default for wait_for_events in OperationsSession, with an override on commit().

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ayon_api/server_api.py Adds wait_for_events to ServerAPI batch/background operations and forwards it to REST calls.
ayon_api/operations.py Adds wait_for_events defaults to OperationsSession and forwards it on commit.
ayon_api/_api.py Exposes wait_for_events in top-level helper functions for batch/background/activities operations.
ayon_api/_api_helpers/base.py Updates the _send_batch_operations interface to accept wait_for_events.
ayon_api/_api_helpers/activities.py Adds wait_for_events to activities batch operations and passes it through.
Suppressed comments (1)

ayon_api/_api.py:2724

  • Similar to send_batch_operations, adding * here makes can_fail, wait_for_events, and raise_on_fail keyword-only, which is a backward-incompatible API change for positional callers. If the library intends to preserve positional compatibility for existing code, this should be handled (or explicitly documented as a breaking change).
    operations: list[dict[str, Any]],
    *,
    can_fail: bool = False,
    wait_for_events: bool = False,
    raise_on_fail: bool = True,

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ayon_api/_api.py
Comment on lines 1623 to 1627
operations: list[dict[str, Any]],
*,
can_fail: bool = False,
wait_for_events: bool = False,
raise_on_fail: bool = True,
Comment thread ayon_api/_api.py
Comment on lines 1639 to 1643
can_fail (bool): Server will try to process all
operations even if one of them fails.
wait_for_events (bool): The operations are marked as done before
related events are triggered on server.
raise_on_fail (bool): Raise exception if an operation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Wait for events to be processed on server" does sound clearer?

@BigRoy BigRoy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code LGTM

@iLLiCiTiT
iLLiCiTiT merged commit 4a5d654 into develop Aug 21, 2026
3 checks passed
@iLLiCiTiT
iLLiCiTiT deleted the enhancement/345-expose-waitforevents-on-background-operations branch August 21, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose waitForEvents on background operations

3 participants