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

Jumpster #136

Merged
merged 13 commits into from
Apr 25, 2024
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ classifiers = [
]
requires-python = ">=3.8.1, <3.12"
dependencies = [
# dagster >= 0.12.9 requires alembic that is incompatible with spinedb_api
"dagster>=0.12.6, <0.12.9",
# dagster versions lower that 1.5.7 do not support pendulum >= 3.0.0
"pendulum < 3.0.0",
# https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
Expand Down
396 changes: 396 additions & 0 deletions spine_engine/jumpster.py

Large diffs are not rendered by default.

11 changes: 0 additions & 11 deletions spine_engine/multithread_executor/__init__.py

This file was deleted.

56 changes: 0 additions & 56 deletions spine_engine/multithread_executor/executor.py

This file was deleted.

319 changes: 0 additions & 319 deletions spine_engine/multithread_executor/multithread.py

This file was deleted.

120 changes: 0 additions & 120 deletions spine_engine/multithread_executor/thread_executor.py

This file was deleted.

3 changes: 0 additions & 3 deletions spine_engine/project_item/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,7 @@ def __init__(
self._resources_from_destination = set()
self.cmd_line_args = list(cmd_line_args)
self._engine = None
self.source_solid = None
self.destination_solid = None
self.item_names = set()
self.solid_names = set()

def set_engine(self, engine):
self._engine = engine
Expand Down
42 changes: 31 additions & 11 deletions spine_engine/server/util/event_data_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
# this program. If not, see <http://www.gnu.org/licenses/>.
######################################################################################################################

"""
Contains static methods for converting event and data information to JSON format and back.
"""

"""Contains static methods for converting event and data information to JSON format and back."""
import base64
import json
from spine_engine.spine_engine import ItemExecutionFinishState
from spine_engine.utils.helpers import ExecutionDirection


class EventDataConverter:
Expand Down Expand Up @@ -94,6 +92,8 @@ def break_event_data(event_type, data):
data["connection_file_dict"] = connection_file_dict
except json.decoder.JSONDecodeError:
print(f"Error loading connection file {data['connection_file']}. Invalid JSON.")
if "direction" in data.keys():
data["direction"] = str(data["direction"]) # Cast ExecutionDirection instance to string
for key in data.keys():
# Print warning if there are any tuples used as keys in the data dictionary.
# Tuples are converted to lists by json.dumps(). Lists must be converted back to tuples
Expand All @@ -118,6 +118,8 @@ def fix_event_data(event):
return event
if "item_state" in event[1].keys():
event[1]["item_state"] = convert_execution_finish_state(event[1]["item_state"])
if "direction" in event[1].keys():
event[1]["direction"] = convert_execution_direction(event[1]["direction"])
return event


Expand All @@ -130,11 +132,29 @@ def convert_execution_finish_state(state):
Returns:
ItemExecutionFinishState: Enum if given str is valid, None otherwise.
"""
states = dict()
states["SUCCESS"] = ItemExecutionFinishState.SUCCESS
states["FAILURE"] = ItemExecutionFinishState.FAILURE
states["SKIPPED"] = ItemExecutionFinishState.SKIPPED
states["EXCLUDED"] = ItemExecutionFinishState.EXCLUDED
states["STOPPED"] = ItemExecutionFinishState.STOPPED
states["NEVER_FINISHED"] = ItemExecutionFinishState.NEVER_FINISHED
states = {
"SUCCESS": ItemExecutionFinishState.SUCCESS,
"FAILURE": ItemExecutionFinishState.FAILURE,
"SKIPPED": ItemExecutionFinishState.SKIPPED,
"EXCLUDED": ItemExecutionFinishState.EXCLUDED,
"STOPPED": ItemExecutionFinishState.STOPPED,
"NEVER_FINISHED": ItemExecutionFinishState.NEVER_FINISHED,
}
return states.get(state, None)


def convert_execution_direction(direction):
"""Transforms direction string into an ExecutionDirection enum.

Args:
direction (str): Direction as string

Returns:
ExecutionDirection: Enum if given str is valid, None otherwise.
"""
directions = {
"FORWARD": ExecutionDirection.FORWARD,
"BACKWARD": ExecutionDirection.BACKWARD,
"NONE": ExecutionDirection.NONE,
}
return directions.get(direction, None)
37 changes: 0 additions & 37 deletions spine_engine/shared_memory_io_manager.py

This file was deleted.

Loading