File tree Expand file tree Collapse file tree 2 files changed +528
-0
lines changed Expand file tree Collapse file tree 2 files changed +528
-0
lines changed Original file line number Diff line number Diff line change 1+ import state_signals
2+ import time
3+ from multiprocessing import Process
4+
5+ responder = state_signals .SignalResponder (responder_name = "fakeresp" , log_level = "DEBUG" )
6+ def _listener ():
7+ for signal in responder .listen ():
8+ print (signal )
9+ if "tag" in signal and signal ["tag" ] == "bad" :
10+ ras = 0
11+ else :
12+ ras = 1
13+ responder .respond (signal ["publisher_id" ], signal ["event" ], ras )
14+ init = Process (target = _listener )
15+ init .start ()
16+
17+ sig_ex = state_signals .SignalExporter ("fakemark" , log_level = "DEBUG" )
18+ print ("\n BENCHMARK INIT TEST\n " )
19+ sig_ex .initialize (legal_events = ["benchmark-start" , "benchmark-stop" ])
20+ time .sleep (1 )
21+ print ("Proof of response (subs): " + str (sig_ex .subs ))
22+ time .sleep (1 )
23+
24+ print ("\n BENCHMARK START TEST\n " )
25+ result = sig_ex .publish_signal ("benchmark-start" , metadata = {"something" : "cool info" })
26+ time .sleep (1 )
27+ print (f"SUBS CLEARED! Result code: { result } " )
28+ time .sleep (1 )
29+
30+ print ("\n BENCHMARK STOP TEST\n " )
31+ result = sig_ex .publish_signal ("benchmark-stop" , metadata = {"tool" : "give bad resp" }, tag = "bad" )
32+ time .sleep (1 )
33+ print (f"SUBS CLEARED! Result code: { result } " )
34+ time .sleep (1 )
35+
36+ print ("\n BENCHMARK SHUTDOWN TEST\n " )
37+ print ("Listening: " + str (sig_ex .init_listener .is_alive ()))
38+ sig_ex .shutdown ()
39+ time .sleep (1 )
40+ print ("Listening: " + str (sig_ex .init_listener .is_alive ()))
41+ print ("NO LONGER LISTENING, DONE" )
42+
43+ init .terminate ()
44+
You can’t perform that action at this time.
0 commit comments