Skip to content

Commit d2eb8d9

Browse files
committed
Added code so clients can send requests to correct worker.
1 parent fcb556b commit d2eb8d9

33 files changed

+783
-111
lines changed

admin/templates/configuration/etc/log4cxx.index.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# export LSST_LOG_CONFIG=$HOME/.lsst/log4cxx.unittest.properties
66
#
77

8-
log4j.rootLogger=INFO, CONSOLE
9-
#log4j.rootLogger=DEBUG, CONSOLE
8+
#log4j.rootLogger=INFO, CONSOLE
9+
log4j.rootLogger=DEBUG, CONSOLE
1010

1111
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
1212
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

admin/tools/docker/index/container/dev/clientNum/appClientNum.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export LSST_LOG_CONFIG=/home/qserv/dev/qserv/admin/templates/configuration/etc/l
1717

1818
echo appClientNum $1 $2 $3
1919

20-
screen -dm gdb --args /home/qserv/dev/qserv/build/loader/appClientNum $1 $2 /home/qserv/dev/qserv/core/modules/loader/config/$3
20+
/home/qserv/dev/qserv/build/loader/appClientNum $1 $2 /home/qserv/dev/qserv/core/modules/loader/config/$3
2121

2222
child=$!
2323
wait "$child"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash -l
2+
# admin/tools/docker/loader/container/dev/clientNum/appClientNum.bash
3+
4+
_term() {
5+
echo "Caught SIGTERM signal!"
6+
kill -TERM "$child" 2>/dev/null
7+
}
8+
9+
trap _term SIGTERM
10+
trap _term SIGKILL
11+
12+
13+
echo appClientScreen $1 $2 $3
14+
15+
screen -dm /home/qserv/dev/qserv/admin/tools/docker/index/container/dev/clientNum/appClientNum $1 $2 $3
16+
17+
child=$!
18+
wait "$child"
19+
tail -f /dev/null

admin/tools/docker/index/container/dev/worker/appWorker.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ setup -r . -t qserv-dev
1515

1616
export LSST_LOG_CONFIG=/home/qserv/dev/qserv/admin/templates/configuration/etc/log4cxx.index.properties
1717

18-
screen -dm gdb --args /home/qserv/dev/qserv/build/loader/appWorker /home/qserv/dev/qserv/core/modules/loader/config/worker-k8s-a.cnf
18+
/home/qserv/dev/qserv/build/loader/appWorker /home/qserv/dev/qserv/core/modules/loader/config/worker-k8s-a.cnf
1919

2020
child=$!
2121
echo "child ${child}"
2222
wait "$child"
2323

2424
sleep 10000
25+
tail -f /dev/null
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#! /bin/bash
2+
# admin/tools/docker/loader/container/dev/worker/appWorker.bash
3+
4+
_term() {
5+
echo "Caught SIGTERM signal!"
6+
kill -TERM "$child" 2>/dev/null
7+
}
8+
9+
trap _term SIGTERM
10+
trap _term SIGKILL
11+
12+
screen -dm /home/qserv/dev/qserv/admin/tools/docker/index/container/dev/worker/appWorker.bash
13+
14+
child=$!
15+
echo "child ${child}"
16+
wait "$child"
17+
18+
sleep 10000
19+
tail -f /dev/null
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: imaster-svc
5+
labels:
6+
app: index
7+
spec:
8+
ports:
9+
- port: 10042
10+
protocol: UDP
11+
clusterIP: None
12+
selector:
13+
app: imaster-pod
14+
---
15+
apiVersion: apps/v1
16+
kind: StatefulSet
17+
metadata:
18+
name: imaster-sts
19+
labels:
20+
app: index
21+
spec:
22+
serviceName: imaster-svc
23+
podManagementPolicy: Parallel
24+
replicas: 1
25+
selector:
26+
matchLabels:
27+
app: imaster-pod
28+
template:
29+
metadata:
30+
labels:
31+
app: imaster-pod
32+
spec:
33+
containers:
34+
- name: imaster-ctr
35+
image: qserv/indexmaster:dev
36+
imagePullPolicy: Always
37+
ports:
38+
- containerPort: 10042
39+
protocol: UDP
40+
---
41+
apiVersion: v1
42+
kind: Service
43+
metadata:
44+
name: iworker-svc
45+
labels:
46+
app: index
47+
spec:
48+
ports:
49+
- port: 10043
50+
protocol: UDP
51+
clusterIP: None
52+
selector:
53+
app: iworker-pod
54+
---
55+
apiVersion: apps/v1
56+
kind: StatefulSet
57+
metadata:
58+
name: iworker-sts
59+
labels:
60+
app: index
61+
spec:
62+
serviceName: iworker-svc
63+
podManagementPolicy: Parallel
64+
replicas: 3
65+
selector:
66+
matchLabels:
67+
app: iworker-pod
68+
template:
69+
metadata:
70+
labels:
71+
app: iworker-pod
72+
spec:
73+
containers:
74+
- name: iworker-ctr
75+
image: qserv/indexworker:dev
76+
imagePullPolicy: Always
77+
ports:
78+
- containerPort: 10043
79+
protocol: UDP
80+
- containerPort: 10143
81+
protocol: TCP
82+
---
83+
apiVersion: v1
84+
kind: Service
85+
metadata:
86+
name: iclientnum-svc
87+
labels:
88+
app: index
89+
spec:
90+
ports:
91+
- port: 10050
92+
protocol: UDP
93+
clusterIP: None
94+
selector:
95+
app: iclientnum-pod
96+
---
97+
apiVersion: apps/v1
98+
kind: StatefulSet
99+
metadata:
100+
name: iclientnum-sts
101+
labels:
102+
app: index
103+
spec:
104+
serviceName: iclientnum-svc
105+
podManagementPolicy: Parallel
106+
replicas: 1
107+
selector:
108+
matchLabels:
109+
app: iclientnum-pod
110+
template:
111+
metadata:
112+
labels:
113+
app: iclientnum-pod
114+
spec:
115+
containers:
116+
- name: iclientnum-ctr
117+
image: qserv/indexclientnum:dev
118+
imagePullPolicy: Always
119+
args: ["1000000", "1", "client-k8s-a1.cnf"]
120+
ports:
121+
- containerPort: 10050
122+
protocol: UDP
123+
---
124+
apiVersion: v1
125+
kind: Service
126+
metadata:
127+
name: iclientnum2-svc
128+
labels:
129+
app: index
130+
spec:
131+
ports:
132+
- port: 10050
133+
protocol: UDP
134+
clusterIP: None
135+
selector:
136+
app: iclientnum2-pod
137+
---
138+
apiVersion: apps/v1
139+
kind: StatefulSet
140+
metadata:
141+
name: iclientnum2-sts
142+
labels:
143+
app: index
144+
spec:
145+
serviceName: iclientnum2-svc
146+
podManagementPolicy: Parallel
147+
replicas: 1
148+
selector:
149+
matchLabels:
150+
app: iclientnum2-pod
151+
template:
152+
metadata:
153+
labels:
154+
app: iclientnum2-pod
155+
spec:
156+
containers:
157+
- name: iclientnum2-ctr
158+
image: qserv/indexclientnum:dev
159+
imagePullPolicy: Always
160+
args: ["2000001", "3000001", "client-k8s-a2.cnf"]
161+
ports:
162+
- containerPort: 10050
163+
protocol: UDP
164+
---
165+
apiVersion: v1
166+
kind: Service
167+
metadata:
168+
name: iclientnum3-svc
169+
labels:
170+
app: index
171+
spec:
172+
ports:
173+
- port: 10050
174+
protocol: UDP
175+
clusterIP: None
176+
selector:
177+
app: iclientnum3-pod
178+
---
179+
apiVersion: apps/v1
180+
kind: StatefulSet
181+
metadata:
182+
name: iclientnum3-sts
183+
labels:
184+
app: index
185+
spec:
186+
serviceName: iclientnum3-svc
187+
podManagementPolicy: Parallel
188+
replicas: 1
189+
selector:
190+
matchLabels:
191+
app: iclientnum3-pod
192+
template:
193+
metadata:
194+
labels:
195+
app: iclientnum3-pod
196+
spec:
197+
containers:
198+
- name: iclientnum3-ctr
199+
image: qserv/indexclientnum:dev
200+
imagePullPolicy: Always
201+
args: ["1000001", "2000000", "client-k8s-a3.cnf"]
202+
ports:
203+
- containerPort: 10050
204+
protocol: UDP
205+
206+

core/modules/loader/Central.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ void Central::_checkDoList() {
7777
while(_loop) {
7878
// Run and then sleep for a second. TODO A more advanced timer should be used
7979
doList->checkList();
80+
LOGS(_log, LOG_LVL_INFO, "&&& SLEEP");
8081
usleep(_loopSleepTime);
8182
}
8283
}

core/modules/loader/Central.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ class Central {
7777

7878
int getErrCount() const { return _server->getErrCount(); }
7979

80+
/// Start the server on UDP and/or TCP ports. May throw boost::system::system_error
81+
void start() {
82+
startService();
83+
startMonitoring();
84+
}
85+
86+
/// Override with function to define and start the server.
87+
void virtual startService() = 0;
88+
89+
/// Override with functions to add do list items.
90+
void virtual startMonitoring() {};
91+
8092
/// Send the contents of 'sendBuf' to 'host:port'. This waits for the message to be
8193
/// sent before returning.
8294
/// @throw boost::system::system_error on failure.

0 commit comments

Comments
 (0)