Nodes/comfyui-ysnodes/Purge & Notification
ComfyUI Node

Purge & Notification

A 'ping me when the queue is done' node that also sweeps VRAM

By MrYassinox·Created 2 months ago·Updated about a month ago· 1
Purge & Notification
  • signal
  • signal
purge_cachetrue
purge_modelsfalse
alert_modealways
system_notificationtrue
notification_text✅ Workflow complete
play_soundtrue
sound_volume0.50
sound_filenotify.mp3

Long batches in ComfyUI have the same failure mode as microwaving popcorn: you walk away, and the only way to know it's done is to keep checking. Purge & Notification is the end-of-workflow node from comfyui-ysnodes that fixes that - drop it after your last Save Image, and when the run finishes it plays a sound in your browser tab, pops an OS notification, and can flush VRAM while it's at it. You go make tea, you come back to a chime instead of a screen you've been babysitting.

It's actually two unrelated jobs welded into one node, and both are useful. The purge half is borrowed from the PurgeVRAM / LayerStyle lineage; the notification half comes from ComfyUI-Notifications. The pack just merges them and adds no dependencies.

How it works

Notifications in ComfyUI are a two-part system, and this is the part that trips people up:

  • Python side (this node) does the purge immediately - soft_empty_cache(), CUDA/MPS cache clear, and optionally unload_all_models() - then sends a WebSocket message to the browser via PromptServer.send_sync().
  • JS side (web/purge_notification_sg.js, auto-served by the pack) listens for that message and fires the OS notification and plays the audio.

Both files have to be present. The Python half alone gives you the purge; without the JS file, no sound and no notification - the README calls this out explicitly.

The inputs that matter

The node is an output node (OUTPUT_NODE = True), so it always runs at the end of execution. Its signal input is a wildcard - connect the last real node's output there to guarantee execution order.

  • purge_cache (default on) - clears the CUDA/MPS cache and ComfyUI's soft cache. Harmless to leave on; helps if you run long sessions where VRAM creeps up.
  • purge_models (default off) - unloads all models from VRAM. This is the one to be careful with: the next run reloads everything from disk, so your first image after a purge_models run is noticeably slower. Turn it on only when you genuinely want to hand VRAM back.
  • alert_mode - always fires every run; on_empty_queue fires only when the queue is fully empty. If you batch ten jobs, on_empty_queue means one chime at the end instead of ten interruptions. That's the setting you actually want for batch work.
  • notification_text, play_sound, sound_volume, sound_file - the message text and the audio. sound_file accepts a filename from comfyui-ysnodes/web/assets/ (a default notify.mp3 ships with the pack), a full local path, or a URL.

Installing it

Same story as every node in this pack - zero dependencies, no models.

cd ComfyUI/custom_nodes
git clone https://github.com/MrYassinox/comfyui-ysnodes.git

Or search comfyui-ysnodes in ComfyUI Manager, then restart.

When the sound doesn't fire

The README's FAQ is the honest troubleshooting checklist:

  1. web/purge_notification_sg.js must be present in the pack folder - if you cloned an old version or something's stripping the web/ directory, the JS half is gone and you get silence.
  2. A sound file (e.g. notify.mp3) must exist in web/assets/. The pack ships one, but if you deleted it or renamed the file, update sound_file accordingly.

And browser reality: OS notifications require the page to have notification permission, and sound needs the tab to not be throttled. If the node is running on a remote server you're viewing over SSH-tunneled port forwarding, the notification fires in that browser, not wherever you are.

CategoryYSNodes/utility

Inputs (9)

NameTypeDefaultDescription
purge_cacheBOOLEANtrueClear CUDA/MPS cache and ComfyUI soft cache.
purge_modelsBOOLEANfalseUnload ALL models from VRAM. Next run reloads from disk.
alert_modeCOMBOalwaysalways = notify every run. on_empty_queue = only when queue is empty.
system_notificationBOOLEANtrueSend a browser OS notification popup.
notification_textSTRING✅ Workflow completeText shown in the browser OS notification.
play_soundBOOLEANtruePlay an audio file in the browser tab.
sound_volumeFLOAT0.500–1Playback volume 0.0 (mute) to 1.0 (full).
sound_fileSTRINGnotify.mp3Sound to play. Can be: • Filename in comfyui-ysnodes/web/assets/ (e.g. notify.mp3) • Full local path (e.g. C:\Windows\Media\alarm.wav) • URL (e.g. https://example.com/alert.mp3)
signalopt*Connect last node output here to ensure correct execution order.

Outputs (1)

NameTypeDescription
signal*