Commit
·
be82a5a
1
Parent(s):
92ef4d4
Upload relauncher.py
Browse files- relauncher.py +26 -0
relauncher.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import time
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def relaunch_process(launch_counter=0):
|
| 6 |
+
'''
|
| 7 |
+
|
| 8 |
+
'''
|
| 9 |
+
while launch_counter < 1:
|
| 10 |
+
print('Relauncher: Launching...')
|
| 11 |
+
if launch_counter > 0:
|
| 12 |
+
print(f'\tRelaunch count: {launch_counter}')
|
| 13 |
+
|
| 14 |
+
try:
|
| 15 |
+
launch_string = "/workspace/stable-diffusion-webui/webui.sh -f"
|
| 16 |
+
os.system(launch_string)
|
| 17 |
+
except Exception as err:
|
| 18 |
+
print(f"An error occurred: {err}")
|
| 19 |
+
finally:
|
| 20 |
+
print('Relauncher: Process is ending. Relaunching in 2s...')
|
| 21 |
+
launch_counter += 1
|
| 22 |
+
time.sleep(2)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
relaunch_process()
|