@@ -426,7 +426,7 @@ func (dr *Runtime) CreateSandbox(ctx context.Context, in *proto.ServiceInfo) (*p
426426
427427 if ! ok {
428428 // check if binary exists
429- binaryInfo , err := os .Stat (in .Image )
429+ /* binaryInfo, err := os.Stat(in.Image)
430430 if err != nil {
431431 logrus.Errorf("Error validating binary file - %v", err)
432432 return getFailureStatus(), nil
@@ -435,7 +435,7 @@ func (dr *Runtime) CreateSandbox(ctx context.Context, in *proto.ServiceInfo) (*p
435435 logrus.Errorf("Error validating binary file - file is a directory")
436436 return getFailureStatus(), nil
437437 }
438- logrus .Infof ("Registering binary file %s (size=%d)" , in .Image , binaryInfo .Size ())
438+ logrus.Infof("Registering binary file %s (size=%d)", in.Image, binaryInfo.Size())*/
439439
440440 // operator load/store
441441 fName := in .Name
@@ -460,14 +460,21 @@ func (dr *Runtime) CreateSandbox(ctx context.Context, in *proto.ServiceInfo) (*p
460460 if dr .dandelionConfig .LogFunctionStdioOutset { // add "stdio" to get the stdio output from dandelion
461461 outputSets = append (outputSets , "stdio" )
462462 }
463+
464+ binaryData , err := os .ReadFile (dr .dandelionConfig .BinaryPath )
465+ if err != nil {
466+ logrus .Errorf ("Error reading binary file - %v" , err )
467+ return getFailureStatus (), nil
468+ }
469+
463470 registerRequest := bson.D {
464471 {Key : "name" , Value : fName },
465472 {Key : "context_size" , Value : 0x8020000 },
466473 {Key : "engine_type" , Value : dr .dandelionConfig .EngineType },
467- {Key : "local_path" , Value : in .Image },
468- {Key : "binary" , Value : bytesToInts ([] byte { 0 } )},
469- {Key : "input_sets" , Value : inputSets },
470- {Key : "output_sets" , Value : outputSets },
474+ // {Key: "local_path", Value: in.Image},
475+ {Key : "binary" , Value : bytesToInts (binaryData )},
476+ {Key : "input_sets" , Value : bson. A {bson. A { "input" , nil }} },
477+ {Key : "output_sets" , Value : [] string { "output" }}, // add "stdio" for debugging purpose
471478 }
472479
473480 // send registration request to dandelion
0 commit comments