spinetoolbox.project_items.gimlet.executable_item¶
Contains Gimlet ExecutableItem class.
| author: |
|
|---|---|
| date: | 15.4.2020 |
Module Contents¶
Classes¶
ExecutableItem |
The part of a project item that is executed by the Spine Engine. |
Functions¶
_file_paths_from_resources(resources) |
Pries file paths from resources. |
_database_urls_from_resources(resources) |
Pries database URLs and their providers’ names from resources. |
-
class
spinetoolbox.project_items.gimlet.executable_item.ExecutableItem(name, logger, shell, cmd, work_dir, selected_files)[source]¶ Bases:
spinetoolbox.executable_item_base.ExecutableItemBase,PySide2.QtCore.QObjectThe part of a project item that is executed by the Spine Engine.
Parameters: - name (str) – Project item name
- logger (LoggerInterface) – Logger instance
- shell (str) – Shell name or empty string if no shell should be used
- cmd (list) – Command to execute
- work_dir (str) – Full path to work directory
- selected_files (list) – List of file paths that were selected
-
classmethod
from_dict(cls, item_dict, name, project_dir, app_settings, specifications, logger)[source]¶ See base class.
-
_execute_forward(self, resources)[source]¶ See base class.
Note: resources given here in args is not used. Files to be copied are given by the Gimlet project item based on user selections made in Gimlet properties.
Parameters: resources (list) – List of resources from direct predecessor items Returns: True if execution succeeded, False otherwise
-
_output_resources_forward(self)[source]¶ Returns output resources for forward execution.
Returns: (list) List of ProjectItemResources.
-
_output_resources_backward(self)[source]¶ Returns output resources for backward execution. The default implementation returns an empty list.
Returns: (list) List of ProjectItemResources. Just an empty list for now.
-
_handle_gimlet_process_finished(self, ret_code)[source]¶ Handles clean up after Gimlet process has finished. After clean up, emits a signal indicating that this project item execution is done.
-
_copy_files(self, files, work_dir)[source]¶ Copies selected resources (files) to work directory.
Parameters: - files (list) – List of full paths to files that will be copied to work dir
- work_dir (str) – Full path to selected work dir
Returns: True when files were copied successfully, False when something went wrong
Return type: bool
Returns Gimlet’s command as list with special tags expanded.
Tags that will be replaced:
- @@optional_inputs@@ expands to a space-separated list of Gimlet’s optional input files
- @@url:<Data Store name>@@ expands to the URL provided by a named data store
- @@url_inputs@@ expands to a space-separated list of Gimlet’s input database URLs
- @@url_outputs@@ expands to a space-separated list of Gimlet’s output database URLs
Parameters: - cmd (list) – Command that may include tags that should be expanded
- resources (list) – List of resources from direct predecessor items
Returns: Expanded command
Return type: list
-
spinetoolbox.project_items.gimlet.executable_item._file_paths_from_resources(resources)[source]¶ Pries file paths from resources.
Parameters: resources (list) – a list of ProjectItemResource objects Returns: List of file paths. Return type: list
-
spinetoolbox.project_items.gimlet.executable_item._database_urls_from_resources(resources)[source]¶ Pries database URLs and their providers’ names from resources.
Parameters: resources (list) – a list of ProjectItemResource objects Returns: a mapping from resource provider’s name to a database URL. Return type: dict