Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
46a5bd64
Commit
46a5bd64
authored
Jun 05, 2023
by
Aarni Koskela
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restart: only do restart if running via the wrapper script
parent
9781f31f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
13 deletions
+33
-13
modules/restart.py
modules/restart.py
+23
-0
modules/shared.py
modules/shared.py
+0
-9
modules/ui_extensions.py
modules/ui_extensions.py
+8
-3
webui.bat
webui.bat
+1
-1
webui.sh
webui.sh
+1
-0
No files found.
modules/restart.py
0 → 100644
View file @
46a5bd64
import
os
from
pathlib
import
Path
from
modules.paths_internal
import
script_path
def
is_restartable
()
->
bool
:
"""
Return True if the webui is restartable (i.e. there is something watching to restart it with)
"""
return
bool
(
os
.
environ
.
get
(
'SD_WEBUI_RESTART'
))
def
restart_program
()
->
None
:
"""creates file tmp/restart and immediately stops the process, which webui.bat/webui.sh interpret as a command to start webui again"""
(
Path
(
script_path
)
/
"tmp"
/
"restart"
)
.
touch
()
stop_program
()
def
stop_program
()
->
None
:
os
.
_exit
(
0
)
modules/shared.py
View file @
46a5bd64
...
...
@@ -853,12 +853,3 @@ def walk_files(path, allowed_extensions=None):
continue
yield
os
.
path
.
join
(
root
,
filename
)
def
restart_program
():
"""creates file tmp/restart and immediately stops the process, which webui.bat/webui.sh interpret as a command to start webui again"""
with
open
(
os
.
path
.
join
(
script_path
,
"tmp"
,
"restart"
),
"w"
):
pass
os
.
_exit
(
0
)
modules/ui_extensions.py
View file @
46a5bd64
...
...
@@ -11,7 +11,7 @@ import html
import
shutil
import
errno
from
modules
import
extensions
,
shared
,
paths
,
config_states
,
errors
from
modules
import
extensions
,
shared
,
paths
,
config_states
,
errors
,
restart
from
modules.paths_internal
import
config_states_dir
from
modules.call_queue
import
wrap_gradio_gpu_call
...
...
@@ -49,7 +49,11 @@ def apply_and_restart(disable_list, update_list, disable_all):
shared
.
opts
.
disabled_extensions
=
disabled
shared
.
opts
.
disable_all_extensions
=
disable_all
shared
.
opts
.
save
(
shared
.
config_filename
)
shared
.
restart_program
()
if
restart
.
is_restartable
():
restart
.
restart_program
()
else
:
restart
.
stop_program
()
def
save_config_state
(
name
):
...
...
@@ -508,7 +512,8 @@ def create_ui():
with
gr
.
TabItem
(
"Installed"
,
id
=
"installed"
):
with
gr
.
Row
(
elem_id
=
"extensions_installed_top"
):
apply
=
gr
.
Button
(
value
=
"Apply and restart UI"
,
variant
=
"primary"
)
apply_label
=
(
"Apply and restart UI"
if
restart
.
is_restartable
()
else
"Apply and quit"
)
apply
=
gr
.
Button
(
value
=
apply_label
,
variant
=
"primary"
)
check
=
gr
.
Button
(
value
=
"Check for updates"
)
extensions_disable_all
=
gr
.
Radio
(
label
=
"Disable all extensions"
,
choices
=
[
"none"
,
"extra"
,
"all"
],
value
=
shared
.
opts
.
disable_all_extensions
,
elem_id
=
"extensions_disable_all"
)
extensions_disabled_list
=
gr
.
Text
(
elem_id
=
"extensions_disabled_list"
,
visible
=
False
)
.
style
(
container
=
False
)
...
...
webui.bat
View file @
46a5bd64
...
...
@@ -3,7 +3,7 @@
if
not
defined
PYTHON
(
set
PYTHON
=
python
)
if
not
defined
VENV_DIR
(
set
"VENV_DIR=
%~dp0%venv
"
)
set
SD_WEBUI_RESTART
=
tmp
/restart
set
ERROR_REPORTING
=
FALSE
mkdir
tmp
2
>
NUL
...
...
webui.sh
View file @
46a5bd64
...
...
@@ -204,6 +204,7 @@ prepare_tcmalloc() {
}
KEEP_GOING
=
1
export
SD_WEBUI_RESTART
=
tmp/restart
while
[[
"
$KEEP_GOING
"
-eq
"1"
]]
;
do
if
[[
!
-z
"
${
ACCELERATE
}
"
]]
&&
[
${
ACCELERATE
}
=
"True"
]
&&
[
-x
"
$(
command
-v
accelerate
)
"
]
;
then
printf
"
\n
%s
\n
"
"
${
delimiter
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment