tidy restart workers button handler to lambda
parent
d84fc5cf9c
commit
f1850e8d23
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
function confirm_restart_workers() {
|
||||
function confirm_restart_workers(_) {
|
||||
return confirm('Restart remote workers?')
|
||||
}
|
||||
|
|
@ -192,10 +192,6 @@ class UI:
|
|||
worker.eta_percent_error = []
|
||||
self.world.save_config()
|
||||
|
||||
def restart_workers_btn(self, confirmed: bool):
|
||||
if confirmed:
|
||||
self.world.restart_all()
|
||||
|
||||
# end handlers
|
||||
|
||||
def create_ui(self):
|
||||
|
|
@ -253,10 +249,10 @@ class UI:
|
|||
restart_workers_btn = gradio.Button(value="🔁 Restart All", variant='stop')
|
||||
restart_workers_btn.click(
|
||||
_js="confirm_restart_workers",
|
||||
fn=self.restart_workers_btn, inputs=[restart_workers_btn],
|
||||
outputs=[restart_workers_btn]
|
||||
fn=lambda confirmed: self.world.restart_all() if confirmed else None,
|
||||
inputs=[restart_workers_btn],
|
||||
outputs=[]
|
||||
)
|
||||
|
||||
components += [refresh_checkpoints_btn, run_usr_btn, reload_config_btn, reconnect_lost_workers_btn, restart_workers_btn]
|
||||
|
||||
with gradio.Row():
|
||||
|
|
|
|||
Loading…
Reference in New Issue