Skip to content
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

Publisher: Exception for artist error #861

Merged
merged 35 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
050f816
controller has new method 'get_error_info'
iLLiCiTiT Sep 2, 2024
830dd06
added new 'PublishArtistError'
iLLiCiTiT Sep 2, 2024
f5c331b
change docstring of KnownPublishError
iLLiCiTiT Sep 2, 2024
f45af87
handle PublishArtistError in a different way
iLLiCiTiT Sep 2, 2024
90bc20a
modified crash widget to show error info
iLLiCiTiT Sep 2, 2024
2c362fb
removed detail from default behavior
iLLiCiTiT Sep 2, 2024
a1ed54c
added some typehints
iLLiCiTiT Sep 2, 2024
82ac6b3
normalize collapse/expand pixmaps
iLLiCiTiT Sep 2, 2024
cd67397
fix hiding details
iLLiCiTiT Sep 2, 2024
1068423
added line at the start of details too (shorter)
iLLiCiTiT Sep 2, 2024
71623cd
fill title if is not avaialble in exception
iLLiCiTiT Sep 2, 2024
47e921a
renamed 'PublishArtistError' to 'PublishError'
iLLiCiTiT Sep 2, 2024
4875cbe
added deprecation warning
iLLiCiTiT Sep 2, 2024
c70a44f
updated readme
iLLiCiTiT Sep 2, 2024
17f76c7
use explicit margins
iLLiCiTiT Sep 10, 2024
56b8ca9
added is_unknown_error to error info
iLLiCiTiT Sep 10, 2024
58fc67e
make logs visible based on unknown error
iLLiCiTiT Sep 10, 2024
079a796
move crash widget to left
iLLiCiTiT Sep 10, 2024
7a6484e
Merge branch 'develop' into enhancement/exception-for-artist-error
iLLiCiTiT Sep 10, 2024
89d2f14
Merge branch 'develop' into enhancement/exception-for-artist-error
iLLiCiTiT Sep 12, 2024
0b35227
fix images used for collapsed widget
iLLiCiTiT Sep 13, 2024
a14df29
don't show detail until it should be visible
iLLiCiTiT Sep 13, 2024
9cbfecf
fill title in exception if is missing
iLLiCiTiT Sep 13, 2024
d3d2f83
added message to error info and simplified initialization
iLLiCiTiT Sep 13, 2024
d62b31c
fix error message shown in progress bar
iLLiCiTiT Sep 13, 2024
b4e0e32
show publish error as validation error
iLLiCiTiT Sep 13, 2024
5be47d4
better typehint
iLLiCiTiT Sep 13, 2024
7ca0a35
remove double line
iLLiCiTiT Sep 13, 2024
882d61f
refactored validation error handling to publish error handling
iLLiCiTiT Sep 13, 2024
2fd99f2
fix expand button
iLLiCiTiT Sep 13, 2024
774a7f7
Merge branch 'develop' into enhancement/exception-for-artist-error
iLLiCiTiT Sep 13, 2024
ac8848d
fix crash widget layour
iLLiCiTiT Sep 19, 2024
f5182f2
fix success publish page
iLLiCiTiT Sep 19, 2024
b2b933b
fix and simplify the visibility
iLLiCiTiT Sep 19, 2024
82d77d2
Merge branch 'develop' into enhancement/exception-for-artist-error
MustafaJafar Sep 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions client/ayon_core/pipeline/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
)

from .publish import (
KnownPublishError,
PublishError,
PublishValidationError,
PublishXmlValidationError,
KnownPublishError,
AYONPyblishPluginMixin,
OptionalPyblishPluginMixin,
)
Expand Down Expand Up @@ -162,9 +163,10 @@
"get_repres_contexts",

# --- Publish ---
"KnownPublishError",
"PublishError",
"PublishValidationError",
"PublishXmlValidationError",
"KnownPublishError",
"AYONPyblishPluginMixin",
"OptionalPyblishPluginMixin",

