spinetoolbox.executable_item_base¶
Contains ExecutableItem, a project item’s counterpart in execution as well as support utilities.
| authors: |
|
|---|---|
| date: | 30.3.2020 |
Module Contents¶
Classes¶
ExecutableItemBase |
The part of a project item that is executed by the Spine Engine. |
-
class
spinetoolbox.executable_item_base.ExecutableItemBase(name, logger)[source]¶ The part of a project item that is executed by the Spine Engine.
Parameters: - name (str) – item’s name
- logger (LoggerInterface) – a logger
-
execute(self, resources, direction)[source]¶ Executes this item in the given direction using the given resources and returns a boolean indicating the outcome.
Subclasses need to implement _execute_forward and _execute_backward to do the appropriate work in each direction.
Parameters: - resources (list) – a list of ProjectItemResources available for execution
- direction (ExecutionDirection) – direction of execution
Returns: True if execution succeeded, False otherwise
Return type: bool
-
output_resources(self, direction)[source]¶ Returns output resources in the given direction.
Subclasses need to implement _output_resources_backward and/or _output_resources_forward if they want to provide resources in any direction.
Parameters: direction (ExecutionDirection) – Direction where output resources are passed Returns: a list of ProjectItemResources
-
_execute_forward(self, resources)[source]¶ Executes this item in the forward direction.
The default implementation just returns True.
Parameters: resources (list) – a list of ProjectItemResources available for execution Returns: True if execution succeeded, False otherwise Return type: bool
-
_execute_backward(self, resources)[source]¶ Executes this item in the backward direction.
The default implementation just returns True.
Parameters: resources (list) – a list of ProjectItemResources available for execution Returns: True if execution succeeded, False otherwise Return type: bool
-
_output_resources_forward(self)[source]¶ Returns output resources for forward execution.
The default implementation returns an empty list.
Returns: a list of ProjectItemResources
-
_output_resources_backward(self)[source]¶ Returns output resources for backward execution.
The default implementation returns an empty list.
Returns: a list of ProjectItemResources
-
classmethod
from_dict(cls, item_dict, name, project_dir, app_settings, specifications, logger)[source]¶ Deserializes an executable item from item dictionary.
Parameters: - item_dict (dict) – serialized project item
- name (str) – item’s name
- project_dir (str) – absolute path to the project directory
- app_settings (QSettings) – Toolbox settings
- specifications (dict) – mapping from item specification name to
ProjectItemSpecification - logger (LoggingInterface) – a logger
Returns: deserialized executable item
Return type: