diff --git a/agent/README.md b/agent/README.md index ee1c53f2..0ff2f83b 100644 --- a/agent/README.md +++ b/agent/README.md @@ -15,7 +15,6 @@ The service is configured using the environment variables from the following tab | AGENT_GRPC_SERVER_KEY | Path to gRPC server key in pem format | "" | | AGENT_GRPC_SERVER_CA_CERTS | Path to gRPC server CA certificate | "" | | AGENT_GRPC_CLIENT_CA_CERTS | Path to gRPC client CA certificate | "" | -| COCOS_NOTIFICATION_SERVER_URL | Server to receive notification events from agent. | http:/localhost:9000 | ## Deployment diff --git a/agent/computations.go b/agent/computations.go index d33d0744..22973605 100644 --- a/agent/computations.go +++ b/agent/computations.go @@ -8,10 +8,7 @@ import ( "reflect" ) -var ( - _ fmt.Stringer = (*Datasets)(nil) - _ fmt.Stringer = (*Algorithms)(nil) -) +var _ fmt.Stringer = (*Datasets)(nil) type AgentConfig struct { LogLevel string `json:"log_level"` @@ -29,7 +26,7 @@ type Computation struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Datasets Datasets `json:"datasets,omitempty"` - Algorithms Algorithms `json:"algorithms,omitempty"` + Algorithm Algorithm `json:"algorithms,omitempty"` ResultConsumers []string `json:"result_consumers,omitempty"` AgentConfig AgentConfig `json:"agent_config,omitempty"` } @@ -42,14 +39,6 @@ func (d *Datasets) String() string { return string(dat) } -func (a *Algorithms) String() string { - dat, err := json.Marshal(a) - if err != nil { - return "" - } - return string(dat) -} - type Dataset struct { Dataset []byte `json:"-"` Hash [32]byte `json:"hash,omitempty"` @@ -66,8 +55,6 @@ type Algorithm struct { ID string `json:"id,omitempty"` } -type Algorithms []Algorithm - func containsID(slice interface{}, id string) int { rangeOnMe := reflect.ValueOf(slice) for i := 0; i < rangeOnMe.Len(); i++ { diff --git a/agent/service.go b/agent/service.go index b949fc70..59d07a39 100644 --- a/agent/service.go +++ b/agent/service.go @@ -59,7 +59,7 @@ type Service interface { type agentService struct { computation Computation // Holds the current computation request details. - algorithms [][]byte // Stores the algorithms received for the computation. + algorithm []byte // Stores the algorithm received for the computation. datasets [][]byte // Stores the datasets received for the computation. result []byte // Stores the result of the computation. sm *StateMachine // Manages the state transitions of the agent service. @@ -84,46 +84,45 @@ func New(ctx context.Context, logger *slog.Logger, eventSvc events.Service, cmp go svc.sm.Start(ctx) svc.sm.SendEvent(start) svc.sm.StateFunctions[idle] = svc.publishEvent("in-progress", json.RawMessage{}) - svc.sm.StateFunctions[receivingManifests] = svc.publishEvent("in-progress", json.RawMessage{}) - svc.sm.StateFunctions[receivingAlgorithms] = svc.publishEvent("in-progress", json.RawMessage{}) + svc.sm.StateFunctions[receivingManifest] = svc.publishEvent("in-progress", json.RawMessage{}) + svc.sm.StateFunctions[receivingAlgorithm] = svc.publishEvent("in-progress", json.RawMessage{}) svc.sm.StateFunctions[receivingData] = svc.publishEvent("in-progress", json.RawMessage{}) svc.sm.StateFunctions[resultsReady] = svc.publishEvent("in-progress", json.RawMessage{}) svc.sm.StateFunctions[complete] = svc.publishEvent("in-progress", json.RawMessage{}) svc.sm.StateFunctions[running] = svc.runComputation svc.computation = cmp - svc.sm.SendEvent(manifestsReceived) + svc.sm.SendEvent(manifestReceived) return svc } func (as *agentService) Algo(ctx context.Context, algorithm Algorithm) error { - if as.sm.GetState() != receivingAlgorithms { + if as.sm.GetState() != receivingAlgorithm { return errStateNotReady } - if len(as.computation.Algorithms) == 0 { + if as.algorithm != nil { return errAllManifestItemsReceived } hash := sha3.Sum256(algorithm.Algorithm) - index := containsID(as.computation.Algorithms, algorithm.ID) + index := containsID(as.computation.Algorithm, algorithm.ID) switch index { case -1: return errUndeclaredAlgorithm default: - if as.computation.Algorithms[index].Provider != algorithm.Provider { + if as.computation.Algorithm.Provider != algorithm.Provider { return errProviderMissmatch } - if hash != as.computation.Algorithms[index].Hash { + if hash != as.computation.Algorithm.Hash { return errHashMismatch } - as.computation.Algorithms = slices.Delete(as.computation.Algorithms, index, index+1) } - as.algorithms = append(as.algorithms, algorithm.Algorithm) + as.algorithm = algorithm.Algorithm - if len(as.computation.Algorithms) == 0 { - as.sm.SendEvent(algorithmsReceived) + if as.algorithm != nil { + as.sm.SendEvent(algorithmReceived) } return nil @@ -202,7 +201,7 @@ func (as *agentService) runComputation() { as.sm.logger.Debug("computation run started") defer as.sm.SendEvent(runComplete) as.publishEvent("in-progress", json.RawMessage{})() - result, err := run(as.algorithms[0], as.datasets[0]) + result, err := run(as.algorithm, as.datasets[0]) if err != nil { as.runError = err as.publishEvent("failed", json.RawMessage{})() diff --git a/agent/state.go b/agent/state.go index b1da510c..2ac3025d 100644 --- a/agent/state.go +++ b/agent/state.go @@ -14,8 +14,8 @@ type state int const ( idle state = iota - receivingManifests - receivingAlgorithms + receivingManifest + receivingAlgorithm receivingData running resultsReady @@ -26,8 +26,8 @@ type event int const ( start event = iota - manifestsReceived - algorithmsReceived + manifestReceived + algorithmReceived dataReceived runComplete resultsConsumed @@ -56,13 +56,13 @@ func NewStateMachine(logger *slog.Logger) *StateMachine { } sm.Transitions[idle] = make(map[event]state) - sm.Transitions[idle][start] = receivingManifests + sm.Transitions[idle][start] = receivingManifest - sm.Transitions[receivingManifests] = make(map[event]state) - sm.Transitions[receivingManifests][manifestsReceived] = receivingAlgorithms + sm.Transitions[receivingManifest] = make(map[event]state) + sm.Transitions[receivingManifest][manifestReceived] = receivingAlgorithm - sm.Transitions[receivingAlgorithms] = make(map[event]state) - sm.Transitions[receivingAlgorithms][algorithmsReceived] = receivingData + sm.Transitions[receivingAlgorithm] = make(map[event]state) + sm.Transitions[receivingAlgorithm][algorithmReceived] = receivingData sm.Transitions[receivingData] = make(map[event]state) sm.Transitions[receivingData][dataReceived] = running diff --git a/agent/state_string.go b/agent/state_string.go index 5399de44..4732c1b3 100644 --- a/agent/state_string.go +++ b/agent/state_string.go @@ -9,8 +9,8 @@ func _() { // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[idle-0] - _ = x[receivingManifests-1] - _ = x[receivingAlgorithms-2] + _ = x[receivingManifest-1] + _ = x[receivingAlgorithm-2] _ = x[receivingData-3] _ = x[running-4] _ = x[resultsReady-5] diff --git a/agent/state_test.go b/agent/state_test.go index a1e38bc4..bd1fd013 100644 --- a/agent/state_test.go +++ b/agent/state_test.go @@ -16,9 +16,9 @@ func TestStateMachineTransitions(t *testing.T) { event event expected state }{ - {idle, start, receivingManifests}, - {receivingManifests, manifestsReceived, receivingAlgorithms}, - {receivingAlgorithms, algorithmsReceived, receivingData}, + {idle, start, receivingManifest}, + {receivingManifest, manifestReceived, receivingAlgorithm}, + {receivingAlgorithm, algorithmReceived, receivingData}, {receivingData, dataReceived, running}, {running, runComplete, resultsReady}, {resultsReady, resultsConsumed, complete}, diff --git a/internal/server/grpc/grpc.go b/internal/server/grpc/grpc.go index 983246a5..a2d18bb1 100644 --- a/internal/server/grpc/grpc.go +++ b/internal/server/grpc/grpc.go @@ -53,7 +53,7 @@ type serviceRegister func(srv *grpc.Server) var _ server.Server = (*Server)(nil) -func New(ctx context.Context, cancel context.CancelFunc, name string, config server.Config, registerService serviceRegister, logger *slog.Logger, agent *agent.Service) server.Server { +func New(ctx context.Context, cancel context.CancelFunc, name string, config server.Config, registerService serviceRegister, logger *slog.Logger, agentSvc *agent.Service) server.Server { listenFullAddress := fmt.Sprintf("%s:%s", config.Host, config.Port) return &Server{ BaseServer: server.BaseServer{ @@ -65,7 +65,7 @@ func New(ctx context.Context, cancel context.CancelFunc, name string, config ser Logger: logger, }, registerService: registerService, - agent: agent, + agent: agentSvc, } } diff --git a/manager/README.md b/manager/README.md index 936d466a..1e5d3ed9 100644 --- a/manager/README.md +++ b/manager/README.md @@ -205,10 +205,10 @@ MANAGER_QEMU_KERNEL_HASH=true \ ### Verifying VM launch -NB: To verify that the manager successfully launched the VM, you need to open three terminals on the same machine. In one terminal, you need to launch the Manager test server by executing (with the environment variables of choice): +NB: To verify that the manager successfully launched the VM, you need to open three terminals on the same machine. In one terminal, you need to launch the computations server by executing (with the environment variables of choice): ```bash -go run ./test/manager-server/main.go +go run ./test/computations/main.go ``` and in the second the manager by executing (with the environment variables of choice): @@ -217,7 +217,7 @@ and in the second the manager by executing (with the environment variables of ch go run ./cmd/manager/main.go ``` -Ensure that the Manager can connect to the Manager test server by setting the MANAGER_GRPC_PORT with the port value of the Manager test server. The Manager test server is listening on the default value of the MANAGER_GRPC_PORT. In the last one, you can run the verification commands. +Ensure that the Manager can connect to the Manager test server by setting the MANAGER_GRPC_PORT with the port value of the Manager test server. In the last terminal, you can run the verification commands. To verify that the manager launched the VM successfully, run the following command: diff --git a/manager/manager.proto b/manager/manager.proto index 2e56043d..e4b1f8d0 100644 --- a/manager/manager.proto +++ b/manager/manager.proto @@ -47,7 +47,7 @@ message ComputationRunReq { string name = 2; string description = 3; repeated Dataset datasets = 4; - repeated Algorithm algorithms = 5; + Algorithm algorithm = 5; repeated string result_consumers = 6; AgentConfig agent_config = 7; } diff --git a/manager/service.go b/manager/service.go index 4f6aa1ce..8f0d0d1c 100644 --- a/manager/service.go +++ b/manager/service.go @@ -84,13 +84,8 @@ func (ms *managerService) Run(ctx context.Context, c *manager.ComputationRunReq) LogLevel: c.AgentConfig.LogLevel, }, } - for _, algo := range c.Algorithms { - if len(algo.Hash) != hashLength { - ms.publishEvent("vm-provision", c.Id, "failed", json.RawMessage{}) - return "", errInvalidHashLength - } - ac.Algorithms = append(ac.Algorithms, agent.Algorithm{ID: algo.Id, Provider: algo.Provider, Hash: [hashLength]byte(algo.Hash)}) - } + ac.Algorithm = agent.Algorithm{ID: c.Algorithm.Id, Provider: c.Algorithm.Provider, Hash: [hashLength]byte(c.Algorithm.Hash)} + for _, data := range c.Datasets { if len(data.Hash) != hashLength { ms.publishEvent("vm-provision", c.Id, "failed", json.RawMessage{}) diff --git a/pkg/manager/manager.pb.go b/pkg/manager/manager.pb.go index 490073e5..acb4a7d5 100644 --- a/pkg/manager/manager.pb.go +++ b/pkg/manager/manager.pb.go @@ -341,7 +341,7 @@ type ComputationRunReq struct { Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` Datasets []*Dataset `protobuf:"bytes,4,rep,name=datasets,proto3" json:"datasets,omitempty"` - Algorithms []*Algorithm `protobuf:"bytes,5,rep,name=algorithms,proto3" json:"algorithms,omitempty"` + Algorithm *Algorithm `protobuf:"bytes,5,opt,name=algorithm,proto3" json:"algorithm,omitempty"` ResultConsumers []string `protobuf:"bytes,6,rep,name=result_consumers,json=resultConsumers,proto3" json:"result_consumers,omitempty"` AgentConfig *AgentConfig `protobuf:"bytes,7,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` } @@ -406,9 +406,9 @@ func (x *ComputationRunReq) GetDatasets() []*Dataset { return nil } -func (x *ComputationRunReq) GetAlgorithms() []*Algorithm { +func (x *ComputationRunReq) GetAlgorithm() *Algorithm { if x != nil { - return x.Algorithms + return x.Algorithm } return nil } @@ -704,7 +704,7 @@ var file_manager_manager_proto_rawDesc = []byte{ 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x00, 0x52, 0x06, 0x72, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x22, 0x9f, 0x02, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, + 0x61, 0x67, 0x65, 0x22, 0x9d, 0x02, 0x0a, 0x11, 0x43, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, @@ -712,49 +712,49 @@ var file_manager_manager_proto_rawDesc = []byte{ 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2c, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x44, 0x61, 0x74, 0x61, - 0x73, 0x65, 0x74, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x32, 0x0a, - 0x0a, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, - 0x72, 0x69, 0x74, 0x68, 0x6d, 0x52, 0x0a, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, - 0x73, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x73, - 0x75, 0x6d, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x12, 0x37, 0x0a, 0x0c, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, - 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x49, 0x0a, 0x07, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, - 0x22, 0x4b, 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x1a, 0x0a, - 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, - 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0xf9, 0x01, - 0x0a, 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, - 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, - 0x74, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x66, 0x69, - 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, 0x46, 0x69, - 0x6c, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x24, 0x0a, - 0x0e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x46, - 0x69, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x63, 0x61, - 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x43, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, - 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, - 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, - 0x65, 0x64, 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x74, - 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, 0x54, 0x6c, 0x73, 0x32, 0x5b, 0x0a, 0x0e, 0x4d, 0x61, 0x6e, - 0x61, 0x67, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x07, 0x50, - 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, - 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, - 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6d, 0x61, 0x6e, 0x61, - 0x67, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x65, 0x74, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x73, 0x12, 0x30, 0x0a, + 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x72, + 0x69, 0x74, 0x68, 0x6d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, + 0x29, 0x0a, 0x10, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, + 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x75, 0x6c, + 0x74, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x73, 0x12, 0x37, 0x0a, 0x0c, 0x61, 0x67, + 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, + 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x22, 0x49, 0x0a, 0x07, 0x44, 0x61, 0x74, 0x61, 0x73, 0x65, 0x74, 0x12, 0x1a, + 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x4b, + 0x0a, 0x09, 0x41, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0xf9, 0x01, 0x0a, 0x0b, + 0x41, 0x67, 0x65, 0x6e, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, + 0x12, 0x0a, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, + 0x6f, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, + 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x63, 0x61, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x43, 0x61, 0x46, 0x69, 0x6c, + 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x63, 0x61, 0x5f, 0x66, + 0x69, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x43, 0x61, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, + 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x5f, 0x74, 0x6c, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x61, 0x74, 0x74, 0x65, + 0x73, 0x74, 0x65, 0x64, 0x54, 0x6c, 0x73, 0x32, 0x5b, 0x0a, 0x0e, 0x4d, 0x61, 0x6e, 0x61, 0x67, + 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x07, 0x50, 0x72, 0x6f, + 0x63, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x1a, 0x1a, 0x2e, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6d, + 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x00, + 0x28, 0x01, 0x30, 0x01, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, + 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -788,7 +788,7 @@ var file_manager_manager_proto_depIdxs = []int32{ 1, // 3: manager.ClientStreamMessage.agent_event:type_name -> manager.AgentEvent 0, // 4: manager.ClientStreamMessage.run_res:type_name -> manager.RunResponse 5, // 5: manager.ComputationRunReq.datasets:type_name -> manager.Dataset - 6, // 6: manager.ComputationRunReq.algorithms:type_name -> manager.Algorithm + 6, // 6: manager.ComputationRunReq.algorithm:type_name -> manager.Algorithm 7, // 7: manager.ComputationRunReq.agent_config:type_name -> manager.AgentConfig 3, // 8: manager.ManagerService.Process:input_type -> manager.ClientStreamMessage 4, // 9: manager.ManagerService.Process:output_type -> manager.ComputationRunReq diff --git a/test/computations/main.go b/test/computations/main.go index 83b7780c..a38af5ae 100644 --- a/test/computations/main.go +++ b/test/computations/main.go @@ -58,7 +58,7 @@ func (s *svc) Run(ipAdress string, reqChan chan *manager.ComputationRunReq) { Name: "sample computation", Description: "sample descrption", Datasets: []*manager.Dataset{{Id: "1", Provider: "provider1", Hash: dataHash[:]}}, - Algorithms: []*manager.Algorithm{{Id: "1", Provider: "provider1", Hash: algoHash[:]}}, + Algorithm: &manager.Algorithm{Id: "1", Provider: "provider1", Hash: algoHash[:]}, ResultConsumers: []string{"consumer1"}, AgentConfig: &manager.AgentConfig{ Port: "7002", diff --git a/test/manual/README.md b/test/manual/README.md index abb9d7a9..5bb225bb 100644 --- a/test/manual/README.md +++ b/test/manual/README.md @@ -2,15 +2,13 @@ ## CLI -Throughout the tests, we assume that our current working directory is the root of the `agent` repository, both on the host machine and in the VM. +Throughout the tests, we assume that our current working directory is the root of the `cocos` repository, both on the host machine and in the VM. ### Python requirements -Do this both on the host machine and in the VM. +Do this in the VM. ```sh -apt update -apt install python3-pip pip3 install pandas scikit-learn ``` @@ -22,7 +20,6 @@ Open console on the host, and run ```sh export AGENT_GRPC_URL=localhost:7002 -export MANAGER_GRPC_URL=localhost:7001 # For attested TLS, also define the path to the computation.json that contains reference values for the fields of the attestation report export AGENT_GRPC_MANIFEST=./test/manual/computation/computation.json