mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
move some generic checks from iterator
This commit is contained in:
parent
b2c9ea3125
commit
a39c96ea06
1 changed files with 16 additions and 23 deletions
|
|
@ -829,7 +829,9 @@ class PublishModel:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Plugin iterator
|
# Plugin iterator
|
||||||
self._main_thread_iter: Iterable[partial] = self._default_iterator()
|
self._main_thread_iter: collections.abc.Generator[partial] = (
|
||||||
|
self._default_iterator()
|
||||||
|
)
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
create_context = self._controller.get_create_context()
|
create_context = self._controller.get_create_context()
|
||||||
|
|
@ -898,17 +900,19 @@ class PublishModel:
|
||||||
# Validations of progress before using iterator
|
# Validations of progress before using iterator
|
||||||
# - same conditions may be inside iterator but they may be used
|
# - same conditions may be inside iterator but they may be used
|
||||||
# only in specific cases (e.g. when it happens for a first time)
|
# only in specific cases (e.g. when it happens for a first time)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
# There are validation errors and validation is passed
|
|
||||||
# - can't do any progree
|
|
||||||
(
|
|
||||||
self._publish_has_validated
|
|
||||||
and self._publish_has_validation_errors
|
|
||||||
)
|
|
||||||
# Any unexpected error happened
|
# Any unexpected error happened
|
||||||
# - everything should stop
|
# - everything should stop
|
||||||
or self._publish_has_crashed
|
self._publish_has_crashed
|
||||||
|
# Stop if validation is over and validation errors happened
|
||||||
|
# or publishing should stop at validation
|
||||||
|
or (
|
||||||
|
self._publish_has_validated
|
||||||
|
and (
|
||||||
|
self._publish_has_validation_errors
|
||||||
|
or self._publish_up_validation
|
||||||
|
)
|
||||||
|
)
|
||||||
):
|
):
|
||||||
item = partial(self.stop_publish)
|
item = partial(self.stop_publish)
|
||||||
|
|
||||||
|
|
@ -1074,8 +1078,9 @@ class PublishModel:
|
||||||
|
|
||||||
Should be replaced by real iterator when 'reset' is called.
|
Should be replaced by real iterator when 'reset' is called.
|
||||||
|
|
||||||
Yields:
|
Returns:
|
||||||
partial: Function that will be called in main thread.
|
collections.abc.Generator[partial]: Generator with partial
|
||||||
|
functions that should be called in main thread.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
|
|
@ -1117,18 +1122,6 @@ class PublishModel:
|
||||||
plugin.order >= self._validation_order
|
plugin.order >= self._validation_order
|
||||||
)
|
)
|
||||||
|
|
||||||
# Stop if plugin is over validation order and process
|
|
||||||
# should process up to validation.
|
|
||||||
if self._publish_up_validation and self._publish_has_validated:
|
|
||||||
yield partial(self.stop_publish)
|
|
||||||
|
|
||||||
# Stop if validation is over and validation errors happened
|
|
||||||
if (
|
|
||||||
self._publish_has_validated
|
|
||||||
and self.has_validation_errors()
|
|
||||||
):
|
|
||||||
yield partial(self.stop_publish)
|
|
||||||
|
|
||||||
# Add plugin to publish report
|
# Add plugin to publish report
|
||||||
self._publish_report.add_plugin_iter(
|
self._publish_report.add_plugin_iter(
|
||||||
plugin.id, self._publish_context)
|
plugin.id, self._publish_context)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue