Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle timeout issue for node-pack-extract #146

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 38 additions & 37 deletions drip/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions node-pack-extract/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ steps:
- "--env"
- "AUTO_UPDATE=true"
- "--env"
- "TIMEOUT=3600"
- "--env"
- "CUSTOM_NODE_URL=$_CUSTOM_NODE_URL"
- "--env"
- "CUSTOM_NODE_NAME=$_CUSTOM_NODE_NAME"
Expand All @@ -22,6 +24,8 @@ steps:
- "/workspace"
- "gcr.io/$PROJECT_ID/comfyui-nodepack"
- "$_CUSTOM_NODE_NAME.json"
timeout: 5400s # 90 minutes
allowFailure: true

- name: "gcr.io/google.com/cloudsdktool/cloud-sdk:slim"
entrypoint: "bash"
Expand Down Expand Up @@ -57,3 +61,4 @@ substitutions:

options:
logging: CLOUD_LOGGING_ONLY
timeout: 5400s # 90 minutes
21 changes: 16 additions & 5 deletions node-pack-extract/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
#!/bin/sh
#!/bin/bash
set -e

# run the original endpoint
# run the original endpoint
init.sh &

# loop until we can extract the node information
TIMEOUT=${TIMEOUT:-3600}
OUTPUTFILE=${1:-"/tmp/output.json"}
echo -n > "$OUTPUTFILE"
echo -n >"$OUTPUTFILE"
until cat "$OUTPUTFILE" | grep ''; do
sleep 1

echo "$SECONDS $TIMEOUT"
if ((SECONDS >= TIMEOUT)); then
jq -n '{success: false, reason: "timeout"}' | tee "$OUTPUTFILE"
break
fi
echo "here"

curl -sf localhost:8188/object_info |
jq -c '
to_entries |
Expand All @@ -28,7 +37,9 @@ until cat "$OUTPUTFILE" | grep ''; do
if length > 0 then
{success: true, nodes: from_entries}
else
{success: false}
{success: false, reason: "node cannot be loaded into comfy ui"}
end' |
tee "$OUTPUTFILE"
tee "$OUTPUTFILE"
done

jq -e '.success' "$OUTPUTFILE"
2 changes: 2 additions & 0 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1790,6 +1790,8 @@ paths:
properties:
success:
type: boolean
reason:
type: string
cloud_build_info:
$ref: '#/components/schemas/ComfyNodeCloudBuildInfo'
nodes:
Expand Down
8 changes: 8 additions & 0 deletions server/implementation/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,15 @@ func (impl *DripStrictServerImplementation) CreateComfyNodes(
cb := mapper.ApiComfyNodeCloudBuildToDbComfyNodeCloudBuild(request.Body.CloudBuildInfo)
// Check if extraction was marked as unsuccessful
if request.Body.Success != nil && !*request.Body.Success {
reason := "unknown"
if request.Body.Reason != nil {
reason = *request.Body.Reason
}
log.Ctx(ctx).Warn().Msgf(
"Comfy nodes extraction failed for %s %s: %s", request.NodeId, request.Version, reason)

err = impl.RegistryService.MarkComfyNodeExtractionFailed(ctx, impl.Client, request.NodeId, request.Version, cb)

} else {
// Attempt to create comfy nodes in the registry
err = impl.RegistryService.CreateComfyNodes(
Expand Down
Loading