Skip to content

Commit

Permalink
Fix stop engine message
Browse files Browse the repository at this point in the history
Execution direction was accidentally converted to string in
SpineEngine._stop_item()

Re spine-tools/Spine-Toolbox#2523
  • Loading branch information
soininen committed Apr 25, 2024
1 parent 9907b05 commit 7d1b6b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions spine_engine/server/util/event_data_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ 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)


Expand All @@ -151,8 +152,9 @@ def convert_execution_direction(direction):
Returns:
ExecutionDirection: Enum if given str is valid, None otherwise.
"""
directions = dict()
directions["FORWARD"] = ExecutionDirection.FORWARD
directions["BACKWARD"] = ExecutionDirection.BACKWARD
directions["NONE"] = ExecutionDirection.NONE
directions = {
"FORWARD": ExecutionDirection.FORWARD,
"BACKWARD": ExecutionDirection.BACKWARD,
"NONE": ExecutionDirection.NONE,
}
return directions.get(direction, None)
2 changes: 1 addition & 1 deletion spine_engine/spine_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def _stop_item(self, item):
"exec_finished",
{
"item_name": item.name,
"direction": str(ED.FORWARD),
"direction": ED.FORWARD,
"state": str(self._state),
"item_state": ItemExecutionFinishState.STOPPED,
},
Expand Down

0 comments on commit 7d1b6b7

Please sign in to comment.