From f81ebdd538fe8f41f46ee374681a3236ebdc7407 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 30 Mar 2024 13:42:30 -0700 Subject: [PATCH] Fixed cannot find custom node --- python/custom_routes.py | 7 ++++--- python/upload/spec.py | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/python/custom_routes.py b/python/custom_routes.py index 84e157a..d5312b8 100644 --- a/python/custom_routes.py +++ b/python/custom_routes.py @@ -193,6 +193,7 @@ async def upload_task_execution(task_id, file_specs, workflow_id): # cleanup temp task_status[task_id] = {"status": "Task completed", "message": "Upload successful"} except Exception as e: + print(e) task_status[task_id] = {"status": f"Task failed", "message": str(e)} @@ -219,7 +220,6 @@ async def upload_dependencies(request): paths.pop("custom_nodes", None) paths.pop("configs", None) - # Create upload task task_id = str(uuid.uuid4()) task_status[task_id] = {"status": "Task started", "message": None} @@ -256,11 +256,12 @@ async def upload_dependencies(request): # Upload custom nodes for name in nodes_dep: # check filepath exists - p = os.path.join(custom_nodes_dir, f"/vol/{workflow_id}/comfyui/custom_nodes/{name}") + p = os.path.join(custom_nodes_dir, name) + print("PATH",p) if not os.path.exists(p): raise Exception(f"Required node {name} was not found in your ComfyUI/custom_nodes folder. Make sure you do not have extra_paths.yaml enabled") - batch.put_directory(p, name) + batch.put_directory(p, f"/vol/{workflow_id}/comfyui/custom_nodes/{name}") # Upload input files for filename in files: diff --git a/python/upload/spec.py b/python/upload/spec.py index bdd9c58..d23dc23 100644 --- a/python/upload/spec.py +++ b/python/upload/spec.py @@ -25,6 +25,7 @@ from typing import ( Any, ) import aiostream +import zlib from .sync import synchronize_api from .blob import LARGE_FILE_LIMIT from .hash import get_sha256_hex, get_upload_hashes @@ -61,6 +62,12 @@ def _get_file_upload_spec( size = fp.tell() fp.seek(0) + # Hotfix - cannot send bytes over http + use_blob = True + content = None + sha256_hex = get_sha256_hex(fp) + + """ if size >= LARGE_FILE_LIMIT: use_blob = True content = None @@ -69,6 +76,7 @@ def _get_file_upload_spec( use_blob = False content = fp.read() sha256_hex = get_sha256_hex(content) + """ return FileUploadSpec( source=source, @@ -119,6 +127,7 @@ def serialize_spec(spec: FileUploadSpec) -> Dict[Any, Any]: obj["source_description"] = str(spec.source_description) + with spec.source() as data: upload_hashes = get_upload_hashes(data) @@ -131,6 +140,13 @@ def serialize_spec(spec: FileUploadSpec) -> Dict[Any, Any]: obj["content_length"] = content_length del obj["source"] + # Serialize bytes + # At the moment this is too large to + # send over http + if obj["content"] is not None: + encoded_content = base64.b64encode(obj["content"]).decode('utf-8') + obj["content"] = encoded_content + return obj class _FileSpecContextManager: