mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-13 00:59:59 +00:00
Adds opt-in process isolation for custom nodes using pyisolate's bwrap sandbox and JSON-RPC bridge. Each isolated node pack runs in its own child process with zero-copy tensor transfer via shared memory. Core infrastructure: - CLI flag --use-process-isolation to enable isolation - Host/child startup fencing via PYISOLATE_CHILD env var - Manifest-driven node discovery and extension loading - JSON-RPC bridge between host and child processes - Shared memory forensics for leak detection Proxy layer: - ModelPatcher, CLIP, VAE, and ModelSampling proxies - Host service proxies (folder_paths, model_management, progress, etc.) - Proxy base with automatic method forwarding Execution integration: - Extension wrapper with V3 hidden param mapping - Runtime helpers for isolated node execution - Host policy for node isolation decisions - Fenced sampler device handling and model ejection parity Serializers for cross-process data transfer: - File3D (GLB), PLY (structured + gaussian), NPZ (streaming frames), VIDEO (VideoFromFile + VideoFromComponents) serializers - data_type flag in SerializerRegistry for type-aware dispatch - Isolated get_temp_directory() fence New core save nodes: - SavePLY and SaveNPZ with comfytype registrations (Ply, Npz) DynamicVRAM compatibility: - comfy-aimdo early init gated by isolation fence Tests: - Integration and policy tests for isolation lifecycle - Manifest loader, host policy, proxy, and adapter unit tests Depends on: pyisolate >= 0.9.2
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import os
|
|
|
|
import folder_paths
|
|
from comfy_api.latest import io
|
|
from comfy_api.latest._util.ply_types import PLY
|
|
|
|
|
|
class SavePLY(io.ComfyNode):
|
|
@classmethod
|
|
def define_schema(cls):
|
|
return io.Schema(
|
|
node_id="SavePLY",
|
|
display_name="Save PLY",
|
|
category="3d",
|
|
is_output_node=True,
|
|
inputs=[
|
|
io.Ply.Input("ply"),
|
|
io.String.Input("filename_prefix", default="pointcloud/ComfyUI"),
|
|
],
|
|
)
|
|
|
|
@classmethod
|
|
def execute(cls, ply: PLY, filename_prefix: str) -> io.NodeOutput:
|
|
full_output_folder, filename, counter, subfolder, _ = folder_paths.get_save_image_path(
|
|
filename_prefix, folder_paths.get_output_directory()
|
|
)
|
|
f = f"{filename}_{counter:05}_.ply"
|
|
ply.save_to(os.path.join(full_output_folder, f))
|
|
return io.NodeOutput(ui={"pointclouds": [{"filename": f, "subfolder": subfolder, "type": "output"}]})
|
|
|
|
|
|
NODE_CLASS_MAPPINGS = {
|
|
"SavePLY": SavePLY,
|
|
}
|