Initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import time
|
||||
|
||||
|
||||
class ExecutionDelayNode:
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
# The data flowing through the chain (Any type placeholder '*')
|
||||
"any_input": ("*", {"forceInput": True}),
|
||||
# The number of seconds to sleep/throttle
|
||||
"seconds_to_wait": (
|
||||
"INT",
|
||||
{"default": 5, "min": 0, "max": 3600, "step": 1},
|
||||
),
|
||||
# Visual label toggle to trace wait status in your terminal window
|
||||
"print_to_console": (["enable", "disable"], {"default": "enable"}),
|
||||
}
|
||||
}
|
||||
|
||||
# By declaring '*' as the output type, ComfyUI dynamically copies
|
||||
# the exact data type that entered the node (String, Latent, Image, etc.)
|
||||
RETURN_TYPES = ("*",)
|
||||
RETURN_NAMES = ("output_data",)
|
||||
FUNCTION = "trigger_throttle_delay"
|
||||
CATEGORY = "TextRandomizer/Utility"
|
||||
|
||||
def trigger_throttle_delay(self, any_input, seconds_to_wait, print_to_console):
|
||||
if seconds_to_wait > 0:
|
||||
if print_to_console == "enable":
|
||||
cyan_start, yellow_start, color_reset = (
|
||||
"\033[96m",
|
||||
"\033[93m",
|
||||
"\033[0m",
|
||||
)
|
||||
print(
|
||||
f"{cyan_start}[⏳ Throttle]{color_reset} Sleeping for {yellow_start}{seconds_to_wait}{color_reset} seconds..."
|
||||
)
|
||||
|
||||
# Freeze execution thread entirely
|
||||
time.sleep(seconds_to_wait)
|
||||
|
||||
if print_to_console == "enable":
|
||||
print(
|
||||
f"{cyan_start}[⏳ Throttle]{color_reset} Resume signal sent down pipeline."
|
||||
)
|
||||
|
||||
return (any_input,)
|
||||
Reference in New Issue
Block a user