engine

package
v0.0.0-...-ebe581b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The number of executing task concurrently
	DefaultTrainTaskLimit   = 100
	DefaultPredictTaskLimit = 100
	DefaultRpcTimeout       = 3

	// Task default max execution time
	DefaultMpcTaskMaxExecTime = time.Hour * 2
	// Task loop default interval time
	DefaultRequestInterval = time.Second * 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine task processing engine

chain is the handler for blockchain operation, which includes node, task and file operations
node denotes executor node identity, which includes node id, node private key, host address...
storage is the handler for results storage, which includes trained model and prediction result storage
mpcHandler is the handler for mpc task execution, which includes task preparation, task execution, results storage...
monitor is the handler for task monitoring, that is, monitoring tasks to be executed

func NewEngine

func NewEngine(conf *config.ExecutorConf) (e *Engine, err error)

NewEngine initiates Engine by executor node configuration

func (*Engine) Close

func (e *Engine) Close()

Close waits until all inner services stop

func (*Engine) GetMpcService

func (e *Engine) GetMpcService() *cluster.Service

GetMpcService returns mpc service to be registered to grpcServer

func (*Engine) GetPredictResult

func (e *Engine) GetPredictResult(ctx context.Context, in *pbTask.TaskRequest) (*pbTask.PredictResponse, error)

GetPredictResult checks task's initiator and gets prediction result from Xuper db.

in.PubKey must matches task.Requester, only task.Requester can get prediction result.

func (*Engine) GetTaskById

func (e *Engine) GetTaskById(ctx context.Context, in *pbTask.GetTaskRequest) (*pbTask.FLTask, error)

GetTaskById queries task details by taskID

func (*Engine) ListTask

func (e *Engine) ListTask(ctx context.Context, in *pbTask.ListTaskRequest) (*pbTask.FLTasks, error)

ListTask lists tasks from blockchain by requester or executor's Public Key

func (*Engine) Start

func (e *Engine) Start(ctx context.Context) error

Start registers local node to blockchain and starts Monitor

func (*Engine) StartTask

func (e *Engine) StartTask(ctx context.Context, in *pbTask.TaskRequest) (*pbTask.TaskResponse, error)

StartTask starts mpc-training or mpc-prediction after received "task starting" message from remote executor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL