Skip to content

Commit 9c39300

Browse files
TO REMOVE: add debug info
1 parent ab43c00 commit 9c39300

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

internal/container/container.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import (
55
"encoding/base64"
66
"encoding/json"
77
"fmt"
8-
"github.com/serverledge-faas/serverledge/internal/function"
98
"io"
109
"log"
1110
"net/http"
1211
"time"
1312

13+
"github.com/serverledge-faas/serverledge/internal/function"
14+
1415
"github.com/serverledge-faas/serverledge/internal/executor"
1516
)
1617

@@ -91,8 +92,10 @@ func Execute(contID ContainerID, req *executor.InvocationRequest) (*executor.Inv
9192

9293
postBody, _ := json.Marshal(req)
9394
postBodyB := bytes.NewBuffer(postBody) // this buffer will be erased after send
95+
fmt.Printf(">>> Before send POST request with retries, with body %v\n", req)
9496
resp, waitDuration, err := sendPostRequestWithRetries(fmt.Sprintf("http://%s:%d/invoke", ipAddr,
9597
executor.DEFAULT_EXECUTOR_PORT), postBodyB)
98+
fmt.Printf(">>> err? %v\n", err)
9699
if err != nil {
97100
if resp != nil {
98101
buffer, err2 := io.ReadAll(resp.Body)
@@ -104,6 +107,7 @@ func Execute(contID ContainerID, req *executor.InvocationRequest) (*executor.Inv
104107
return nil, waitDuration, fmt.Errorf("request to executor failed: %v", err)
105108
}
106109

110+
fmt.Printf(">>> resp.StatusCode? %v\n", resp.StatusCode)
107111
if resp.StatusCode != 200 {
108112
buffer, err2 := io.ReadAll(resp.Body)
109113
if err2 != nil {
@@ -122,6 +126,9 @@ func Execute(contID ContainerID, req *executor.InvocationRequest) (*executor.Inv
122126
response := &executor.InvocationResult{}
123127

124128
err = d.Decode(response)
129+
fmt.Printf(">>> resp.Body? %v\n", resp.Body)
130+
fmt.Printf(">>> decoded response? %v\n", response)
131+
125132
if err != nil {
126133
return nil, waitDuration, fmt.Errorf("Parsing executor response failed: %v", err)
127134
}

internal/container/docker.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ func (cf *DockerFactory) Create(image string, opts *ContainerOptions) (Container
4545
contResources.CPUQuota = (int64)(50000.0 * opts.CPUQuota)
4646
}
4747

48+
fmt.Printf("+++ creating container: %v; %v\n", image, opts)
49+
4850
resp, err := cf.cli.ContainerCreate(cf.ctx, &container.Config{
4951
Image: image,
5052
Cmd: opts.Cmd,

internal/scheduling/execution.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ func Execute(cont *container.Container, r *scheduledRequest, isWarm bool) (funct
5252
return function.ExecutionReport{}, fmt.Errorf("[%s] Execution failed on container %v: %v ", r, cont.ID, err)
5353
}
5454

55+
fmt.Printf("Response: %v\n", response)
56+
5557
if !response.Success {
5658
// notify scheduler
5759
completions <- &completionNotification{fun: r.Fun, cont: cont, executionReport: nil}

internal/workflow/workflow.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ func (wflow *Workflow) Invoke(r *Request) error {
490490
} else {
491491
var found bool
492492
previousTasks := wflow.GetPreviousTasks(taskToExecute)
493+
fmt.Printf("+++ Computing inputs for task %v, {data-> %v}\n", taskToExecute, r.Params)
494+
493495
for _, previousTask := range previousTasks {
494496
if progress.Status[previousTask] == Skipped {
495497
continue
@@ -500,6 +502,8 @@ func (wflow *Workflow) Invoke(r *Request) error {
500502
}
501503

502504
input, found = dataMap[previousTask]
505+
fmt.Printf("+++ +++ dataMap[%v]: ({%v}, %v)\n", previousTask, input, found)
506+
503507
if !found {
504508
log.Printf("Input not found in dataMap for previousTask %s", previousTask)
505509
input, err = RetrievePartialData(requestId, previousTask)
@@ -516,7 +520,7 @@ func (wflow *Workflow) Invoke(r *Request) error {
516520
}
517521
output, err := wflow.ExecuteTask(r, taskToExecute, input, progress)
518522
if err != nil {
519-
return fmt.Errorf("failed wflow execution: %v", err)
523+
return fmt.Errorf("failed wflow execution: %v (while running task: %v)", err, taskToExecute)
520524
}
521525

522526
dataMap[taskToExecute] = output

0 commit comments

Comments
 (0)