+
Skip to content
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
3 changes: 2 additions & 1 deletion agent/algorithm/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package algorithm

import (
"bytes"
"encoding/json"
"io"
"log/slog"

Expand Down Expand Up @@ -65,7 +66,7 @@ func (s *Stderr) Write(p []byte) (n int, err error) {
s.Logger.Error(string(buf[:n]))
}

if err := s.EventSvc.SendEvent("algorithm-run", "error", nil); err != nil {
if err := s.EventSvc.SendEvent("algorithm-run", "error", json.RawMessage{}); err != nil {
return len(p), err
}

Expand Down
6 changes: 3 additions & 3 deletions agent/algorithm/python/python.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ import (

const (
PyRuntime = "python3"
pyRuntimeKey = "python_runtime"
PyRuntimeKey = "python_runtime"
)

func PythonRunTimeToContext(ctx context.Context, runtime string) context.Context {
return metadata.AppendToOutgoingContext(ctx, pyRuntimeKey, runtime)
return metadata.AppendToOutgoingContext(ctx, PyRuntimeKey, runtime)
}

func PythonRunTimeFromContext(ctx context.Context) string {
return metadata.ValueFromIncomingContext(ctx, pyRuntimeKey)[0]
return metadata.ValueFromIncomingContext(ctx, PyRuntimeKey)[0]
}

var _ algorithm.Algorithm = (*python)(nil)
Expand Down
95 changes: 95 additions & 0 deletions agent/quoteprovider/mocks/QuoteProvider.go

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

7 changes: 5 additions & 2 deletions agent/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ var (
ErrFileNameMismatch = errors.New("malformed data, filename does not match manifest")
// ErrAllResultsConsumed indicates all results have been consumed.
ErrAllResultsConsumed = errors.New("all results have been consumed by declared consumers")
// ErrAttestationFailed attestation failed.
ErrAttestationFailed = errors.New("failed to get raw quote")
)

// Service specifies an API that must be fullfiled by the domain service
Expand Down Expand Up @@ -124,7 +126,7 @@ func (as *agentService) Algo(ctx context.Context, algo Algorithm) error {
return fmt.Errorf("error getting current directory: %v", err)
}

f, err := os.Create(filepath.Join(currentDir, "algorithm"))
f, err := os.Create(filepath.Join(currentDir, "algo"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this change done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail because algorithm dir already exists in the code base

if err != nil {
return fmt.Errorf("error creating algorithm file: %v", err)
}
Expand Down Expand Up @@ -317,8 +319,9 @@ func (as *agentService) runComputation() {
}

func (as *agentService) publishEvent(status string, details json.RawMessage) func() {
st := as.sm.GetState().String()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolves race condition previously caused by access state directly

return func() {
if err := as.eventSvc.SendEvent(as.sm.State.String(), status, details); err != nil {
if err := as.eventSvc.SendEvent(st, status, details); err != nil {
as.sm.logger.Warn(err.Error())
}
}
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载