14
14
# limitations under the License.
15
15
#
16
16
17
- import atexit
18
17
import os
19
18
import ray
20
19
import signal
26
25
import random
27
26
from rayvens .core .validation import Validation
28
27
import rayvens .core .catalog as catalog
29
-
30
- integrations = []
31
-
32
-
33
- def killall ():
34
- global integrations
35
- for integration in integrations :
36
- integration .cancel ()
28
+ import sys
37
29
38
30
39
31
# instantiate camel actor manager and setup exit hook
40
32
def start (prefix , mode ):
41
33
camel = Camel (mode )
42
- atexit .register (camel .killall )
43
34
return camel
44
35
45
36
@@ -92,10 +83,6 @@ def await_start(self, integration_name):
92
83
def await_start_all (self , stream ):
93
84
return True
94
85
95
- def killall (self ):
96
- for stream in self .streams :
97
- stream ._exec .remote (killall )
98
-
99
86
100
87
# the low-level implementation-specific stuff
101
88
@@ -126,15 +113,14 @@ def __init__(self, name, spec):
126
113
with open (filename , 'w' ) as f :
127
114
yaml .dump (spec , f )
128
115
self .port = random_port ()
116
+ harness = os .path .join (os .path .dirname (__file__ ), 'harness.py' )
129
117
queue = os .path .join (os .path .dirname (__file__ ), 'Queue.java' )
130
118
command = [
131
- 'kamel' , 'local' , 'run' , queue , '--property' ,
132
- f'quarkus.http.port={ self .port } ' , filename
119
+ sys . executable , harness , 'kamel' , 'local' , 'run' , queue ,
120
+ '--property' , f'quarkus.http.port={ self .port } ' , filename
133
121
]
134
122
process = subprocess .Popen (command , start_new_session = True )
135
123
self .pid = process .pid
136
- global integrations
137
- integrations .append (self )
138
124
139
125
def send_to (self , stream ):
140
126
def append ():
@@ -158,6 +144,6 @@ def recv_from(self, stream):
158
144
159
145
def cancel (self ):
160
146
try :
161
- os .killpg ( os . getpgid ( self .pid ) , signal .SIGTERM )
147
+ os .kill ( self .pid , signal .SIGTERM )
162
148
except ProcessLookupError :
163
149
pass
0 commit comments