Expand Down
18 changes: 10 additions & 8 deletions client/ayon_core/pipeline/publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@ AYON is using `pyblish` for publishing process which is a little bit extented an
## Exceptions
AYON define few specific exceptions that should be used in publish plugins.

### Validation exception
Validation plugins should raise `PublishValidationError` to show to an artist what's wrong and give him actions to fix it. The exception says that error happened in plugin can be fixed by artist himself (with or without action on plugin). Any other errors will stop publishing immediately. Exception `PublishValidationError` raised after validation order has same effect as any other exception.
### Publish error
Exception `PublishError` can be raised on known error. The message is shown to artist.
- **message** Error message.
- **title** Short description of error (2-5 words). Title can be used for grouping of exceptions per plugin.
- **description** Override of 'message' for UI, you can add markdown and html. By default, is filled with 'message'.
- **detail** Additional detail message that is hidden under collapsed component.

Exception `PublishValidationError` 3 arguments:
- **message** Which is not used in UI but for headless publishing.
- **title** Short description of error (2-5 words). Title is used for grouping of exceptions per plugin.
- **description** Detailed description of happened issue where markdown and html can be used.
Arguments `title`, `description` and `detail` are optional. Title is filled with generic message "This is not your fault" if is not passed.

### Validation exception
Validation plugins should raise `PublishValidationError` to show to an artist what's wrong and give him actions to fix it. The exception says that error happened in plugin can be fixed by artist himself (with or without action on plugin). Any other errors will stop publishing immediately. Exception `PublishValidationError` raised after validation order has same effect as any other exception.

### Known errors
When there is a known error that can't be fixed by user (e.g. can't connect to deadline service, etc.) `KnownPublishError` should be raise. The only difference is that it's message is shown in UI to artist otherwise a neutral message without context is shown.
Exception expect same arguments as `PublishError`. Value of `title` is filled with plugin label if is not passed.

## Plugin extension
Publish plugins can be extended by additional logic when inherits from `AYONPyblishPluginMixin` which can be used as mixin (additional inheritance of class).
Expand Down
8 changes: 6 additions & 2 deletions client/ayon_core/pipeline/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
AbstractMetaInstancePlugin,
AbstractMetaContextPlugin,

KnownPublishError,
PublishError,
PublishValidationError,
PublishXmlValidationError,
KnownPublishError,

AYONPyblishPluginMixin,
OptionalPyblishPluginMixin,

Expand Down Expand Up @@ -61,9 +63,11 @@
"AbstractMetaInstancePlugin",
"AbstractMetaContextPlugin",

"KnownPublishError",
"PublishError",
"PublishValidationError",
"PublishXmlValidationError",
"KnownPublishError",

"AYONPyblishPluginMixin",
"OptionalPyblishPluginMixin",

Expand Down
56 changes: 36 additions & 20 deletions client/ayon_core/pipeline/publish/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,52 @@ class AbstractMetaContextPlugin(ABCMeta, ExplicitMetaPlugin):
pass


class PublishValidationError(Exception):
"""Validation error happened during publishing.
class KnownPublishError(Exception):
"""Publishing crashed because of known error.

This exception should be used when validation publishing failed.
Artist can't affect source of the error.

Has additional UI specific attributes that may be handy for artist.
Deprecated:
Please use `PublishError` instead. Marked as deprecated 24/09/02.

Args:
message(str): Message of error. Short explanation an issue.
title(str): Title showed in UI. All instances are grouped under
single title.
description(str): Detailed description of an error. It is possible
to use Markdown syntax.
"""
pass


class PublishError(Exception):
"""Publishing crashed because of known error.

Message will be shown in UI for artist.

Args:
message (str): Message of error. Short explanation an issue.
title (Optional[str]): Title showed in UI.
description (Optional[str]): Detailed description of an error.
It is possible to use Markdown syntax.

