MCPcopy Create free account
hub / github.com/DanielPFlorian/ComfyUI-WorkflowGenerator / parse_n_threads

Function parse_n_threads

utils/node_utils.py:30–56  ·  view source on GitHub ↗

Parse n_threads Combo value to integer or None. Args: value: String from Combo input ("All", "Auto", or integer string) Returns: int for "All" or specific count, None for "Auto"

(value: str)

Source from the content-addressed store, hash-verified

28
29
30def parse_n_threads(value: str) -> int | None:
31 """
32 Parse n_threads Combo value to integer or None.
33
34 Args:
35 value: String from Combo input ("All", "Auto", or integer string)
36
37 Returns:
38 int for "All" or specific count, None for "Auto"
39 """
40 if value == "All":
41 try:
42 if psutil is not None:
43 return psutil.cpu_count(logical=True)
44 else:
45 import multiprocessing
46
47 return multiprocessing.cpu_count()
48 except Exception:
49 return 32
50 elif value == "Auto":
51 return None
52 else:
53 try:
54 return int(value)
55 except (ValueError, TypeError):
56 return None
57
58
59def check_llm_lazy_status(

Callers 2

executeMethod · 0.85
executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected