Process
Process
Process(manager: Manager)
flowchart LR
publisher.core.Process[Process]
click publisher.core.Process href "" "publisher.core.Process"
Abstract base class for all processes in the task publishing pipeline.
Attributes:
name (str): The name of the process.
compulsory (bool): Indicates if the process is mandatory.
status (bool): The status of the process (True for success, False for failure, None for not yet executed).
info (str): Information or description of the process.
errors (list): A list of ErrorProcess objects representing errors encountered during execution.
context (Context): A reference to the shared Context object for data exchange.
callbacks (dict): A dict of callback functions to be executed when a specified action occurs.
.
Methods:
-
add_callback–Adds a callback function to be executed after the process finishes.
-
add_error–Adds an error to the list of errors.
-
process–The core logic of the process. This method should be implemented by subclasses with specific logic for the process.
-
set_status–Sets the status of the process.
Attributes:
-
callbacks(Dict[Type[Callback], Callable]) –Returns the dict of registered callbacks.
-
context(Context) –Returns the shared context.
-
errors(List[ErrorProcess]) –Returns the list of errors encountered during execution.
-
status(StatusProcess) –Returns the current status of the process.
callbacks
property
callbacks: Dict[Type[Callback], Callable]
Returns the dict of registered callbacks.
add_callback
add_callback(callback_type: Callback, callback: callable) -> None
Adds a callback function to be executed after the process finishes.
add_error
add_error(error: Optional[str] = 'Unknown error', details: Optional[str] = 'Unknown details', items: Optional[List[str]] = None) -> None
Adds an error to the list of errors.
Parameters:
-
(errorstr, default:'Unknown error') –The error message or name.
-
(detailsstr, default:'Unknown details') –Detailed description of the error.
-
(itemslist, default:None) –Optional list of items related to the error.
process
abstractmethod
The core logic of the process. This method should be implemented by subclasses with specific logic for the process.
Parameters:
-
(contextContext) –The shared context for accessing and storing data during execution.
Raises:
-
NotImplementedError–If the subclass does not implement this method.
set_status
set_status(status: StatusProcess) -> None