fn: slot hash id must be utf8 in gRPC (#1016)

This commit is contained in:
Tolga Ceylan
2018-05-29 16:26:43 -07:00
committed by GitHub
parent 47c6fb54af
commit 7f1d14d21f
2 changed files with 9 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import (
"context"
"crypto/tls"
"crypto/x509"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
@@ -537,7 +538,12 @@ func (pr *pureRunner) handleTryCall(tc *runner.TryCall, state *callHandle) error
state.c = agent_call.(*call)
if tc.SlotHashId != "" {
state.c.slotHashId = tc.SlotHashId
hashId, err := hex.DecodeString(tc.SlotHashId)
if err != nil {
state.enqueueCallResponse(err)
return err
}
state.c.slotHashId = string(hashId[:])
}
state.allocatedTime = strfmt.DateTime(time.Now())
pr.spawnSubmit(state)

View File

@@ -2,6 +2,7 @@ package agent
import (
"context"
"encoding/hex"
"encoding/json"
"errors"
"io"
@@ -126,7 +127,7 @@ func (r *gRPCRunner) TryExec(ctx context.Context, call pool.RunnerCall) (bool, e
// send explicit NACK
err = runnerConnection.Send(&pb.ClientMsg{Body: &pb.ClientMsg_Try{Try: &pb.TryCall{
ModelsCallJson: string(modelJSON),
SlotHashId: call.SlotHashId(),
SlotHashId: hex.EncodeToString([]byte(call.SlotHashId())),
}}})
if err != nil {
logrus.WithError(err).Error("Failed to send message to runner node")