Add Force reset to clear stuck jobs and kill a wedged Comfy.
Settings and the header menu can cancel invisible queue/pending work and force-stop Beast when Sleep is blocked. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -75,11 +75,19 @@
|
||||
type="button"
|
||||
class="block w-full rounded-xl px-3 py-2 text-left text-sm hover:bg-white/5 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:class="gpuSleeping ? 'text-amber-100' : 'text-zinc-200 hover:text-white'"
|
||||
:disabled="gpuSleeping || gpuWaking || gpuBusy"
|
||||
:disabled="gpuSleeping || gpuWaking || gpuForceResetting"
|
||||
:title="gpuError || (gpuBusy ? 'Cancel the running job first' : 'Stop Comfy on the GPU to free VRAM. Does not shut the PC down.')"
|
||||
role="menuitem"
|
||||
@click="sleepGpu"
|
||||
>{{ gpuSleeping ? 'Sleeping…' : 'Sleep' }}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="block w-full rounded-xl px-3 py-2 text-left text-sm text-red-200 hover:bg-white/5 hover:text-red-100 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
:disabled="gpuForceResetting || gpuSleeping || gpuWaking"
|
||||
title="Clear stuck jobs and kill Comfy even if a generation is wedged"
|
||||
role="menuitem"
|
||||
@click="forceResetGpu"
|
||||
>{{ gpuForceResetting ? 'Force resetting…' : 'Force reset' }}</button>
|
||||
<div class="my-1 border-t border-white/10" />
|
||||
<NuxtLink
|
||||
to="/settings"
|
||||
@@ -142,6 +150,7 @@ const authEnabled = ref(false)
|
||||
const menuOpen = ref(false)
|
||||
const gpuWaking = ref(false)
|
||||
const gpuSleeping = ref(false)
|
||||
const gpuForceResetting = ref(false)
|
||||
const gpuError = ref('')
|
||||
const comfyOk = ref(false)
|
||||
const imageOk = ref(false)
|
||||
@@ -224,7 +233,7 @@ async function pollHealth() {
|
||||
}
|
||||
|
||||
async function pokeGpu() {
|
||||
if (gpuWaking.value || gpuSleeping.value) return
|
||||
if (gpuWaking.value || gpuSleeping.value || gpuForceResetting.value) return
|
||||
gpuWaking.value = true
|
||||
gpuError.value = ''
|
||||
try {
|
||||
@@ -246,7 +255,7 @@ async function pokeGpu() {
|
||||
}
|
||||
|
||||
async function sleepGpu() {
|
||||
if (gpuSleeping.value || gpuWaking.value || gpuBusy.value) return
|
||||
if (gpuSleeping.value || gpuWaking.value || gpuForceResetting.value || gpuBusy.value) return
|
||||
gpuSleeping.value = true
|
||||
gpuError.value = ''
|
||||
try {
|
||||
@@ -263,6 +272,31 @@ async function sleepGpu() {
|
||||
}
|
||||
}
|
||||
|
||||
async function forceResetGpu() {
|
||||
if (gpuForceResetting.value || gpuSleeping.value || gpuWaking.value) return
|
||||
const ok = window.confirm(
|
||||
'Force reset clears stuck Studio/queue jobs and kills Comfy even if a generation is wedged. Continue?'
|
||||
)
|
||||
if (!ok) return
|
||||
menuOpen.value = false
|
||||
gpuForceResetting.value = true
|
||||
gpuError.value = ''
|
||||
try {
|
||||
await $fetch('/api/comfy/force-reset', { method: 'POST' })
|
||||
comfyOk.value = false
|
||||
imageOk.value = false
|
||||
comfyBusy.value = false
|
||||
imageBusy.value = false
|
||||
comfyAsleep.value = true
|
||||
await pollHealth()
|
||||
} catch (error: any) {
|
||||
gpuError.value = error?.data?.statusMessage || error?.statusMessage || error?.message || 'Could not force-reset Comfy.'
|
||||
} finally {
|
||||
gpuForceResetting.value = false
|
||||
emit('gpu')
|
||||
}
|
||||
}
|
||||
|
||||
function onWindowClick() {
|
||||
closeMenu()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user