Skip to content

Commit 4cadc10

Browse files
authored
Only kill process on failed load if not live_reload (#166)
don't kill the process when live reload is enabled
1 parent 4942088 commit 4cadc10

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

truss/templates/server/common/truss_server.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json # noqa: E402
22
import logging # noqa: E402
3+
import os
34
import sys
45
from http import HTTPStatus # noqa: E402
56
from threading import Thread
@@ -169,15 +170,18 @@ def __init__(self, *args, **kwargs):
169170
super().__init__(*args, **kwargs)
170171
_configure_logging()
171172

172-
def load_all(self, main_loop):
173+
def load_all(self, main_loop: IOLoop):
173174
try:
174175
for model in self.registered_models.get_models():
175176
model.load()
176177
except Exception as e:
177178
logging.error(f"Error loading model: {e}")
178-
self._http_server.stop()
179-
main_loop.stop()
180-
sys.exit(1)
179+
180+
# fixme(zack) for live reload, we don't want to kill the process?
181+
if not os.environ.get("CONTROL_SERVER_PORT"):
182+
self._http_server.stop()
183+
main_loop.stop()
184+
sys.exit(1)
181185

182186
def start(self, models: List[KFModel], nest_asyncio: bool = False):
183187
if len(models) != 1:

0 commit comments

Comments
 (0)