Belle II Software development
run_processor.py
1#! /usr/bin/env python
2
3
10
11import os
12import sys
13import signal
14import subprocess
15
16global proc
17
18
19# Signal Handler
20def cleanup(num, frame):
21 # os.kill(proc.pid, signal.SIGKILL)
22 # os.kill(proc.pid, signal.SIGINT)
23 os.killpg(proc.pid, signal.SIGINT)
24 exit()
25
26# main
27
28
29# Signal Handler
30signal.signal(signal.SIGINT, cleanup)
31signal.signal(signal.SIGTERM, cleanup)
32
33# Obtain input/output RingBuffer names
34argvs = sys.argv
35argc = len(argvs)
36
37inputrb = argvs[1]
38outputrb = argvs[2]
39histport = argvs[3]
40# ncore = argvs[4]
41ncore = "20"
42
43script = "processor.py"
44
45# run basf2
46proc = subprocess.Popen("basf2 --no-stats " + script + " " + inputrb + " " + outputrb +
47 " " + histport + " " + ncore, shell=True, preexec_fn=os.setsid)
48
49# Just sleep
50proc.wait()