Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spine Toolbox changes related to ditching Dagster #2715

Merged
merged 6 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Many parts of the Spine data structure have been redesigned.

### Removed
- Project dock widget
- Dependency on Dagster

### Fixed

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-e git+https://github.com/spine-tools/[email protected]#egg=spinedb_api
-e git+https://github.com/spine-tools/spine-engine.git@0.8-dev#egg=spine_engine
-e git+https://github.com/spine-tools/spine-items.git@0.8-dev#egg=spine_items
-e git+https://github.com/spine-tools/spine-engine.git@jumpster#egg=spine_engine
-e git+https://github.com/spine-tools/spine-items.git@issue_2523#egg=spine_items
-e .
4 changes: 2 additions & 2 deletions spinetoolbox/headless.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from spine_engine.exception import EngineInitFailed
from spine_engine.load_project_items import load_item_specification_factories
from spine_engine.utils.serialization import deserialize_path
from spine_engine.utils.helpers import get_file_size
from spine_engine.utils.helpers import get_file_size, ExecutionDirection
from spine_engine.server.util.zip_handler import ZipHandler
from .server.engine_client import EngineClient, RemoteEngineInitFailed, ClientSecurityModel
from .project_item.logging_connection import HeadlessConnection
Expand Down Expand Up @@ -424,7 +424,7 @@ def _handle_node_execution_started(self, data):
Args:
data (dict): execution start data
"""
if data["direction"] == "BACKWARD":
if data["direction"] == ExecutionDirection.BACKWARD:
# Currently there are no interesting messages when executing backwards.
return
self._node_messages[data["item_name"]] = dict()
Expand Down
2 changes: 1 addition & 1 deletion spinetoolbox/project_item/project_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def handle_execution_successful(self, execution_direction, engine_state):
"""Performs item dependent actions after the execution item has finished successfully.

Args:
execution_direction (str): "FORWARD" or "BACKWARD"
execution_direction (ExecutionDirection): ExecutionDirection.FORWARD or ExecutionDirection.BACKWARD
engine_state: engine state after item's execution
"""

Expand Down
5 changes: 3 additions & 2 deletions spinetoolbox/spine_engine_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from PySide6.QtCore import Signal, Slot, QObject, QThread
from spine_engine.exception import EngineInitFailed, RemoteEngineInitFailed
from spine_engine.spine_engine import ItemExecutionFinishState, SpineEngineState
from spine_engine.utils.helpers import ExecutionDirection
from .widgets.options_dialog import OptionsDialog
from .spine_engine_manager import make_engine_manager, LocalSpineEngineManager

Expand All @@ -34,7 +35,7 @@ def _handle_node_execution_ignored(project_items):
@Slot(object, object)
def _handle_node_execution_started(item, direction):
icon = item.get_icon()
if direction == "FORWARD":
if direction == ExecutionDirection.FORWARD:
icon.execution_icon.mark_execution_started()
if hasattr(icon, "animation_signaller"):
icon.animation_signaller.animation_started.emit()
Expand All @@ -43,7 +44,7 @@ def _handle_node_execution_started(item, direction):
@Slot(object, object, object, object)
def _handle_node_execution_finished(item, direction, item_state):
icon = item.get_icon()
if direction == "FORWARD":
if direction == ExecutionDirection.FORWARD:
icon.execution_icon.mark_execution_finished(item_state)
if hasattr(icon, "animation_signaller"):
icon.animation_signaller.animation_stopped.emit()
Expand Down
17 changes: 9 additions & 8 deletions tests/server/test_RemoteSpineEngineManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from spinetoolbox.spine_engine_manager import RemoteSpineEngineManager
from spine_engine import ItemExecutionFinishState
from spine_engine.server.util.event_data_converter import EventDataConverter
from spine_engine.utils.helpers import ExecutionDirection


class TestRemoteSpineEngineManager(unittest.TestCase):
Expand Down Expand Up @@ -62,17 +63,17 @@ def yield_events_dag_succeeds():
# Convert some events fresh from SpineEngine first into
# (bytes) json strings to simulate events that arrive to EngineClient
engine_events = [
("exec_started", {"item_name": "Data Connection 1", "direction": "BACKWARD"}),
("exec_started", {"item_name": "Data Connection 1", "direction": ExecutionDirection.BACKWARD}),
(
"exec_finished",
{
"item_name": "Data Connection 1",
"direction": "BACKWARD",
"direction": ExecutionDirection.BACKWARD,
"state": "RUNNING",
"item_state": ItemExecutionFinishState.SUCCESS,
},
),
("exec_started", {"item_name": "Data Connection 1", "direction": "FORWARD"}),
("exec_started", {"item_name": "Data Connection 1", "direction": ExecutionDirection.FORWARD}),
(
"event_msg",
{
Expand All @@ -86,7 +87,7 @@ def yield_events_dag_succeeds():
"exec_finished",
{
"item_name": "Data Connection 1",
"direction": "FORWARD",
"direction": ExecutionDirection.FORWARD,
"state": "RUNNING",
"item_state": ItemExecutionFinishState.SUCCESS,
},
Expand All @@ -104,17 +105,17 @@ def yield_events_dag_succeeds():
def yield_events_dag_fails():
"""Received event generator. Yields events that look like they were PULLed from server."""
engine_events = [
("exec_started", {"item_name": "Data Connection 1", "direction": "BACKWARD"}),
("exec_started", {"item_name": "Data Connection 1", "direction": ExecutionDirection.BACKWARD}),
(
"exec_finished",
{
"item_name": "Data Connection 1",
"direction": "BACKWARD",
"direction": ExecutionDirection.BACKWARD,
"state": "RUNNING",
"item_state": ItemExecutionFinishState.FAILURE,
},
),
("exec_started", {"item_name": "Data Connection 1", "direction": "FORWARD"}),
("exec_started", {"item_name": "Data Connection 1", "direction": ExecutionDirection.FORWARD}),
(
"event_msg",
{
Expand All @@ -128,7 +129,7 @@ def yield_events_dag_fails():
"exec_finished",
{
"item_name": "Data Connection 1",
"direction": "FORWARD",
"direction": ExecutionDirection.FORWARD,
"state": "RUNNING",
"item_state": ItemExecutionFinishState.FAILURE,
},
Expand Down