File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
pkg/workloads/cortex/serve/init Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 1515import os
1616import time
1717import json
18+ import sys
1819
1920from cortex .lib .type import (
2021 predictor_type_from_api_spec ,
@@ -154,7 +155,7 @@ def main():
154155
155156 # wait until the cron finishes its first pass
156157 if cron :
157- while not cron .ran_once ():
158+ while cron . is_alive () and not cron .ran_once ():
158159 time .sleep (0.25 )
159160
160161 # disable live reloading when the BatchAPI kind is used
@@ -173,6 +174,13 @@ def main():
173174 while cron and cron .is_alive ():
174175 time .sleep (0.25 )
175176
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+
176184
177185if __name__ == "__main__" :
178186 main ()
You can’t perform that action at this time.
0 commit comments