DragonForgeStudios commited on
Commit
53fa367
·
verified ·
1 Parent(s): 3b1f138

forge: block after launch so the process cannot exit; log launch outcome

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -121,6 +121,15 @@ if __name__ == "__main__":
121
  # That Node proxy is what dies here (log: "Running on local URL ... with SSR (Node
122
  # proxy -> Python :7861)" then "Stopping Node.js server..."). Serving straight from
123
  # Python removes the extra process entirely.
124
- demo.launch(server_name="0.0.0.0",
125
- server_port=int(os.environ.get("PORT", 7860)),
126
- ssr_mode=False)
 
 
 
 
 
 
 
 
 
 
121
  # That Node proxy is what dies here (log: "Running on local URL ... with SSR (Node
122
  # proxy -> Python :7861)" then "Stopping Node.js server..."). Serving straight from
123
  # Python removes the extra process entirely.
124
+ print("launching (ssr_mode=False)...", flush=True)
125
+ try:
126
+ demo.launch(server_name="0.0.0.0",
127
+ server_port=int(os.environ.get("PORT", 7860)),
128
+ ssr_mode=False)
129
+ except BaseException as exc:
130
+ print("launch raised %s: %r" % (type(exc).__name__, exc), flush=True)
131
+ # If launch() returns instead of blocking, the interpreter exits and takes the
132
+ # server with it (observed: "Running on local URL" then BaseEventLoop.__del__
133
+ # noise, i.e. shutdown). Block so the process cannot end.
134
+ print("launch returned; blocking main thread", flush=True)
135
+ threading.Event().wait()