"""
def __init__(self, message, title=None, description=None, detail=None):
self.message = message
self.title = title
self.description = description or message
self.detail = detail
super(PublishValidationError, self).__init__(message)
super().__init__(message)


class PublishValidationError(PublishError):
"""Validation error happened during publishing.

This exception should be used when validation publishing failed.

Publishing does not stop during validation order if this
exception is raised.

Has additional UI specific attributes that may be handy for artist.

Argument 'title' is used to group errors.

"""
pass


class PublishXmlValidationError(PublishValidationError):
Expand All @@ -68,15 +93,6 @@ def __init__(
)


class KnownPublishError(Exception):
"""Publishing crashed because of known error.

Message will be shown in UI for artist.
"""

pass


class AYONPyblishPluginMixin:
# TODO
# executable_in_thread = False
Expand Down
16 changes: 8 additions & 8 deletions client/ayon_core/style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1118,39 +1118,39 @@ ValidationArtistMessage QLabel {
font-weight: bold;
}

#ValidationActionButton {
#PublishActionButton {
border-radius: 0.2em;
padding: 4px 6px 4px 6px;
background: {color:bg-buttons};
}

#ValidationActionButton:hover {
#PublishActionButton:hover {
background: {color:bg-buttons-hover};
color: {color:font-hover};
}

#ValidationActionButton:disabled {
#PublishActionButton:disabled {
background: {color:bg-buttons-disabled};
}

#ValidationErrorTitleFrame {
#PublishErrorTitleFrame {
border-radius: 0.2em;
background: {color:bg-buttons};
}

#ValidationErrorTitleFrame:hover {
#PublishErrorTitleFrame:hover {
background: {color:bg-buttons-hover};
}

#ValidationErrorTitleFrame[selected="1"] {
#PublishErrorTitleFrame[selected="1"] {
background: {color:bg-view-selection};
}

#ValidationErrorInstanceList {
#PublishErrorInstanceList {
border-radius: 0;
}

#ValidationErrorInstanceList::item {
#PublishErrorInstanceList::item {
border-bottom: 1px solid {color:border};
border-left: 1px solid {color:border};
}
Expand Down
11 changes: 5 additions & 6 deletions client/ayon_core/tools/publisher/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)

if TYPE_CHECKING:
from .models import CreatorItem
from .models import CreatorItem, PublishErrorInfo


class CardMessageTypes:
Expand Down Expand Up @@ -543,22 +543,21 @@ def get_publish_max_progress(self) -> int:
pass

@abstractmethod
def get_publish_error_msg(self) -> Union[str, None]:
def get_publish_error_info(self) -> Optional["PublishErrorInfo"]:
"""Current error message which cause fail of publishing.

Returns:
Union[str, None]: Message which will be showed to artist or
None.
"""
Optional[PublishErrorInfo]: Error info or None.

"""
pass

@abstractmethod
def get_publish_report(self) -> Dict[str, Any]:
pass

@abstractmethod
def get_validation_errors(self):
def get_publish_errors_report(self):
pass

@abstractmethod
Expand Down
8 changes: 4 additions & 4 deletions client/ayon_core/tools/publisher/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,14 @@ def get_publish_max_progress(self):
def get_publish_progress(self):
return self._publish_model.get_progress()

def get_publish_error_msg(self):
return self._publish_model.get_error_msg()
def get_publish_error_info(self):
return self._publish_model.get_error_info()

def get_publish_report(self):
return self._publish_model.get_publish_report()

def get_validation_errors(self):
return self._publish_model.get_validation_errors()
def get_publish_errors_report(self):
return self._publish_model.get_publish_errors_report()

def set_comment(self, comment):
"""Set comment from ui to pyblish context.
Expand Down
3 changes: 2 additions & 1 deletion client/ayon_core/tools/publisher/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from .create import CreateModel, CreatorItem
from .publish import PublishModel
from .publish import PublishModel, PublishErrorInfo


__all__ = (
"CreateModel",
"CreatorItem",

"PublishModel",
"PublishErrorInfo",
)
Loading