Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/workloads/cortex/serve/init/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import os
import time
import json
import sys

from cortex.lib.type import (
predictor_type_from_api_spec,
Expand Down Expand Up @@ -154,7 +155,7 @@ def main():

# wait until the cron finishes its first pass
if cron:
while not cron.ran_once():
while cron.is_alive() and not cron.ran_once():
time.sleep(0.25)

# disable live reloading when the BatchAPI kind is used
Expand All @@ -173,6 +174,13 @@ def main():
while cron and cron.is_alive():
time.sleep(0.25)

# exit if cron has exited with errors
if cron and isinstance(cron.exitcode, int) and cron.exitcode != 0:
# if it was killed by a signal
if cron.exitcode < 0:
sys.exit(-cron.exitcode)
sys.exit(cron.exitcode)


if __name__ == "__main__":
main()