4
4
5
5
from abc import ABC , abstractmethod
6
6
from dataclasses import dataclass
7
- from typing import Any , Dict , Optional
7
+ from typing import Any , Callable , Dict , Optional
8
+
9
+ from google .protobuf .message import Message
10
+ from informaticsmatters .protobuf .datamanager .pod_message_pb2 import PodMessage
8
11
9
12
10
13
@dataclass
@@ -29,6 +32,7 @@ def launch(
29
32
workflow_definition : Dict [str , Any ],
30
33
step : str ,
31
34
step_specification : Dict [str , Any ],
35
+ completion_callback : Optional [Callable [[PodMessage ], None ]],
32
36
) -> LaunchResult :
33
37
"""Launch a (Job) Instance"""
34
38
@@ -43,6 +47,11 @@ def launch(
43
47
# step_specification by the WE? Remember that we have to deal with
44
48
# "input Handlers" that manipulate the specification variables.
45
49
# See _instance_preamble() in the DM's api_instance.py module.
50
+ #
51
+ # The completion_callback is only used in local testing and is a function
52
+ # that should be able to process a PodMessage that indicates a workflow Job
53
+ # has completed. When the WorkflowEngine is embedded in the data Manager
54
+ # the Data Manager will not permit the use of this parameter.
46
55
47
56
48
57
class DatabaseAdapter (ABC ):
@@ -79,3 +88,11 @@ def get_job(
79
88
version : str ,
80
89
) -> Optional [Dict [str , Any ]]:
81
90
"""Get a Job"""
91
+
92
+
93
+ class MessageDispatcher (ABC ):
94
+ """The class handling the sending of messages (on the Data Manager message bus)."""
95
+
96
+ @abstractmethod
97
+ def send (self , message : Message ) -> None :
98
+ """Send a message"""
0 commit comments