Skip to content

Commit d0026da

Browse files
committed
add --dump-sysinfo, a cmd arg to dump limited sysinfo file at startup
1 parent 8d54739 commit d0026da

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

launch.py

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626

2727
def main():
28+
if args.dump_sysinfo:
29+
filename = launch_utils.dump_sysinfo()
30+
31+
print(f"Sysinfo saved as {filename}. Exiting...")
32+
33+
exit(0)
34+
2835
launch_utils.startup_timer.record("initial startup")
2936

3037
with launch_utils.startup_timer.subcategory("prepare environment"):

modules/cmd_args.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
parser.add_argument("--log-startup", action='store_true', help="launch.py argument: print a detailed log of what's happening at startup")
1717
parser.add_argument("--skip-prepare-environment", action='store_true', help="launch.py argument: skip all environment preparation")
1818
parser.add_argument("--skip-install", action='store_true', help="launch.py argument: skip installation of packages")
19+
parser.add_argument("--dump-sysinfo", action='store_true', help="launch.py argument: dump limited sysinfo file (without information about extensions, options) to disk and quit")
1920
parser.add_argument("--loglevel", type=str, help="log level; one of: CRITICAL, ERROR, WARNING, INFO, DEBUG", default=None)
2021
parser.add_argument("--do-not-download-clip", action='store_true', help="do not download CLIP model even if it's not included in the checkpoint")
2122
parser.add_argument("--data-dir", type=str, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")

modules/launch_utils.py

+13
Original file line numberDiff line numberDiff line change
@@ -434,3 +434,16 @@ def start():
434434
webui.api_only()
435435
else:
436436
webui.webui()
437+
438+
439+
def dump_sysinfo():
440+
from modules import sysinfo
441+
import datetime
442+
443+
text = sysinfo.get()
444+
filename = f"sysinfo-{datetime.datetime.utcnow().strftime('%Y-%m-%d-%H-%M')}.txt"
445+
446+
with open(filename, "w", encoding="utf8") as file:
447+
file.write(text)
448+
449+
return filename

0 commit comments

Comments
 (0)