From 564615565e6ce28e674d7d6af74a704a80ee7ea8 Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Thu, 15 Aug 2024 21:41:21 +0300 Subject: [PATCH 01/45] Now when we scart task from AYON we see WIP status --- client/ayon_kitsu/addon.py | 5 +- client/ayon_kitsu/hooks/pre_status_cahnge.py | 65 ++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 client/ayon_kitsu/hooks/pre_status_cahnge.py diff --git a/client/ayon_kitsu/addon.py b/client/ayon_kitsu/addon.py index b69b1e7..8e57ffb 100644 --- a/client/ayon_kitsu/addon.py +++ b/client/ayon_kitsu/addon.py @@ -96,13 +96,16 @@ def get_plugin_paths(self): return { "publish": self.get_publish_plugin_paths(), + "hooks": self.get_launch_hook_paths(), # The laucher action is not working since AYON conversion # "actions": [os.path.join(KITSU_ROOT, "plugins", "launcher")], } def get_publish_plugin_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "plugins", "publish")] - + + def get_launch_hook_paths(self, host_name=None): + return [os.path.join(KITSU_ROOT, "hooks")] def is_kitsu_enabled_in_settings(project_settings): """Check if kitsu is enabled in kitsu project settings. diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py new file mode 100644 index 0000000..b9c752a --- /dev/null +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -0,0 +1,65 @@ +from ayon_applications import PreLaunchHook + +import os + + + + + + + +class pre_status_change(PreLaunchHook): + order = 1 + + launch_types = () + note_status_shortname="wip" + + + def execute(self): + import gazu + + self.log.info( + f"Start app kitsu status change in action") + + kitsuId= self.data["task_entity"]['data']['kitsuId'] + + self.log.debug(f'Changing Kitsu task status to WIP. Task id {kitsuId}') + + + + + + + + + + + + try: + gazu.set_host(os.environ["KITSU_SERVER"]) + + gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) + + kitsu_status = gazu.task.get_task_status_by_short_name( + self.note_status_shortname + ) + + + task=gazu.task.get_task(kitsuId) + + self.log.info(task) + + gazu.task.add_comment(task["id"], kitsu_status) + + gazu.log_out() + except: + self.log.info("Kitsu status change failed") + + + + + + + + + \ No newline at end of file From 8be86c89185d57383042c40ea00f8047505486d5 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:58:47 +0300 Subject: [PATCH 02/45] Update pre_status_cahnge.py --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 34 -------------------- 1 file changed, 34 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index b9c752a..ac8e436 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -1,40 +1,17 @@ from ayon_applications import PreLaunchHook - import os - - - - - - class pre_status_change(PreLaunchHook): order = 1 - launch_types = () note_status_shortname="wip" - def execute(self): import gazu - - self.log.info( - f"Start app kitsu status change in action") - kitsuId= self.data["task_entity"]['data']['kitsuId'] self.log.debug(f'Changing Kitsu task status to WIP. Task id {kitsuId}') - - - - - - - - - - try: gazu.set_host(os.environ["KITSU_SERVER"]) @@ -47,19 +24,8 @@ def execute(self): task=gazu.task.get_task(kitsuId) - self.log.info(task) - gazu.task.add_comment(task["id"], kitsu_status) gazu.log_out() except: self.log.info("Kitsu status change failed") - - - - - - - - - \ No newline at end of file From 16809f480ef78a3aa97b08fc50669dd0a3b22705 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Fri, 16 Aug 2024 00:22:05 +0300 Subject: [PATCH 03/45] Apply suggestions from code review Co-authored-by: Mustafa Jafar --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index ac8e436..e440519 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -1,16 +1,16 @@ from ayon_applications import PreLaunchHook import os -class pre_status_change(PreLaunchHook): +class PreStatusChange(PreLaunchHook): order = 1 launch_types = () - note_status_shortname="wip" + note_status_shortname = "wip" def execute(self): import gazu - kitsuId= self.data["task_entity"]['data']['kitsuId'] + kitsuId = self.data["task_entity"]["data"]["kitsuId"] - self.log.debug(f'Changing Kitsu task status to WIP. Task id {kitsuId}') + self.log.debug(f"Changing Kitsu task status to WIP. Task id {kitsuId}") try: gazu.set_host(os.environ["KITSU_SERVER"]) @@ -18,8 +18,8 @@ def execute(self): gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) kitsu_status = gazu.task.get_task_status_by_short_name( - self.note_status_shortname - ) + self.note_status_shortname + ) task=gazu.task.get_task(kitsuId) From f5200947cdfe59af4321e64b6299378ca14288d8 Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Fri, 6 Sep 2024 22:08:55 +0300 Subject: [PATCH 04/45] Feature status change on user actions --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 124 +++++++++++++++--- .../plugins/publish/integrate_kitsu_note.py | 25 +++- client/ayon_kitsu/version.py | 2 +- package.py | 2 +- server/settings/app_start.py | 37 ++++++ server/settings/main.py | 6 + server/settings/publish_plugins.py | 5 + 7 files changed, 182 insertions(+), 19 deletions(-) create mode 100644 server/settings/app_start.py diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index e440519..1bbadbc 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -1,31 +1,125 @@ from ayon_applications import PreLaunchHook +from ayon_kitsu.addon import is_kitsu_enabled_in_settings + import os +import gazu +import re + + class PreStatusChange(PreLaunchHook): order = 1 launch_types = () - note_status_shortname = "wip" + + + # status settings + set_status_app_start_note = False + app_start_status_shortname = "wip" + status_change_conditions = { + "status_conditions": [] + } + + # comment settings + custom_comment_template = { + "enabled": False, + "comment_template": "{comment}", + } + + def execute(self): - import gazu - kitsuId = self.data["task_entity"]["data"]["kitsuId"] + if not "KITSU_LOGIN" in os.environ: + self.log.info(f"KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") + return + + + data = self.launch_context.data + project_settings = data["project_settings"]["kitsu"]["appstart"] + + if project_settings["set_status_app_start_note"]: + set_status_app_start_note= True + self.log.info(f"Kitsu Status change is Enabled.") + else: + self.log.info(f"Kitsu Status change is disabled.") + return + + if not project_settings["app_start_status_shortname"]: + self.log.info(f"App starting status in not configured") + return + app_start_status_shortname= project_settings["app_start_status_shortname"] + + if project_settings["app_startstatus_change_conditions"]: + status_conditions= project_settings["app_startstatus_change_conditions"] + else: + self.log.info(f"Status change condotions are empty") + + + gazu.set_host(os.environ["KITSU_SERVER"]) + gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) + + if not self.data["task_entity"]["data"]["kitsuId"]: + self.log.info(f"This task doenst have kitsu task id. Skipping kitsu task change.") + return - self.log.debug(f"Changing Kitsu task status to WIP. Task id {kitsuId}") + kitsuId = self.data["task_entity"]["data"]["kitsuId"] + task=gazu.task.get_task(kitsuId) + task_current_status_shortname= task["task_status"]["short_name"] + + + # Check if any status condition is not met + allow_status_change = True + for status_cond in status_conditions: + condition = status_cond["condition"] == "equal" + match = status_cond["short_name"] == task_current_status_shortname + if match and not condition or condition and not match: + allow_status_change = False + break + + if allow_status_change: + if not gazu.task.get_task_status_by_short_name(self.app_start_status_shortname): + self.log.info(f"Failed to recieve kitsu status instance for shortname. Skipping Status change.") + return + kitsu_wip_status = gazu.task.get_task_status_by_short_name(self.app_start_status_shortname) + + self.log.info(f"Current Kitsu task status is {task_current_status_shortname}. Task id {kitsuId}") + + self.log.info(f"Changing Kitsu task status to {self.app_start_status_shortname}.") + + gazu.task.add_comment(task["id"], kitsu_wip_status,) + self.log.info(task["id"]) + + if not project_settings["set_pause_status_to_other_tasks"]: + self.log.info(f"Pausing all other tasks with same status disabled.") + else: + self.log.info(f"Pausing all other tasks with same status enabled.") + pause_status_shortname= project_settings["psuse_status_shortname"] + if gazu.task.get_task_status_by_short_name(pause_status_shortname): + pause_status=gazu.task.get_task_status_by_short_name(pause_status_shortname) + user_tasks= gazu.user.all_tasks_to_do() + for other_task in user_tasks: + same_status = other_task["task_status_short_name"] == app_start_status_shortname + same_task = other_task["id"] == kitsuId + if same_status and not same_task: + gazu.task.add_comment(other_task["id"], pause_status,) + else: + self.log.info(f"Failed to recieve kitsu pause status instance. Skipping pause Status change.") + + + + + + + - try: - gazu.set_host(os.environ["KITSU_SERVER"]) - gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) - kitsu_status = gazu.task.get_task_status_by_short_name( - self.note_status_shortname - ) - task=gazu.task.get_task(kitsuId) - gazu.task.add_comment(task["id"], kitsu_status) + - gazu.log_out() - except: - self.log.info("Kitsu status change failed") + else: + self.log.info(f"Status not changed due to conditions: {status_conditions}") + + + gazu.log_out() diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 1329100..0c018b7 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -12,7 +12,14 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): order = pyblish.api.IntegratorOrder label = "Kitsu Note and Status" - families = ["kitsu"] + families = ["kitsu", "render", "render.farm", "render.frames_farm", + "prerender", "prerender.farm", "prerender.frames_farm", + "renderlayer", "imagesequence", "image", + "vrayscene", "maxrender", + "arnold_rop", "mantra_rop", + "karma_rop", "vray_rop", + "redshift_rop", "usdrender"] + # status settings set_status_note = False @@ -22,11 +29,15 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): "family_requirements": [], } + # comment settings custom_comment_template = { "enabled": False, "comment_template": "{comment}", } + set_status_note_farm = False + note_farm_status_shortname = "farm" + def format_publish_comment(self, instance): """Format the instance's publish comment @@ -68,10 +79,20 @@ def process(self, context): families = set( [instance.data["family"]] + instance.data.get("families", []) ) + + kitsu_task = instance.data.get("kitsuTask") + if "review" not in families or "kitsu" not in families: + farm_malilies= ["render.farm", "render.frames_farm", + "prerender.farm", "prerender.frames_farm",] + if list(set(farm_malilies).intersection(families)) and self.set_status_note_farm: + self.log.debug("Adding farm status to task") + farm_status=gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) + gazu.task.add_comment(kitsu_task, farm_status) continue + - kitsu_task = instance.data.get("kitsuTask") + if not kitsu_task: continue diff --git a/client/ayon_kitsu/version.py b/client/ayon_kitsu/version.py index c93a37e..5b05856 100644 --- a/client/ayon_kitsu/version.py +++ b/client/ayon_kitsu/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring kitsu addon version.""" -__version__ = "1.2.4-dev.1" +__version__ = "1.2.4-appstart.19" diff --git a/package.py b/package.py index 62153e0..1f26c3f 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "kitsu" title = "Kitsu" -version = "1.2.4-dev.1" +version = "1.2.4-appstart.19" client_dir = "ayon_kitsu" services = { diff --git a/server/settings/app_start.py b/server/settings/app_start.py new file mode 100644 index 0000000..5c11897 --- /dev/null +++ b/server/settings/app_start.py @@ -0,0 +1,37 @@ +from ayon_server.settings import BaseSettingsModel, SettingsField + + +def _status_change_cond_enum(): + return [ + {"value": "equal", "label": "Equal"}, + {"value": "not_equal", "label": "Not equal"}, + ] + + +class AppStartStatusChangeCondition(BaseSettingsModel): + condition: str = SettingsField( + "equal", enum_resolver=_status_change_cond_enum, title="Condition" + ) + short_name: str = SettingsField("", title="Short name") + + + + + +class AppStartStatusChange(BaseSettingsModel): + set_status_app_start_note: bool = SettingsField(title="Set status change on app start") + app_start_status_shortname: str = SettingsField(title="App start Status shortname") + app_startstatus_change_conditions: list[AppStartStatusChangeCondition] = SettingsField( + default_factory=AppStartStatusChangeCondition, title="App start status change conditions" + ) + set_pause_status_to_other_tasks: bool = SettingsField(title="Set pause status to other tasks") + psuse_status_shortname: str = SettingsField(title="Pause Status shortname") + + +APPSTART_DEFAULT_VALUES = { + "set_status_app_start_note": False, + "app_start_status_shortname": "wip", + "app_startstatus_change_conditions": [], + "set_pause_status_to_other_tasks": False, + "psuse_status_shortname": "pause", + } \ No newline at end of file diff --git a/server/settings/main.py b/server/settings/main.py index 36efdd5..65b84d5 100644 --- a/server/settings/main.py +++ b/server/settings/main.py @@ -3,6 +3,7 @@ from .sync_settings import SyncSettings, SYNC_DEFAULT_VALUES from .publish_plugins import PublishPlugins, PUBLISH_DEFAULT_VALUES +from .app_start import AppStartStatusChange, APPSTART_DEFAULT_VALUES ## Entities naming pattern @@ -43,6 +44,10 @@ class KitsuSettings(BaseSettingsModel): default_factory=EntityPattern, title="Entities naming pattern", ) + appstart: AppStartStatusChange = SettingsField( + default_factory=AppStartStatusChange, + title="App start status change", + ) publish: PublishPlugins = SettingsField( default_factory=PublishPlugins, title="Publish plugins", @@ -59,6 +64,7 @@ class KitsuSettings(BaseSettingsModel): "sequence": "SQ##", "shot": "SH##", }, + "appstart": APPSTART_DEFAULT_VALUES, "publish": PUBLISH_DEFAULT_VALUES, "sync_settings": SYNC_DEFAULT_VALUES, } diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index 643415d..441c6e2 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -103,6 +103,8 @@ class IntegrateKitsuNotes(BaseSettingsModel): default_factory=CustomCommentTemplateModel, title="Custom Comment Template", ) + set_status_note_farm: bool = SettingsField(title="Set status on note farm") + note_farm_status_shortname: str = SettingsField(title="Note farm shortname") class PublishPlugins(BaseSettingsModel): @@ -294,5 +296,8 @@ class PublishPlugins(BaseSettingsModel): | family | `{family}` | | name | `{name}` |""", }, + "set_status_note_farm": False, + "note_farm_status_shortname": "farm" + } } From 0f80294cf3a6e41e554c5fe2a5e316e4b62a4760 Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Fri, 6 Sep 2024 22:09:37 +0300 Subject: [PATCH 05/45] q --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - .../plugins/publish/integrate_kitsu_note.py | 31 +++++++++++++------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 1bbadbc..ca6908f 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -53,7 +53,6 @@ def execute(self): else: self.log.info(f"Status change condotions are empty") - gazu.set_host(os.environ["KITSU_SERVER"]) gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 0c018b7..198451d 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -73,26 +73,37 @@ def process(self, context): "family_requirements" ] + farm_status_change=False + + families= [] + for instance in context: + families += set( + [instance.data["family"]] + instance.data.get("families", []) + ) + self.log.debug(f'Falimies in context {families}') + + if "review" not in families: + self.log.debug("Adding farm status to task") + farm_status_change=True + + if farm_status_change and self.set_status_note_farm: + kitsu_task = instance.data.get("kitsuTask") + farm_status=gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) + gazu.task.add_comment(kitsu_task, farm_status) + return + for instance in context: # Check if instance is a review by checking its family # Allow a match to primary family or any of families families = set( [instance.data["family"]] + instance.data.get("families", []) ) - - kitsu_task = instance.data.get("kitsuTask") if "review" not in families or "kitsu" not in families: - farm_malilies= ["render.farm", "render.frames_farm", - "prerender.farm", "prerender.frames_farm",] - if list(set(farm_malilies).intersection(families)) and self.set_status_note_farm: - self.log.debug("Adding farm status to task") - farm_status=gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) - gazu.task.add_comment(kitsu_task, farm_status) continue - - + kitsu_task = instance.data.get("kitsuTask") + if not kitsu_task: continue From 19863283bfa1dc6d5f4e9b64f9f7fdb89dd5c6fd Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:57:01 +0300 Subject: [PATCH 06/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Mustafa Jafar --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index ca6908f..757b341 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -7,7 +7,7 @@ -class PreStatusChange(PreLaunchHook): +class PreStatusChange(PostLaunchHook): order = 1 launch_types = () From 1ef9986e0d7fc6dbfd985e6d6693a32ce55b4120 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:57:09 +0300 Subject: [PATCH 07/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Mustafa Jafar --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 757b341..acd512d 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -102,21 +102,6 @@ def execute(self): gazu.task.add_comment(other_task["id"], pause_status,) else: self.log.info(f"Failed to recieve kitsu pause status instance. Skipping pause Status change.") - - - - - - - - - - - - - - - else: self.log.info(f"Status not changed due to conditions: {status_conditions}") From a30a67d4340082d6525122046294bcc64977933e Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:57:19 +0300 Subject: [PATCH 08/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index acd512d..ebb1f66 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -11,7 +11,6 @@ class PreStatusChange(PostLaunchHook): order = 1 launch_types = () - # status settings set_status_app_start_note = False app_start_status_shortname = "wip" From 951c874e068d86b43c5fdcd07f63494a5c5210a3 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:57:49 +0300 Subject: [PATCH 09/45] Update package.py Co-authored-by: Mustafa Jafar --- package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.py b/package.py index 1f26c3f..62153e0 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "kitsu" title = "Kitsu" -version = "1.2.4-appstart.19" +version = "1.2.4-dev.1" client_dir = "ayon_kitsu" services = { From 3a54d77191260d2b7c6a537afcbca3a1d5651a00 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:58:19 +0300 Subject: [PATCH 10/45] Update server/settings/publish_plugins.py Co-authored-by: Roy Nieterau --- server/settings/publish_plugins.py | 1 - 1 file changed, 1 deletion(-) diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index 441c6e2..d73436d 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -298,6 +298,5 @@ class PublishPlugins(BaseSettingsModel): }, "set_status_note_farm": False, "note_farm_status_shortname": "farm" - } } From 6e079ff39e9ad1f255b95a9fcd7c46a50deb9408 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:58:33 +0300 Subject: [PATCH 11/45] Update server/settings/app_start.py Co-authored-by: Roy Nieterau --- server/settings/app_start.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/settings/app_start.py b/server/settings/app_start.py index 5c11897..ecc73eb 100644 --- a/server/settings/app_start.py +++ b/server/settings/app_start.py @@ -34,4 +34,4 @@ class AppStartStatusChange(BaseSettingsModel): "app_startstatus_change_conditions": [], "set_pause_status_to_other_tasks": False, "psuse_status_shortname": "pause", - } \ No newline at end of file + } From 75226171064bc7733f130022664be2def1b68c50 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:00:41 +0300 Subject: [PATCH 12/45] Update server/settings/app_start.py Co-authored-by: Roy Nieterau --- server/settings/app_start.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/settings/app_start.py b/server/settings/app_start.py index ecc73eb..417b308 100644 --- a/server/settings/app_start.py +++ b/server/settings/app_start.py @@ -15,9 +15,6 @@ class AppStartStatusChangeCondition(BaseSettingsModel): short_name: str = SettingsField("", title="Short name") - - - class AppStartStatusChange(BaseSettingsModel): set_status_app_start_note: bool = SettingsField(title="Set status change on app start") app_start_status_shortname: str = SettingsField(title="App start Status shortname") From 871c1c4c886ec456bb26ecc867c3ad87bdff7b6c Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:00:50 +0300 Subject: [PATCH 13/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index ebb1f66..d12eb2c 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -23,9 +23,6 @@ class PreStatusChange(PostLaunchHook): "enabled": False, "comment_template": "{comment}", } - - - def execute(self): if not "KITSU_LOGIN" in os.environ: self.log.info(f"KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") From 51be2e8478f190d5e2b121a8642fb1c423bf2f79 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:00:58 +0300 Subject: [PATCH 14/45] Update client/ayon_kitsu/version.py Co-authored-by: Mustafa Jafar --- client/ayon_kitsu/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/version.py b/client/ayon_kitsu/version.py index 5b05856..c93a37e 100644 --- a/client/ayon_kitsu/version.py +++ b/client/ayon_kitsu/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring kitsu addon version.""" -__version__ = "1.2.4-appstart.19" +__version__ = "1.2.4-dev.1" From 792d0974c21714cffbcd481f243a543c8dd06656 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:01:18 +0300 Subject: [PATCH 15/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index d12eb2c..ed474cc 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -28,7 +28,6 @@ def execute(self): self.log.info(f"KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") return - data = self.launch_context.data project_settings = data["project_settings"]["kitsu"]["appstart"] From 324d1fdc4694771d86b43b4665d2b958fdbd8514 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:01:32 +0300 Subject: [PATCH 16/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index ed474cc..24bd902 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -59,7 +59,6 @@ def execute(self): task=gazu.task.get_task(kitsuId) task_current_status_shortname= task["task_status"]["short_name"] - # Check if any status condition is not met allow_status_change = True for status_cond in status_conditions: From 01d0a789cade259cf6c964a3c7ffe58e25f350d6 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:01:39 +0300 Subject: [PATCH 17/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 24bd902..3ef7401 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -98,6 +98,4 @@ def execute(self): self.log.info(f"Failed to recieve kitsu pause status instance. Skipping pause Status change.") else: self.log.info(f"Status not changed due to conditions: {status_conditions}") - - gazu.log_out() From ebea9117d5c179f96df79f1d037d6f0561bdcb2d Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:01:47 +0300 Subject: [PATCH 18/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 198451d..95ee4cf 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -84,7 +84,7 @@ def process(self, context): if "review" not in families: self.log.debug("Adding farm status to task") - farm_status_change=True + farm_status_change = True if farm_status_change and self.set_status_note_farm: kitsu_task = instance.data.get("kitsuTask") From ab37014cf8864118bbc21bcb0214eb26d94ec361 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:01:59 +0300 Subject: [PATCH 19/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 95ee4cf..10d5d89 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -88,7 +88,7 @@ def process(self, context): if farm_status_change and self.set_status_note_farm: kitsu_task = instance.data.get("kitsuTask") - farm_status=gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) + farm_status = gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) gazu.task.add_comment(kitsu_task, farm_status) return From f8aecaba6f76325cc1463ebb878e593153a8fb3b Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:04:02 +0300 Subject: [PATCH 20/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 10d5d89..ded495e 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -19,7 +19,6 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): "arnold_rop", "mantra_rop", "karma_rop", "vray_rop", "redshift_rop", "usdrender"] - # status settings set_status_note = False From 199ce1c1b57af5674411e0d38a572ed8f302dbf9 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:04:25 +0300 Subject: [PATCH 21/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index ded495e..4164afb 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -28,7 +28,6 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): "family_requirements": [], } - # comment settings custom_comment_template = { "enabled": False, From 2e63589c330bbf5e0cdad85b423aa57b0a791473 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:04:37 +0300 Subject: [PATCH 22/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 4164afb..aa4dcf6 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -36,7 +36,6 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): set_status_note_farm = False note_farm_status_shortname = "farm" - def format_publish_comment(self, instance): """Format the instance's publish comment From ca06642837c89c89df04243f4970776fb40f2e9e Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:04:59 +0300 Subject: [PATCH 23/45] Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index aa4dcf6..d4118f0 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -70,7 +70,7 @@ def process(self, context): "family_requirements" ] - farm_status_change=False + farm_status_change = False families= [] for instance in context: From 2735be60f29b9b03f4c2bb6219ccc2f8838a153e Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:21:04 +0300 Subject: [PATCH 24/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 3ef7401..4fe0e99 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -6,7 +6,6 @@ import re - class PreStatusChange(PostLaunchHook): order = 1 launch_types = () From e18410f6d858366f84e5df6a7e0cda31b09758f2 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:21:11 +0300 Subject: [PATCH 25/45] Update client/ayon_kitsu/addon.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/addon.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/addon.py b/client/ayon_kitsu/addon.py index 8e57ffb..e8c0f8a 100644 --- a/client/ayon_kitsu/addon.py +++ b/client/ayon_kitsu/addon.py @@ -103,7 +103,6 @@ def get_plugin_paths(self): def get_publish_plugin_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "plugins", "publish")] - def get_launch_hook_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "hooks")] From 7028b6a40022ae9e290b38155e7883a7693835b6 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:21:53 +0300 Subject: [PATCH 26/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 4fe0e99..b56d756 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -8,7 +8,7 @@ class PreStatusChange(PostLaunchHook): order = 1 - launch_types = () + launch_types = set() # status settings set_status_app_start_note = False From 7a1c455d94ff2864fbe2b41947282a9e832800e3 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:22:10 +0300 Subject: [PATCH 27/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index b56d756..d2d0306 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -10,14 +10,14 @@ class PreStatusChange(PostLaunchHook): order = 1 launch_types = set() - # status settings + # status settings set_status_app_start_note = False app_start_status_shortname = "wip" status_change_conditions = { "status_conditions": [] } - # comment settings + # comment settings custom_comment_template = { "enabled": False, "comment_template": "{comment}", From 1a55b6f186da01272d16e8c52ff091d9854b19f2 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:22:22 +0300 Subject: [PATCH 28/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index d2d0306..e4ab474 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -77,7 +77,7 @@ def execute(self): self.log.info(f"Changing Kitsu task status to {self.app_start_status_shortname}.") - gazu.task.add_comment(task["id"], kitsu_wip_status,) + gazu.task.add_comment(task["id"], kitsu_wip_status) self.log.info(task["id"]) if not project_settings["set_pause_status_to_other_tasks"]: From fd68f03b95f95c8ea847a7dafc844cc525b68935 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:37:39 +0300 Subject: [PATCH 29/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index e4ab474..4d1be53 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -50,8 +50,8 @@ def execute(self): gazu.set_host(os.environ["KITSU_SERVER"]) gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) - if not self.data["task_entity"]["data"]["kitsuId"]: - self.log.info(f"This task doenst have kitsu task id. Skipping kitsu task change.") + if not self.data["task_entity"]["data"].get("kitsuId"): + self.log.info(f"This task does not have a kitsu task id. Skipping kitsu task status change.") return kitsuId = self.data["task_entity"]["data"]["kitsuId"] From 1bd7d5abab6cd0706d92a038c50dc9eb53bfecb7 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:38:38 +0300 Subject: [PATCH 30/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 4d1be53..0e338ff 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -78,7 +78,6 @@ def execute(self): self.log.info(f"Changing Kitsu task status to {self.app_start_status_shortname}.") gazu.task.add_comment(task["id"], kitsu_wip_status) - self.log.info(task["id"]) if not project_settings["set_pause_status_to_other_tasks"]: self.log.info(f"Pausing all other tasks with same status disabled.") From 6bbd3962411be0969c0a8f098dce760e8b816ad6 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:39:12 +0300 Subject: [PATCH 31/45] Update server/settings/app_start.py Co-authored-by: Roy Nieterau --- server/settings/app_start.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/settings/app_start.py b/server/settings/app_start.py index 417b308..2ba4350 100644 --- a/server/settings/app_start.py +++ b/server/settings/app_start.py @@ -22,7 +22,7 @@ class AppStartStatusChange(BaseSettingsModel): default_factory=AppStartStatusChangeCondition, title="App start status change conditions" ) set_pause_status_to_other_tasks: bool = SettingsField(title="Set pause status to other tasks") - psuse_status_shortname: str = SettingsField(title="Pause Status shortname") + pause_status_shortname: str = SettingsField(title="Pause Status shortname") APPSTART_DEFAULT_VALUES = { @@ -30,5 +30,5 @@ class AppStartStatusChange(BaseSettingsModel): "app_start_status_shortname": "wip", "app_startstatus_change_conditions": [], "set_pause_status_to_other_tasks": False, - "psuse_status_shortname": "pause", + "pause_status_shortname": "pause", } From 144731685163a5ceaaab7ef2261c7b95632556e0 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:39:29 +0300 Subject: [PATCH 32/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index 0e338ff..aaa23f5 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -83,7 +83,7 @@ def execute(self): self.log.info(f"Pausing all other tasks with same status disabled.") else: self.log.info(f"Pausing all other tasks with same status enabled.") - pause_status_shortname= project_settings["psuse_status_shortname"] + pause_status_shortname= project_settings["pause_status_shortname"] if gazu.task.get_task_status_by_short_name(pause_status_shortname): pause_status=gazu.task.get_task_status_by_short_name(pause_status_shortname) user_tasks= gazu.user.all_tasks_to_do() From 934fd0fe4e5572de52aa6c88b3499873048c4201 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:46:49 +0300 Subject: [PATCH 33/45] Update client/ayon_kitsu/hooks/pre_status_cahnge.py Co-authored-by: Roy Nieterau --- client/ayon_kitsu/hooks/pre_status_cahnge.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_cahnge.py index aaa23f5..0c5b2d2 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_cahnge.py @@ -6,7 +6,16 @@ import re -class PreStatusChange(PostLaunchHook): +class PreKitsuStatusChange(PostLaunchHook): + """On launch of an application change task statuses on Kitsu. + + When launching an application this launch hook may change the + status on Kitsu with the relevant task id. + + If "pause other tasks" is enabled this will also change the status of + all other tasks to the paused task status. This can be useful for + X, Y, Z. + """ order = 1 launch_types = set() From 55a585ef6ab85dfed8b14d09ab8bea9bf563e3f8 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:13:50 +0300 Subject: [PATCH 34/45] Rename pre_status_cahnge.py to pre_status_change.py --- .../hooks/{pre_status_cahnge.py => pre_status_change.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename client/ayon_kitsu/hooks/{pre_status_cahnge.py => pre_status_change.py} (100%) diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_change.py similarity index 100% rename from client/ayon_kitsu/hooks/pre_status_cahnge.py rename to client/ayon_kitsu/hooks/pre_status_change.py From e1af2da2445e6be5b3287edfee5a2497c2c28ef7 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 10 Sep 2024 10:14:52 +0300 Subject: [PATCH 35/45] Update integrate_kitsu_note.py --- client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index d4118f0..cbc0026 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -12,13 +12,7 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): order = pyblish.api.IntegratorOrder label = "Kitsu Note and Status" - families = ["kitsu", "render", "render.farm", "render.frames_farm", - "prerender", "prerender.farm", "prerender.frames_farm", - "renderlayer", "imagesequence", "image", - "vrayscene", "maxrender", - "arnold_rop", "mantra_rop", - "karma_rop", "vray_rop", - "redshift_rop", "usdrender"] + families = ["*"] # status settings set_status_note = False From d887d10b4d525b36a7ed45da66e15005f89c4d76 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:29:05 +0300 Subject: [PATCH 36/45] fix render farm instance tag --- .gitignore | 1 + client/ayon_kitsu/addon.py | 6 +++--- .../plugins/publish/integrate_kitsu_note.py | 11 ++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index f379b51..7b25526 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ __pycache__ .vscode poetry.lock package/ +package.py frontend/node_modules frontend/dist diff --git a/client/ayon_kitsu/addon.py b/client/ayon_kitsu/addon.py index e8c0f8a..1497fd5 100644 --- a/client/ayon_kitsu/addon.py +++ b/client/ayon_kitsu/addon.py @@ -96,15 +96,15 @@ def get_plugin_paths(self): return { "publish": self.get_publish_plugin_paths(), - "hooks": self.get_launch_hook_paths(), + #"hooks": self.get_launch_hook_paths(), # The laucher action is not working since AYON conversion # "actions": [os.path.join(KITSU_ROOT, "plugins", "launcher")], } def get_publish_plugin_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "plugins", "publish")] - def get_launch_hook_paths(self, host_name=None): - return [os.path.join(KITSU_ROOT, "hooks")] + #def get_launch_hook_paths(self, host_name=None): + #return [os.path.join(KITSU_ROOT, "hooks")] def is_kitsu_enabled_in_settings(project_settings): """Check if kitsu is enabled in kitsu project settings. diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 58eb390..f664792 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -67,15 +67,12 @@ def process(self, context): farm_status_change = False families= [] + for instance in context: - families += set( - [instance.data["family"]] + instance.data.get("families", []) - ) - self.log.debug(f'Falimies in context {families}') + if instance.data.get("farm"): + farm_status_change = True - if "review" not in families: - self.log.debug("Adding farm status to task") - farm_status_change = True + self.log.debug(f'Insances on farm in context: {farm_status_change}') if farm_status_change and self.set_status_note_farm: kitsu_task = instance.data.get("kitsuTask") From 8abe4936c0bcf5add670246bb6a08fa9ae36909a Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Tue, 29 Oct 2024 18:25:59 +0300 Subject: [PATCH 37/45] fix farm render target using instace farm --- client/ayon_kitsu/addon.py | 1 - ..._status_cahnge.py => pre_status_change.py} | 48 +++++++------------ .../plugins/publish/integrate_kitsu_note.py | 26 +++------- client/ayon_kitsu/version.py | 2 +- package.py | 2 +- server/settings/app_start.py | 9 ++-- server/settings/publish_plugins.py | 1 - 7 files changed, 28 insertions(+), 61 deletions(-) rename client/ayon_kitsu/hooks/{pre_status_cahnge.py => pre_status_change.py} (83%) diff --git a/client/ayon_kitsu/addon.py b/client/ayon_kitsu/addon.py index 8e57ffb..e8c0f8a 100644 --- a/client/ayon_kitsu/addon.py +++ b/client/ayon_kitsu/addon.py @@ -103,7 +103,6 @@ def get_plugin_paths(self): def get_publish_plugin_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "plugins", "publish")] - def get_launch_hook_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "hooks")] diff --git a/client/ayon_kitsu/hooks/pre_status_cahnge.py b/client/ayon_kitsu/hooks/pre_status_change.py similarity index 83% rename from client/ayon_kitsu/hooks/pre_status_cahnge.py rename to client/ayon_kitsu/hooks/pre_status_change.py index ca6908f..0c5b2d2 100644 --- a/client/ayon_kitsu/hooks/pre_status_cahnge.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -6,33 +6,36 @@ import re +class PreKitsuStatusChange(PostLaunchHook): + """On launch of an application change task statuses on Kitsu. -class PreStatusChange(PreLaunchHook): - order = 1 - launch_types = () + When launching an application this launch hook may change the + status on Kitsu with the relevant task id. + If "pause other tasks" is enabled this will also change the status of + all other tasks to the paused task status. This can be useful for + X, Y, Z. + """ + order = 1 + launch_types = set() - # status settings + # status settings set_status_app_start_note = False app_start_status_shortname = "wip" status_change_conditions = { "status_conditions": [] } - # comment settings + # comment settings custom_comment_template = { "enabled": False, "comment_template": "{comment}", } - - - def execute(self): if not "KITSU_LOGIN" in os.environ: self.log.info(f"KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") return - data = self.launch_context.data project_settings = data["project_settings"]["kitsu"]["appstart"] @@ -56,15 +59,14 @@ def execute(self): gazu.set_host(os.environ["KITSU_SERVER"]) gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) - if not self.data["task_entity"]["data"]["kitsuId"]: - self.log.info(f"This task doenst have kitsu task id. Skipping kitsu task change.") + if not self.data["task_entity"]["data"].get("kitsuId"): + self.log.info(f"This task does not have a kitsu task id. Skipping kitsu task status change.") return kitsuId = self.data["task_entity"]["data"]["kitsuId"] task=gazu.task.get_task(kitsuId) task_current_status_shortname= task["task_status"]["short_name"] - # Check if any status condition is not met allow_status_change = True for status_cond in status_conditions: @@ -84,14 +86,13 @@ def execute(self): self.log.info(f"Changing Kitsu task status to {self.app_start_status_shortname}.") - gazu.task.add_comment(task["id"], kitsu_wip_status,) - self.log.info(task["id"]) + gazu.task.add_comment(task["id"], kitsu_wip_status) if not project_settings["set_pause_status_to_other_tasks"]: self.log.info(f"Pausing all other tasks with same status disabled.") else: self.log.info(f"Pausing all other tasks with same status enabled.") - pause_status_shortname= project_settings["psuse_status_shortname"] + pause_status_shortname= project_settings["pause_status_shortname"] if gazu.task.get_task_status_by_short_name(pause_status_shortname): pause_status=gazu.task.get_task_status_by_short_name(pause_status_shortname) user_tasks= gazu.user.all_tasks_to_do() @@ -102,23 +103,6 @@ def execute(self): gazu.task.add_comment(other_task["id"], pause_status,) else: self.log.info(f"Failed to recieve kitsu pause status instance. Skipping pause Status change.") - - - - - - - - - - - - - - - else: self.log.info(f"Status not changed due to conditions: {status_conditions}") - - gazu.log_out() diff --git a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py index 198451d..6373141 100644 --- a/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py +++ b/client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py @@ -12,14 +12,7 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): order = pyblish.api.IntegratorOrder label = "Kitsu Note and Status" - families = ["kitsu", "render", "render.farm", "render.frames_farm", - "prerender", "prerender.farm", "prerender.frames_farm", - "renderlayer", "imagesequence", "image", - "vrayscene", "maxrender", - "arnold_rop", "mantra_rop", - "karma_rop", "vray_rop", - "redshift_rop", "usdrender"] - + families = ["*"] # status settings set_status_note = False @@ -29,7 +22,6 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): "family_requirements": [], } - # comment settings custom_comment_template = { "enabled": False, @@ -38,7 +30,6 @@ class IntegrateKitsuNote(KitsuPublishContextPlugin): set_status_note_farm = False note_farm_status_shortname = "farm" - def format_publish_comment(self, instance): """Format the instance's publish comment @@ -73,22 +64,19 @@ def process(self, context): "family_requirements" ] - farm_status_change=False + farm_status_change = False families= [] + for instance in context: - families += set( - [instance.data["family"]] + instance.data.get("families", []) - ) - self.log.debug(f'Falimies in context {families}') + if instance.data.get("farm"): + farm_status_change = True - if "review" not in families: - self.log.debug("Adding farm status to task") - farm_status_change=True + self.log.debug(f'Instance in context has farm flag: {farm_status_change}') if farm_status_change and self.set_status_note_farm: kitsu_task = instance.data.get("kitsuTask") - farm_status=gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) + farm_status = gazu.task.get_task_status_by_short_name(self.note_farm_status_shortname) gazu.task.add_comment(kitsu_task, farm_status) return diff --git a/client/ayon_kitsu/version.py b/client/ayon_kitsu/version.py index 5b05856..29a43ec 100644 --- a/client/ayon_kitsu/version.py +++ b/client/ayon_kitsu/version.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring kitsu addon version.""" -__version__ = "1.2.4-appstart.19" +__version__ = "1.2.4-appstart.25" diff --git a/package.py b/package.py index 1f26c3f..ddaab35 100644 --- a/package.py +++ b/package.py @@ -1,6 +1,6 @@ name = "kitsu" title = "Kitsu" -version = "1.2.4-appstart.19" +version = "1.2.4-appstart.25" client_dir = "ayon_kitsu" services = { diff --git a/server/settings/app_start.py b/server/settings/app_start.py index 5c11897..2ba4350 100644 --- a/server/settings/app_start.py +++ b/server/settings/app_start.py @@ -15,9 +15,6 @@ class AppStartStatusChangeCondition(BaseSettingsModel): short_name: str = SettingsField("", title="Short name") - - - class AppStartStatusChange(BaseSettingsModel): set_status_app_start_note: bool = SettingsField(title="Set status change on app start") app_start_status_shortname: str = SettingsField(title="App start Status shortname") @@ -25,7 +22,7 @@ class AppStartStatusChange(BaseSettingsModel): default_factory=AppStartStatusChangeCondition, title="App start status change conditions" ) set_pause_status_to_other_tasks: bool = SettingsField(title="Set pause status to other tasks") - psuse_status_shortname: str = SettingsField(title="Pause Status shortname") + pause_status_shortname: str = SettingsField(title="Pause Status shortname") APPSTART_DEFAULT_VALUES = { @@ -33,5 +30,5 @@ class AppStartStatusChange(BaseSettingsModel): "app_start_status_shortname": "wip", "app_startstatus_change_conditions": [], "set_pause_status_to_other_tasks": False, - "psuse_status_shortname": "pause", - } \ No newline at end of file + "pause_status_shortname": "pause", + } diff --git a/server/settings/publish_plugins.py b/server/settings/publish_plugins.py index 441c6e2..d73436d 100644 --- a/server/settings/publish_plugins.py +++ b/server/settings/publish_plugins.py @@ -298,6 +298,5 @@ class PublishPlugins(BaseSettingsModel): }, "set_status_note_farm": False, "note_farm_status_shortname": "farm" - } } From 87ef0d5bda55977b87890dbf98ac391c93e486a2 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:17:40 +0300 Subject: [PATCH 38/45] Update addon.py --- client/ayon_kitsu/addon.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client/ayon_kitsu/addon.py b/client/ayon_kitsu/addon.py index 952eaf4..e8c0f8a 100644 --- a/client/ayon_kitsu/addon.py +++ b/client/ayon_kitsu/addon.py @@ -96,20 +96,15 @@ def get_plugin_paths(self): return { "publish": self.get_publish_plugin_paths(), - #"hooks": self.get_launch_hook_paths(), + "hooks": self.get_launch_hook_paths(), # The laucher action is not working since AYON conversion # "actions": [os.path.join(KITSU_ROOT, "plugins", "launcher")], } def get_publish_plugin_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "plugins", "publish")] -<<<<<<< HEAD def get_launch_hook_paths(self, host_name=None): return [os.path.join(KITSU_ROOT, "hooks")] -======= - #def get_launch_hook_paths(self, host_name=None): - #return [os.path.join(KITSU_ROOT, "hooks")] ->>>>>>> d887d10b4d525b36a7ed45da66e15005f89c4d76 def is_kitsu_enabled_in_settings(project_settings): """Check if kitsu is enabled in kitsu project settings. From 653c0bba15f65ff04656690ec10c310d4dd609fd Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:31:28 +0300 Subject: [PATCH 39/45] Update version.py --- client/ayon_kitsu/version.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client/ayon_kitsu/version.py b/client/ayon_kitsu/version.py index b55d228..c93a37e 100644 --- a/client/ayon_kitsu/version.py +++ b/client/ayon_kitsu/version.py @@ -1,7 +1,3 @@ # -*- coding: utf-8 -*- """Package declaring kitsu addon version.""" -<<<<<<< HEAD -__version__ = "1.2.4-appstart.25" -======= __version__ = "1.2.4-dev.1" ->>>>>>> d887d10b4d525b36a7ed45da66e15005f89c4d76 From 1d0cf22f7d8c4ceaac7509f427584a47a126dcc4 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:31:53 +0300 Subject: [PATCH 40/45] Update package.py --- package.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/package.py b/package.py index c1111b2..62153e0 100644 --- a/package.py +++ b/package.py @@ -1,10 +1,6 @@ name = "kitsu" title = "Kitsu" -<<<<<<< HEAD -version = "1.2.4-appstart.25" -======= version = "1.2.4-dev.1" ->>>>>>> d887d10b4d525b36a7ed45da66e15005f89c4d76 client_dir = "ayon_kitsu" services = { From 3c66ba981fd2750ae192abfd453ef20aba8098f3 Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:36:50 +0300 Subject: [PATCH 41/45] Update pre_status_change.py --- client/ayon_kitsu/hooks/pre_status_change.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/ayon_kitsu/hooks/pre_status_change.py b/client/ayon_kitsu/hooks/pre_status_change.py index 0c5b2d2..c305fbc 100644 --- a/client/ayon_kitsu/hooks/pre_status_change.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -1,4 +1,4 @@ -from ayon_applications import PreLaunchHook +from ayon_applications import PostLaunchHook from ayon_kitsu.addon import is_kitsu_enabled_in_settings import os From 2cfc432e07893a3d501e8a5a23970dc9607ccd5b Mon Sep 17 00:00:00 2001 From: timsergeeff <38128238+timsergeeff@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:51:36 +0300 Subject: [PATCH 42/45] Update pre_status_change.py --- client/ayon_kitsu/hooks/pre_status_change.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_change.py b/client/ayon_kitsu/hooks/pre_status_change.py index c305fbc..be35b56 100644 --- a/client/ayon_kitsu/hooks/pre_status_change.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -3,8 +3,6 @@ import os import gazu -import re - class PreKitsuStatusChange(PostLaunchHook): """On launch of an application change task statuses on Kitsu. From 2df77f47035cdab214a12dd18bd3c6e112f48fbb Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Tue, 29 Oct 2024 20:14:59 +0300 Subject: [PATCH 43/45] fix tests --- client/ayon_kitsu/hooks/pre_status_change.py | 36 ++++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_change.py b/client/ayon_kitsu/hooks/pre_status_change.py index be35b56..70dd9eb 100644 --- a/client/ayon_kitsu/hooks/pre_status_change.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -8,9 +8,9 @@ class PreKitsuStatusChange(PostLaunchHook): """On launch of an application change task statuses on Kitsu. When launching an application this launch hook may change the - status on Kitsu with the relevant task id. + status on Kitsu with the relevant task id. - If "pause other tasks" is enabled this will also change the status of + If "pause other tasks" is enabled this will also change the status of all other tasks to the paused task status. This can be useful for X, Y, Z. """ @@ -30,35 +30,35 @@ class PreKitsuStatusChange(PostLaunchHook): "comment_template": "{comment}", } def execute(self): - if not "KITSU_LOGIN" in os.environ: - self.log.info(f"KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") + if "KITSU_LOGIN" not in os.environ: + self.log.info("KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") return data = self.launch_context.data project_settings = data["project_settings"]["kitsu"]["appstart"] - if project_settings["set_status_app_start_note"]: + if project_settings["set_status_app_start_note"] and self.is_kitsu_enabled_in_settings: set_status_app_start_note= True - self.log.info(f"Kitsu Status change is Enabled.") + self.log.info("Kitsu Status change is Enabled.") else: - self.log.info(f"Kitsu Status change is disabled.") + self.log.info("Kitsu Status change is disabled.") return - + if not project_settings["app_start_status_shortname"]: - self.log.info(f"App starting status in not configured") + self.log.info("App starting status in not configured") return app_start_status_shortname= project_settings["app_start_status_shortname"] if project_settings["app_startstatus_change_conditions"]: status_conditions= project_settings["app_startstatus_change_conditions"] else: - self.log.info(f"Status change condotions are empty") + self.log.info("Status change condotions are empty") gazu.set_host(os.environ["KITSU_SERVER"]) gazu.log_in(os.environ["KITSU_LOGIN"], os.environ["KITSU_PWD"]) if not self.data["task_entity"]["data"].get("kitsuId"): - self.log.info(f"This task does not have a kitsu task id. Skipping kitsu task status change.") + self.log.info("This task does not have a kitsu task id. Skipping kitsu task status change.") return kitsuId = self.data["task_entity"]["data"]["kitsuId"] @@ -76,20 +76,20 @@ def execute(self): if allow_status_change: if not gazu.task.get_task_status_by_short_name(self.app_start_status_shortname): - self.log.info(f"Failed to recieve kitsu status instance for shortname. Skipping Status change.") + self.log.info("Failed to recieve kitsu status instance for shortname. Skipping Status change.") return kitsu_wip_status = gazu.task.get_task_status_by_short_name(self.app_start_status_shortname) - self.log.info(f"Current Kitsu task status is {task_current_status_shortname}. Task id {kitsuId}") + self.log.info("Current Kitsu task status is {task_current_status_shortname}. Task id {kitsuId}") - self.log.info(f"Changing Kitsu task status to {self.app_start_status_shortname}.") + self.log.info("Changing Kitsu task status to {self.app_start_status_shortname}.") gazu.task.add_comment(task["id"], kitsu_wip_status) if not project_settings["set_pause_status_to_other_tasks"]: - self.log.info(f"Pausing all other tasks with same status disabled.") + self.log.info("Pausing all other tasks with same status disabled.") else: - self.log.info(f"Pausing all other tasks with same status enabled.") + self.log.info("Pausing all other tasks with same status enabled.") pause_status_shortname= project_settings["pause_status_shortname"] if gazu.task.get_task_status_by_short_name(pause_status_shortname): pause_status=gazu.task.get_task_status_by_short_name(pause_status_shortname) @@ -100,7 +100,7 @@ def execute(self): if same_status and not same_task: gazu.task.add_comment(other_task["id"], pause_status,) else: - self.log.info(f"Failed to recieve kitsu pause status instance. Skipping pause Status change.") + self.log.info("Failed to recieve kitsu pause status instance. Skipping pause Status change.") else: - self.log.info(f"Status not changed due to conditions: {status_conditions}") + self.log.info("Status not changed due to conditions: {status_conditions}") gazu.log_out() From 623c5b3abda2dfd8eed351c247f2efba76e2ae30 Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Wed, 30 Oct 2024 12:59:28 +0300 Subject: [PATCH 44/45] tests --- client/ayon_kitsu/hooks/pre_status_change.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_change.py b/client/ayon_kitsu/hooks/pre_status_change.py index 70dd9eb..37e86e7 100644 --- a/client/ayon_kitsu/hooks/pre_status_change.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -1,5 +1,4 @@ from ayon_applications import PostLaunchHook -from ayon_kitsu.addon import is_kitsu_enabled_in_settings import os import gazu @@ -31,14 +30,15 @@ class PreKitsuStatusChange(PostLaunchHook): } def execute(self): if "KITSU_LOGIN" not in os.environ: - self.log.info("KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status.") + self.log.info( + "KITSU_LOGIN is not set. assuming rendeing in deadline. Skipping status." + ) return data = self.launch_context.data project_settings = data["project_settings"]["kitsu"]["appstart"] - if project_settings["set_status_app_start_note"] and self.is_kitsu_enabled_in_settings: - set_status_app_start_note= True + if project_settings["set_status_app_start_note"]: self.log.info("Kitsu Status change is Enabled.") else: self.log.info("Kitsu Status change is disabled.") @@ -47,7 +47,9 @@ def execute(self): if not project_settings["app_start_status_shortname"]: self.log.info("App starting status in not configured") return - app_start_status_shortname= project_settings["app_start_status_shortname"] + app_start_status_shortname= project_settings[ + "app_start_status_shortname" + ] if project_settings["app_startstatus_change_conditions"]: status_conditions= project_settings["app_startstatus_change_conditions"] @@ -79,7 +81,7 @@ def execute(self): self.log.info("Failed to recieve kitsu status instance for shortname. Skipping Status change.") return kitsu_wip_status = gazu.task.get_task_status_by_short_name(self.app_start_status_shortname) - + self.log.info("Current Kitsu task status is {task_current_status_shortname}. Task id {kitsuId}") self.log.info("Changing Kitsu task status to {self.app_start_status_shortname}.") @@ -103,4 +105,4 @@ def execute(self): self.log.info("Failed to recieve kitsu pause status instance. Skipping pause Status change.") else: self.log.info("Status not changed due to conditions: {status_conditions}") - gazu.log_out() + gazu.log_out() From a3b8bdfda77b4a5f14fe4d11e7da3c9b851b42b1 Mon Sep 17 00:00:00 2001 From: timsergeeff Date: Thu, 31 Oct 2024 12:37:41 +0300 Subject: [PATCH 45/45] tests --- client/ayon_kitsu/hooks/pre_status_change.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/ayon_kitsu/hooks/pre_status_change.py b/client/ayon_kitsu/hooks/pre_status_change.py index 37e86e7..571e9fb 100644 --- a/client/ayon_kitsu/hooks/pre_status_change.py +++ b/client/ayon_kitsu/hooks/pre_status_change.py @@ -62,7 +62,7 @@ def execute(self): if not self.data["task_entity"]["data"].get("kitsuId"): self.log.info("This task does not have a kitsu task id. Skipping kitsu task status change.") return - + kitsuId = self.data["task_entity"]["data"]["kitsuId"] task=gazu.task.get_task(kitsuId) task_current_status_shortname= task["task_status"]["short_name"] @@ -83,7 +83,6 @@ def execute(self): kitsu_wip_status = gazu.task.get_task_status_by_short_name(self.app_start_status_shortname) self.log.info("Current Kitsu task status is {task_current_status_shortname}. Task id {kitsuId}") - self.log.info("Changing Kitsu task status to {self.app_start_status_shortname}.") gazu.task.add_comment(task["id"], kitsu_wip_status)