Integrator: Refactor to ContextPlugin and add type hints - #1992
Draft
BigRoy wants to merge 7 commits into
Draft
Conversation
Member
Author
|
@iLLiCiTiT can you give me your thoughts on this? |
Contributor
There was a problem hiding this comment.
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
IntegrateAssetfromInstancePlugintoContextPluginand integrated all eligible instances in one pass. - Added
_PreparedInstance/_PreparedRepresentationdataclasses and expanded type hints across the integrator code. - Added operation chunking (
operations_chunk_size) and prefetch logic viaget_products/get_versions/get_representations.
Suppressed comments (2)
client/ayon_core/plugins/publish/integrate.py:915
- Using
asserthere is unsafe because asserts can be stripped with-O, and thenrepre_context["frame"] = ...could crash ifrepre_contextis unexpectedlyNone. Prefer an explicit guard (and keep the finalif repre_context is None: raiseas 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
assertcan be stripped with-O, so the next line could crash ifrepre_contextisNone. 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.
iLLiCiTiT
reviewed
Aug 10, 2026
iLLiCiTiT
reviewed
Aug 10, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…erations for a single instance.
…com/ynput/ayon-core into enhancement/integrate_ContextPlugin
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.
Changelog Description
Integrator: Refactor to
ContextPluginand add type hintsAdditional 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: