remove ProcessContext methods

This commit is contained in:
Jakub Trllo 2024-08-20 19:14:22 +02:00
parent 3bc9933991
commit 173b2f2727
2 changed files with 1 additions and 47 deletions

View file

@ -117,47 +117,6 @@ class ProcessContext:
if kwargs:
unknown_keys = ", ".join([f'"{key}"' for key in kwargs.keys()])
print(f"Unknown keys in ProcessContext: {unknown_keys}")
self._prepared: bool = False
self._exception: Optional[Exception] = None
def is_prepared(self) -> bool:
"""Preparation of process finished.
Returns:
bool: Preparation is done.
"""
return self._prepared
def set_prepared(self):
"""Mark process as prepared."""
self._prepared = True
def preparation_failed(self) -> bool:
"""Preparation failed.
Returns:
bool: Preparation failed.
"""
return self._exception is not None
def get_exception(self) -> Optional[Exception]:
"""Get exception that occurred during preparation.
Returns:
Optional[Exception]: Exception that caused preparation fail.
"""
return self._exception
def set_exception(self, exception: Exception):
"""Set exception that occurred during preparation.
Args:
exception (Exception): Exception that caused preparation fail.
"""
self._exception = exception
# Inherit from `object` for Python 2 hosts

View file

@ -94,7 +94,6 @@ def ensure_addons_are_process_context_ready(
if addons_manager is None:
addons_manager = AddonsManager()
exception = None
message = None
failed = False
use_detail = False
@ -111,13 +110,11 @@ def ensure_addons_are_process_context_ready(
addon.ensure_is_process_ready(process_context)
addon_failed = False
except ProcessPreparationError as exc:
exception = exc
message = str(exc)
print(f"Addon preparation failed: '{addon.name}'")
print(message)
except BaseException as exc:
exception = exc
except BaseException:
use_detail = True
message = "An unexpected error occurred."
formatted_traceback = "".join(traceback.format_exception(
@ -133,8 +130,6 @@ def ensure_addons_are_process_context_ready(
failed = True
break
process_context.set_prepared()
process_context.set_exception(exception)
output_str = output.getvalue()
# Print stdout/stderr to console as it was redirected
print(output_str)