Skip to content

Commit ca798c8

Browse files
author
Alan Christie
committed
fix: Handler no longer returns a result
1 parent 96fc51e commit ca798c8

File tree

1 file changed

+7
-25
lines changed

1 file changed

+7
-25
lines changed

workflow/workflow_engine.py

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,11 @@
11
"""The WorkflowEngine execution logic.
22
"""
33

4-
from dataclasses import dataclass
5-
from typing import Optional
6-
7-
from informaticsmatters.protobuf.datamanager.pod_message_pb2 import PodMessage
4+
from google.protobuf.message import Message
85

96
from .workflow_abc import DatabaseAdapter, InstanceLauncher
107

118

12-
@dataclass
13-
class HandlePodMessageResult:
14-
"""WorkflowEngine handle message result."""
15-
16-
error: int
17-
error_msg: Optional[str]
18-
19-
20-
_SUCCESS_MESSAGE_RESULT: HandlePodMessageResult = HandlePodMessageResult(
21-
error=0, error_msg=None
22-
)
23-
24-
259
class WorkflowEngine:
2610
"""The workflow engine. An event-driven engine that manages the execution
2711
of workflow instances. The engine is responsible for launching instances or
@@ -38,18 +22,16 @@ def __init__(
3822
self._instance_launcher = instance_launcher
3923
self._db_adapter = db_adapter
4024

41-
def handle_pod_message(
42-
self,
43-
pod_msg: PodMessage,
44-
) -> HandlePodMessageResult:
45-
"""Given a PodMessage, we use it to identify the Pod (Instance) exit code,
25+
def handle_message(self, msg: Message) -> None:
26+
"""Given a Pod Message, we use it to identify the Pod (Instance) exit code,
4627
workflow and step and decide what to do next.
4728
4829
Only pod messages relating to workflow instances will be delivered to this method.
4930
The Pod message has an 'instance' property that provides the UUID of
5031
the instance that was run. This can be used to correlate the instance with the
5132
running workflow step.
52-
"""
53-
assert pod_msg
5433
55-
return _SUCCESS_MESSAGE_RESULT
34+
Additionally we will encounter WorkflowMessages that signal the need to
35+
start and stop workflows.
36+
"""
37+
assert msg

0 commit comments

Comments
 (0)