monitor

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blockchain

type Blockchain interface {
	// task operation
	ListTask(opt *blockchain.ListFLTaskOptions) (blockchain.FLTasks, error)
	ExecuteTask(opt *blockchain.FLTaskExeStatusOptions) error
	ConfirmTask(opt *blockchain.FLTaskConfirmOptions) error
	RejectTask(opt *blockchain.FLTaskConfirmOptions) error
	// query the list of authorization applications
	ListFileAuthApplications(opt *xdbchain.ListFileAuthOptions) (xdbchain.FileAuthApplications, error)
	// publish sample file's authorization application
	PublishFileAuthApplication(opt *xdbchain.PublishFileAuthOptions) error
}

type MpcHandler

type MpcHandler interface {
	// TaskStartPrepare prepare resources before starting local MPC task, like parameters and sample data
	TaskStartPrepare(task blockchain.FLTask) (*pbCom.StartTaskRequest, error)
	// StartLocalMpcTask start local mpc task
	// task required parameters passed when starting local task training
	StartLocalMpcTask(task *pbCom.StartTaskRequest, isSendTaskToOthers bool) error
	// GetAvailableTasksNum get available numbers of task execution resources
	// used check how many tasks could be handled this round
	GetAvailableTasksNum() (int, int)
	// CheckMpcTimeOutTasks checks tasks in execution pool if they're expired,
	// and stops expired tasks
	CheckMpcTimeOutTasks()
}

type TaskMonitor

type TaskMonitor struct {
	ExecutionType   string // mode for downloading sample files during tasks execution
	PrivateKey      ecdsa.PrivateKey
	PublicKey       ecdsa.PublicKey
	RequestInterval time.Duration // task loop interval

	Blockchain Blockchain // task contract invoke
	MpcHandler MpcHandler
	// contains filtered or unexported fields
}

TaskMonitor

func (*TaskMonitor) RetryProcessingTask

func (t *TaskMonitor) RetryProcessingTask(ctx context.Context)

RetryProcessingTask process tasks in Processing status when restarting server

this step is necessary because when participants abnormally exit computation process
the task may be in Processing stage forever

func (*TaskMonitor) StartTaskLoopRequest

func (t *TaskMonitor) StartTaskLoopRequest(ctx context.Context)

StartTaskLoopRequest starts timed task which will block until receive Stop signal

func (*TaskMonitor) StopLoopReq

func (t *TaskMonitor) StopLoopReq()

StopLoopReq wait for t.StopLoopReq() to quit

func (*TaskMonitor) StopRetryReq

func (t *TaskMonitor) StopRetryReq()

StopRetryReq wait for t.RetryProcessingTask() to quit

Jump to

Keyboard shortcuts

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