File tree 1 file changed +9
-1
lines changed
pkg/workloads/cortex/serve/init
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 15
15
import os
16
16
import time
17
17
import json
18
+ import sys
18
19
19
20
from cortex .lib .type import (
20
21
predictor_type_from_api_spec ,
@@ -154,7 +155,7 @@ def main():
154
155
155
156
# wait until the cron finishes its first pass
156
157
if cron :
157
- while not cron .ran_once ():
158
+ while cron . is_alive () and not cron .ran_once ():
158
159
time .sleep (0.25 )
159
160
160
161
# disable live reloading when the BatchAPI kind is used
@@ -173,6 +174,13 @@ def main():
173
174
while cron and cron .is_alive ():
174
175
time .sleep (0.25 )
175
176
177
+ # exit if cron has exited with errors
178
+ if cron and isinstance (cron .exitcode , int ) and cron .exitcode != 0 :
179
+ # if it was killed by a signal
180
+ if cron .exitcode < 0 :
181
+ sys .exit (- cron .exitcode )
182
+ sys .exit (cron .exitcode )
183
+
176
184
177
185
if __name__ == "__main__" :
178
186
main ()
You can’t perform that action at this time.
0 commit comments