Skip to content

Integrator: Refactor to ContextPlugin and add type hints - #1992

Draft
BigRoy wants to merge 7 commits into
developfrom
enhancement/integrate_ContextPlugin
Draft

Integrator: Refactor to ContextPlugin and add type hints#1992
BigRoy wants to merge 7 commits into
developfrom
enhancement/integrate_ContextPlugin

Conversation

@BigRoy

@BigRoy BigRoy commented Aug 7, 2026

Copy link
Copy Markdown
Member

Changelog Description

Integrator: Refactor to ContextPlugin and add type hints

Additional info

Turning this into an integrator allows us to optimize some queries, like the prefetching of products, version data, etc. and also join the file transactions into one threaded bulk and the OperationsSession into fewer bulks. This should make big ingests with many instances faster. But timings will still need to be made.

Draft for now, because it needs more performance tests but also general discussion

Testing notes:

  1. Publishing should work from all DCCs

@BigRoy
BigRoy requested review from antirotor and iLLiCiTiT August 7, 2026 19:05
@BigRoy BigRoy self-assigned this Aug 7, 2026
@BigRoy BigRoy added the type: enhancement Improvement of existing functionality or minor addition label Aug 7, 2026
@ynbot ynbot added the size/M label Aug 7, 2026
@BigRoy
BigRoy requested a lite review from Copilot August 10, 2026 08:05
@BigRoy

BigRoy commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

@iLLiCiTiT can you give me your thoughts on this?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the publish integrator to operate as a pyblish.api.ContextPlugin with more upfront data prefetching (products/versions/representations) and introduces stronger typing via dataclasses and type hints to support faster large ingests.

Changes:

  • Converted IntegrateAsset from InstancePlugin to ContextPlugin and integrated all eligible instances in one pass.
  • Added _PreparedInstance / _PreparedRepresentation dataclasses and expanded type hints across the integrator code.
  • Added operation chunking (operations_chunk_size) and prefetch logic via get_products / get_versions / get_representations.
Suppressed comments (2)

client/ayon_core/plugins/publish/integrate.py:915

  • Using assert here is unsafe because asserts can be stripped with -O, and then repre_context["frame"] = ... could crash if repre_context is unexpectedly None. Prefer an explicit guard (and keep the final if repre_context is None: raise as the authoritative error).
            if not is_udim:
                assert repre_context is not None
                repre_context["frame"] = first_index_padded

client/ayon_core/plugins/publish/integrate.py:920

  • This assert can be stripped with -O, so the next line could crash if repre_context is None. Use a guard instead of an assert for safety.
            if instance.data.get("renderlayer"):
                assert repre_context is not None
                repre_context["renderlayer"] = instance.data["renderlayer"]

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

Comment thread client/ayon_core/plugins/publish/integrate.py Outdated
Comment thread client/ayon_core/plugins/publish/integrate.py
Comment thread client/ayon_core/plugins/publish/integrate.py Outdated
Comment thread client/ayon_core/plugins/publish/integrate.py Outdated
@ynbot ynbot moved this to Review In Progress in PR reviewing Aug 10, 2026
Comment thread client/ayon_core/plugins/publish/integrate.py Outdated
BigRoy and others added 4 commits August 10, 2026 14:11
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@BigRoy
BigRoy requested a review from iLLiCiTiT August 13, 2026 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M type: enhancement Improvement of existing functionality or minor addition

Projects

Status: Review In Progress

Development

Successfully merging this pull request may close these issues.

4 participants