-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest_receive.py
46 lines (34 loc) · 1.32 KB
/
test_receive.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
43
44
45
import pika_wrapper
import trapum_pipeline_wrapper
from trapum_pipeline_wrapper import TrapumPipelineWrapper
import optparse
from sqlalchemy.pool import NullPool
#process_manager = PikaProcess(...)
#pipeline_wrapper = TrapumPipelineWrapper(..., null_pipeline)
#process_manager.process(pipeline_wrapper.on_receive)
def null_pipeline(data):
output_dps = []
'''
required from pipeline: Filetype, filename, beam id , pointing id, directory
'''
for pointing in data["data"]["pointings"]:
for beam in pointing["beams"]:
# Processing happens here
dp = dict(
type="peasoup_xml",
filename="overview.xml",
directory=data["base_output_dir"],
beam_id = beam["id"],
pointing_id = pointing["id"]
)
output_dps.append(dp)
return output_dps
if __name__ == '__main__':
parser = optparse.OptionParser()
pika_wrapper.add_pika_process_opts(parser)
TrapumPipelineWrapper.add_options(...,parser)
opts,args = parser.parse_args()
#processor = pika_wrapper.PikaProcess(...)
processor = pika_wrapper.pika_process_from_opts(opts)
pipeline_wrapper = TrapumPipelineWrapper(opts.database,null_pipeline)
processor.process(pipeline_wrapper.on_receive)