Fixed cannot find custom node

This commit is contained in:
Nathan
2024-03-30 13:42:30 -07:00
parent bd677944fa
commit f81ebdd538
2 changed files with 20 additions and 3 deletions
+4 -3
View File
@@ -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:
+16
View File
@@ -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: