-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanager.py
42 lines (33 loc) · 1.82 KB
/
manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from praline.core import Manager, BeginMessage, CompleteMessage, ProgressMessage
from praline.component import TreeMultipleSequenceAligner
_INTERCEPT_TIDS = {TreeMultipleSequenceAligner.tid}
class ConstellationManager(Manager):
def execute_many(self, requests, parent_tag):
for tid, inputs, tag, env in requests:
# We're not handling these tasks in this manager, so execute them
# normally using the functionality of the superclass.
if not tid in _INTERCEPT_TIDS:
gen = super(ConstellationManager, self).execute_many(self,
requests,
parent_tag)
for message in gen:
yield message
return
# We want to intercept execution of these tasks and send them off
# to constellation. First pass a message saying we've begun
# executing the tasks.
for tid, inputs, tag, env in requests:
begin_message = BeginMessage(parent_tag)
begin_message.tag = tag
yield begin_message
# TODO: convert task inputs to constellation format, send it to
# Constellation and wait for completion. Yield ProgressMessage
# instances to report progress to the UI if applicable.
# Yield completion messages for the tasks, containing the outputs
# returned by Constellation.
for tid, inputs, tag, env in requests:
# TODO: convert Constellation results into PRALINE objects.
outputs = None
complete_message = CompleteMessage(outputs=outputs)
complete_message.tag = tag
yield complete_message