Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Context Validation Repair Action enhancements #6207

Conversation

bradenjennings
Copy link
Contributor

@bradenjennings bradenjennings commented Feb 7, 2024

Changelog Description

Currently, Repair Action in Validate Instance in Context sets only the asset path, but is should be able to also set Task and run Set resolution and Set frame range actions. This should work both in AYON and OpenPype

Testing notes:

  1. having this Validator enabled in settings, create scene in the one context
  2. create instance and direct it to another context, ideally with different frame range and resolution
  3. publish
  4. validator should trigger and repair actions should do what they claim. Both in AYON and OP

[cuID:AY-1052]

@ynbot ynbot added size/XS Denotes a PR changes 0-99 lines, ignoring general files host: Maya type: enhancement Enhancements to existing functionality labels Feb 7, 2024
Comment on lines 56 to 63
# Get to the task doc of the project, folder path and task
project_name = instance.context.data["projectEntity"]["name"]
folder_path = instance.context.data["asset"]
task_name = instance.context.data["task"]
from ayon_api import get_task_by_name, get_folder_by_path
folder = get_folder_by_path(project_name, folder_path)
asset_id = folder["id"]
task = get_task_by_name(project_name, asset_id, task_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The validator should not be querying this data - right? This should've been readily collected in the Collectors.

Doing this per instance like this I'm pretty sure will be very slow. This is much better batch collected in a Collector.


Side note: wasn't aware Ayon had frame data per task instead of per folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BigRoy so would you recommended adding a "CollectTaskEntity" to the Maya host collectors.
I want to store the task doc attributes for later query in validators.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup, task entity collecting would make sense. It's happening already for projectEntity and assetEntity or alike on both context and instance (note that Instance MAY target a different asset than current context and thus might need a validation against that instead of the context).

I'd look up which collector is currently storing projectEntity and assetEntity which I think it does in a bulk query from a ContextPlugin and add the data collection for taskEntity there as well (if task is set on the instance/context, etc.)

@iLLiCiTiT thoughts?

Copy link
Contributor Author

@bradenjennings bradenjennings Feb 8, 2024

Choose a reason for hiding this comment

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

I found where project and asset entity are added to context, this is in

collect_context_entities.py

I now prepare and cache the "taskEntity"here.
https://github.com/ynput/OpenPype/pull/6207/files#diff-65495e9f1aba1baa5c1f7517ad5f56e80c42990db087260f8ee4a5eee6edb1c1R17

task_entity = ayon_api.get_task_by_name(
    project_name, asset_entity["_id"], task_name)
context.data["taskEntity"] = task_entity

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BigRoy it seems get_task_by_name is only in ayon_api.

I guess I need to make OpenPype legacy work without ayon in the mix?

In which case I should test if AYON_SERVER_ENABLED, and then only do the query in ayon.

I assume there was no API for this in legacy OpenPype

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it would be easier if I don't have to back support OpenPype without AYON.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup, there's no equivalent "task" data in OpenPype as far as I know.

Since this is in the OpenPype repo I'm pretty sure you'll still need to maintain backwards compatibility. But might be a better question forwarded to @mkolar or @iLLiCiTiT

@mkolar
Copy link
Member

mkolar commented Feb 9, 2024

Actually @bradenjennings this only needs to work in AYON. It makes no sense in OP, so you can get rid of the compatibility and port it directly to ayon-core.

this can be closed in favour of ayon-core PR

@mkolar mkolar closed this Feb 9, 2024
@ynbot ynbot added this to the next-patch milestone Feb 9, 2024
@jakubjezek001 jakubjezek001 removed this from the next-patch milestone Feb 15, 2024
@m-u-r-p-h-y m-u-r-p-h-y added sponsored Client endorsed or requested target: OpenPype labels Mar 4, 2024
@m-u-r-p-h-y m-u-r-p-h-y reopened this Mar 4, 2024
@antirotor
Copy link
Member

Just note why it was re-opened: this was requested by the client still running OP so it has to work there too

@antirotor antirotor changed the title enhancement/OP-7955_Context_Validation_Repair_Action_enhancements Context Validation Repair Action enhancements Mar 5, 2024
@antirotor antirotor marked this pull request as draft March 5, 2024 13:54
@antirotor
Copy link
Member

Pure AYON version needs to be done in ayon-core repo

@bradenjennings
Copy link
Contributor Author

Just note why it was re-opened: this was requested by the client still running OP so it has to work there too

Tasks dont store overrides in OpenPype as far as I know.
I don't think its possible to implement without using AYON API.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
host: Maya port to AYON size/XS Denotes a PR changes 0-99 lines, ignoring general files sponsored Client endorsed or requested target: OpenPype type: enhancement Enhancements to existing functionality
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants