Belle II Software development
WorkerTestCase Class Reference
Inheritance diagram for WorkerTestCase:
HLTZMQTestCase DyingWorkerTestCase NormalWorkerTestCase

Public Member Functions

def setUp (self)
 
def start (self)
 

Public Attributes

 needed_programs
 input_socket
 
 output_identity
 output_identity
 
 input_identity
 input_identity
 
 first_run_event_data
 some data
 
 second_run_event_data
 some data
 

Static Public Attributes

open event_data = open(basf2.find_file("daq/hbasf2/tests/out.raw"), "br").read()
 event_data
 
list extra_arguments = []
 extra arguments to pass to the worker script
 

Detailed Description

Test case baseclass to spawn a worker

Definition at line 16 of file test_worker.py.

Member Function Documentation

◆ setUp()

def setUp (   self)
Setup necessary sockets and programs

Reimplemented from HLTZMQTestCase.

Definition at line 24 of file test_worker.py.

24 def setUp(self):
25 """Setup necessary sockets and programs"""
26
27 self.input_socket, input_port = self.create_router_socket(None)
28
29 self.output_socket, output_port = self.create_router_socket(None)
30 # and set the list of necessary programs to use these sockets
31 self.needed_programs = {
32 "worker": [
33 "python3", basf2.find_file("daq/hbasf2/tests/passthrough.no_run_py"),
34 "--input", f"tcp://localhost:{input_port}",
35 "--output", f"tcp://localhost:{output_port}",
36 ] + self.extra_arguments
37 }
38 super().setUp()
39

◆ start()

def start (   self)
start the needed sockets and send some hello messages

Definition at line 40 of file test_worker.py.

40 def start(self):
41 """start the needed sockets and send some hello messages"""
42 # There should be a hello message
43
44 self.output_identity = self.assertIsMsgType(self.output_socket, "h", router=True)[0].decode()
45 self.send(self.output_socket, "c", identity=self.output_identity)
46
47 # There are probably many more ready messages, but we are only interested in at least one here
48
49 self.input_identity = self.assertIsMsgType(self.input_socket, "r", router=True, final=False)[0].decode()
50
51 # Store some example events
52
53 self.first_run_event_data = [self.event_data, self.event_data]
54
55 self.second_run_event_data = [self.event_data, self.event_data]
56
57

Member Data Documentation

◆ event_data

open event_data = open(basf2.find_file("daq/hbasf2/tests/out.raw"), "br").read()
static

event_data

Definition at line 19 of file test_worker.py.

◆ extra_arguments

list extra_arguments = []
static

extra arguments to pass to the worker script

Definition at line 22 of file test_worker.py.

◆ first_run_event_data

first_run_event_data

some data

Definition at line 53 of file test_worker.py.

◆ input_identity

input_identity

input_identity

Definition at line 49 of file test_worker.py.

◆ needed_programs

needed_programs

input_socket

output_socket

Definition at line 31 of file test_worker.py.

◆ output_identity

output_identity

output_identity

Definition at line 44 of file test_worker.py.

◆ second_run_event_data

second_run_event_data

some data

Definition at line 55 of file test_worker.py.


The documentation for this class was generated from the following file: