working worker
This commit is contained in:
parent
46524832de
commit
51f92278ac
9 changed files with 194 additions and 61 deletions
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/barakmich/go_raylet/ray_rpc"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type Raylet struct {
|
||||
|
|
@ -12,6 +13,7 @@ type Raylet struct {
|
|||
}
|
||||
|
||||
func (r *Raylet) GetObject(_ context.Context, req *ray_rpc.GetRequest) (*ray_rpc.GetResponse, error) {
|
||||
zap.S().Debug("GetObject")
|
||||
data, err := GetObject(r.Objects, deserializeObjectID(req.Id))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -23,6 +25,7 @@ func (r *Raylet) GetObject(_ context.Context, req *ray_rpc.GetRequest) (*ray_rpc
|
|||
}
|
||||
|
||||
func (r *Raylet) PutObject(_ context.Context, req *ray_rpc.PutRequest) (*ray_rpc.PutResponse, error) {
|
||||
zap.S().Debug("PutObject")
|
||||
id := r.Objects.MakeID()
|
||||
err := r.Objects.PutObject(&Object{id, req.Data})
|
||||
if err != nil {
|
||||
|
|
@ -38,6 +41,7 @@ func (r *Raylet) WaitObject(_ context.Context, _ *ray_rpc.WaitRequest) (*ray_rpc
|
|||
}
|
||||
|
||||
func (r *Raylet) Schedule(_ context.Context, task *ray_rpc.ClientTask) (*ray_rpc.ClientTaskTicket, error) {
|
||||
zap.S().Debug("Schedule:", task.Type)
|
||||
id := r.Objects.MakeID()
|
||||
ticket := &ray_rpc.ClientTaskTicket{serializeObjectID(id)}
|
||||
work := &ray_rpc.Work{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue