mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
minor updates
This commit is contained in:
@@ -128,7 +128,7 @@ def get_memory_stats():
|
||||
process = psutil.Process(os.getpid())
|
||||
res = process.memory_info()
|
||||
ram_total = 100 * res.rss / process.memory_percent()
|
||||
return f'used={gb(res.rss)} total={gb(ram_total)}'
|
||||
return f'{gb(res.rss)}/{gb(ram_total)}'
|
||||
|
||||
|
||||
def start_server(immediate=True, server=None):
|
||||
@@ -145,7 +145,7 @@ def start_server(immediate=True, server=None):
|
||||
if not immediate:
|
||||
time.sleep(3)
|
||||
if collected > 0:
|
||||
installer.log.debug(f'Memory {get_memory_stats()} Collected {collected}')
|
||||
installer.log.debug(f'Memory: {get_memory_stats()} collected={collected}')
|
||||
module_spec = importlib.util.spec_from_file_location('webui', 'webui.py')
|
||||
server = importlib.util.module_from_spec(module_spec)
|
||||
installer.log.debug(f'Starting module: {server}')
|
||||
@@ -233,7 +233,7 @@ if __name__ == "__main__":
|
||||
if round(time.time()) % 120 == 0:
|
||||
state = f'job="{instance.state.job}" {instance.state.job_no}/{instance.state.job_count}' if instance.state.job != '' or instance.state.job_no != 0 or instance.state.job_count != 0 else 'idle'
|
||||
uptime = round(time.time() - instance.state.server_start)
|
||||
installer.log.debug(f'Server alive={alive} jobs={instance.state.total_jobs} requests={requests} uptime={uptime} memory {get_memory_stats()} {state}')
|
||||
installer.log.debug(f'Server: alive={alive} jobs={instance.state.total_jobs} requests={requests} uptime={uptime} memory={get_memory_stats()} backend={instance.backend} {state}')
|
||||
if not alive:
|
||||
if uv is not None and uv.wants_restart:
|
||||
installer.log.info('Server restarting...')
|
||||
|
||||
+6
-3
@@ -1239,11 +1239,14 @@ def webpath(fn):
|
||||
|
||||
|
||||
def html_head():
|
||||
script_js = os.path.join(script_path, "javascript", "script.js")
|
||||
head = f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
|
||||
head = ''
|
||||
main = ['script.js']
|
||||
for js in main:
|
||||
script_js = os.path.join(script_path, "javascript", js)
|
||||
head += f'<script type="text/javascript" src="{webpath(script_js)}"></script>\n'
|
||||
added = []
|
||||
for script in modules.scripts.list_scripts("javascript", ".js"):
|
||||
if script.path == script_js:
|
||||
if script.filename in main:
|
||||
continue
|
||||
head += f'<script type="text/javascript" src="{webpath(script.path)}"></script>\n'
|
||||
added.append(script.path)
|
||||
|
||||
@@ -44,6 +44,7 @@ except Exception:
|
||||
pass
|
||||
|
||||
state = shared.state
|
||||
backend = shared.backend
|
||||
if not modules.loader.initialized:
|
||||
timer.startup.record("libraries")
|
||||
log.setLevel(logging.DEBUG if cmd_opts.debug else logging.INFO)
|
||||
@@ -274,7 +275,7 @@ def start_ui():
|
||||
shared.log.info(f'API Docs: {local_url[:-1]}/docs') # pylint: disable=unsubscriptable-object
|
||||
if share_url is not None:
|
||||
shared.log.info(f'Share URL: {share_url}')
|
||||
shared.log.debug(f'Gradio registered functions: {len(shared.demo.fns)}')
|
||||
shared.log.debug(f'Gradio functions: registered={len(shared.demo.fns)}')
|
||||
shared.demo.server.wants_restart = False
|
||||
setup_middleware(app, cmd_opts)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user