-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Status change on user action #73
Open
timsergeeff
wants to merge
47
commits into
ynput:develop
Choose a base branch
from
timsergeeff:feature
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
5646155
Now when we scart task from AYON we see WIP status
timsergeeff 8be86c8
Update pre_status_cahnge.py
timsergeeff 16809f4
Apply suggestions from code review
timsergeeff f520094
Feature status change on user actions
timsergeeff 0f80294
q
timsergeeff 1986328
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 1ef9986
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff a30a67d
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 951c874
Update package.py
timsergeeff 3a54d77
Update server/settings/publish_plugins.py
timsergeeff 6e079ff
Update server/settings/app_start.py
timsergeeff 7522617
Update server/settings/app_start.py
timsergeeff 871c1c4
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 51be2e8
Update client/ayon_kitsu/version.py
timsergeeff 792d097
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 324d1fd
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 01d0a78
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff ebea911
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff ab37014
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff f8aecab
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff 199ce1c
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff 2e63589
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff ca06642
Update client/ayon_kitsu/plugins/publish/integrate_kitsu_note.py
timsergeeff 2735be6
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff e18410f
Update client/ayon_kitsu/addon.py
timsergeeff 7028b6a
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 7a1c455
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 1a55b6f
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff fd68f03
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 1bd7d5a
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 6bbd396
Update server/settings/app_start.py
timsergeeff 1447316
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 934fd0f
Update client/ayon_kitsu/hooks/pre_status_cahnge.py
timsergeeff 55a585e
Rename pre_status_cahnge.py to pre_status_change.py
timsergeeff e1af2da
Update integrate_kitsu_note.py
timsergeeff fe825c0
Merge branch 'ynput:develop' into feature
timsergeeff d887d10
fix render farm instance tag
timsergeeff 8abe493
fix farm render target using instace farm
timsergeeff bd7ed98
Merge branch 'feature' of https://github.com/timsergeeff/ayon-kitsu i…
timsergeeff 87ef0d5
Update addon.py
timsergeeff 653c0bb
Update version.py
timsergeeff 1d0cf22
Update package.py
timsergeeff 3c66ba9
Update pre_status_change.py
timsergeeff 2cfc432
Update pre_status_change.py
timsergeeff 2df77f4
fix tests
timsergeeff 623c5b3
tests
timsergeeff a3b8bdf
tests
timsergeeff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ __pycache__ | |
.vscode | ||
poetry.lock | ||
package/ | ||
package.py | ||
|
||
frontend/node_modules | ||
frontend/dist | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
from ayon_applications import PostLaunchHook | ||
|
||
import os | ||
import gazu | ||
|
||
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() | ||
|
||
# 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): | ||
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"]: | ||
self.log.info("Kitsu Status change is Enabled.") | ||
else: | ||
self.log.info("Kitsu Status change is disabled.") | ||
return | ||
|
||
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" | ||
] | ||
|
||
if project_settings["app_startstatus_change_conditions"]: | ||
status_conditions= project_settings["app_startstatus_change_conditions"] | ||
else: | ||
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("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: | ||
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("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}.") | ||
|
||
gazu.task.add_comment(task["id"], kitsu_wip_status) | ||
|
||
if not project_settings["set_pause_status_to_other_tasks"]: | ||
self.log.info("Pausing all other tasks with same status disabled.") | ||
else: | ||
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) | ||
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("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() |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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") | ||
pause_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, | ||
"pause_status_shortname": "pause", | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A “line too long” happens when the number of the characters per line exceeds the maximum number specified in repo.
ayon-kitsu/ruff.toml
Line 33 in 98266f8
personally, I prefer to have some display in my IDE to tell me the number of characters in my line.
Fixes are mostly like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also even better - if you setup strict linter rules in an IDE (code editor) you can have it auto-correct the formatting for you. That way you don't need to do this manually.