From fecce683f1a47e7434a2921d60f17a2d5dea4bbc Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Wed, 15 Jan 2025 10:55:55 +0100 Subject: [PATCH 1/8] Some code cleanup for `CleanUp` plugin - Use `PublishError` instead of assertion - Optimize the 'check for errors' - Optimize the product type check + log debug message when skipped due to that - Move imports to top --- client/ayon_core/plugins/publish/cleanup.py | 33 +++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/client/ayon_core/plugins/publish/cleanup.py b/client/ayon_core/plugins/publish/cleanup.py index 57ef803352..109dc55c1d 100644 --- a/client/ayon_core/plugins/publish/cleanup.py +++ b/client/ayon_core/plugins/publish/cleanup.py @@ -1,11 +1,14 @@ # -*- coding: utf-8 -*- """Cleanup leftover files from publish.""" import os -import shutil -import pyblish.api import re +import shutil +import tempfile + +import pyblish.api from ayon_core.lib import is_in_tests +from ayon_core.pipeline import PublishError class CleanUp(pyblish.api.InstancePlugin): @@ -48,17 +51,15 @@ class CleanUp(pyblish.api.InstancePlugin): if is_in_tests(): # let automatic test process clean up temporary data return - # Get the errored instances - failed = [] + + # If instance has errors, do not clean up for result in instance.context.data["results"]: - if (result["error"] is not None and result["instance"] is not None - and result["instance"] not in failed): - failed.append(result["instance"]) - assert instance not in failed, ( - "Result of '{}' instance were not success".format( - instance.data["name"] - ) - ) + if result["error"] is not None and result["instance"] is instance: + raise PublishError( + "Result of '{}' instance were not success".format( + instance.data["name"] + ) + ) _skip_cleanup_filepaths = instance.context.data.get( "skipCleanupFilepaths" @@ -71,10 +72,12 @@ class CleanUp(pyblish.api.InstancePlugin): self.log.debug("Cleaning renders new...") self.clean_renders(instance, skip_cleanup_filepaths) - if [ef for ef in self.exclude_families - if instance.data["productType"] in ef]: + product_type = instance.data["productType"] + if product_type in self.exclude_families: + self.log.debug( + "Skipping cleanup for instance because product " + f"type is excluded from cleanup: {product_type}") return - import tempfile temp_root = tempfile.gettempdir() staging_dir = instance.data.get("stagingDir", None) From 1b3a08af0189d649ab7eb413bf8b526784405401 Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 27 May 2025 10:07:55 +0200 Subject: [PATCH 2/8] Revert exclude family check to maintain old behavior --- client/ayon_core/plugins/publish/cleanup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/cleanup.py b/client/ayon_core/plugins/publish/cleanup.py index 109dc55c1d..53f1dea071 100644 --- a/client/ayon_core/plugins/publish/cleanup.py +++ b/client/ayon_core/plugins/publish/cleanup.py @@ -72,8 +72,13 @@ class CleanUp(pyblish.api.InstancePlugin): self.log.debug("Cleaning renders new...") self.clean_renders(instance, skip_cleanup_filepaths) + # TODO: Figure out whether this could be refactored to just a + # product_type in self.exclude_families check. product_type = instance.data["productType"] - if product_type in self.exclude_families: + if any( + exclude_family in product_type + for exclude_family in self.exclude_families + ): self.log.debug( "Skipping cleanup for instance because product " f"type is excluded from cleanup: {product_type}") From d5b9e814a732236b0b9dd153772e29195036abad Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 27 May 2025 10:08:43 +0200 Subject: [PATCH 3/8] Fix indent --- client/ayon_core/plugins/publish/cleanup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/plugins/publish/cleanup.py b/client/ayon_core/plugins/publish/cleanup.py index 53f1dea071..4daeacf754 100644 --- a/client/ayon_core/plugins/publish/cleanup.py +++ b/client/ayon_core/plugins/publish/cleanup.py @@ -76,8 +76,8 @@ class CleanUp(pyblish.api.InstancePlugin): # product_type in self.exclude_families check. product_type = instance.data["productType"] if any( - exclude_family in product_type - for exclude_family in self.exclude_families + exclude_family in product_type + for exclude_family in self.exclude_families ): self.log.debug( "Skipping cleanup for instance because product " From bf9c5b61a5c83d23f43dc05be861bc9fb6829fab Mon Sep 17 00:00:00 2001 From: Roy Nieterau Date: Tue, 27 May 2025 10:13:43 +0200 Subject: [PATCH 4/8] Update client/ayon_core/plugins/publish/cleanup.py Co-authored-by: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> --- client/ayon_core/plugins/publish/cleanup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_core/plugins/publish/cleanup.py b/client/ayon_core/plugins/publish/cleanup.py index 4daeacf754..681fe700a3 100644 --- a/client/ayon_core/plugins/publish/cleanup.py +++ b/client/ayon_core/plugins/publish/cleanup.py @@ -76,7 +76,7 @@ class CleanUp(pyblish.api.InstancePlugin): # product_type in self.exclude_families check. product_type = instance.data["productType"] if any( - exclude_family in product_type + product_type in exclude_family for exclude_family in self.exclude_families ): self.log.debug( From 495a66d8911a8d06733534658aa5b20382ba396c Mon Sep 17 00:00:00 2001 From: Ynbot Date: Thu, 5 Jun 2025 14:58:24 +0000 Subject: [PATCH 5/8] [Automated] Add generated package files from main --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 9c43e80bf1..58311013f9 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.3.1+dev" +__version__ = "1.3.2" diff --git a/package.py b/package.py index 47e3b39083..7cc5f01496 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.3.1+dev" +version = "1.3.2" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index f919a9589b..005fd604df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.3.1+dev" +version = "1.3.2" description = "" authors = ["Ynput Team "] readme = "README.md" From b0ff3c2264f2bbced5e8eeabc93182c882d4e07c Mon Sep 17 00:00:00 2001 From: Ynbot Date: Thu, 5 Jun 2025 14:59:02 +0000 Subject: [PATCH 6/8] [Automated] Update version in package.py for develop --- client/ayon_core/version.py | 2 +- package.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/version.py b/client/ayon_core/version.py index 58311013f9..11fc31799b 100644 --- a/client/ayon_core/version.py +++ b/client/ayon_core/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring AYON addon 'core' version.""" -__version__ = "1.3.2" +__version__ = "1.3.2+dev" diff --git a/package.py b/package.py index 7cc5f01496..f564d371d2 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "core" title = "Core" -version = "1.3.2" +version = "1.3.2+dev" client_dir = "ayon_core" diff --git a/pyproject.toml b/pyproject.toml index 005fd604df..246781b12f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ [tool.poetry] name = "ayon-core" -version = "1.3.2" +version = "1.3.2+dev" description = "" authors = ["Ynput Team "] readme = "README.md" From d20ade6d79f6ec32aaab682c6cce2148d5e37a96 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Jun 2025 15:00:05 +0000 Subject: [PATCH 7/8] chore(): update bug report / version --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f71c6e2c29..2cef7d13b0 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -35,6 +35,7 @@ body: label: Version description: What version are you running? Look to AYON Tray options: + - 1.3.2 - 1.3.1 - 1.3.0 - 1.2.0 From 192358dddb3bf2cf39ebe8dc8103146831f0c494 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 6 Jun 2025 16:02:09 +0200 Subject: [PATCH 8/8] Avoids OCIO env preparation without task entity Skips OCIO environment preparation when the task entity is not available in the hook data. This prevents potential errors or unexpected behavior when the hook is executed in contexts where task information is missing. --- client/ayon_core/hooks/pre_ocio_hook.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/client/ayon_core/hooks/pre_ocio_hook.py b/client/ayon_core/hooks/pre_ocio_hook.py index 9f5c8c7339..d1a02e613d 100644 --- a/client/ayon_core/hooks/pre_ocio_hook.py +++ b/client/ayon_core/hooks/pre_ocio_hook.py @@ -29,6 +29,15 @@ class OCIOEnvHook(PreLaunchHook): def execute(self): """Hook entry method.""" + task_entity = self.data.get("task_entity") + + if not task_entity: + self.log.info( + "Skipping OCIO Environment preparation." + "Task Entity is not available." + ) + return + folder_entity = self.data["folder_entity"] template_data = get_template_data(