remote

package
v0.0.0-...-32b710e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxHightPrioritySlot  = 48
	MaxMiddlePrioritySlot = 48

	SlotTCPTimeoutSeconds = 3600 * 24

	MaxQuerySlotBatchSize = 10

	// 最大slot空闲时间,超过考虑释放
	MaxSlotIdleIntervalTime = 30 * time.Second

	// 最大job空闲时间,超过这个考虑转本地
	MaxJosIdleIntervalTime = 60 * time.Second
	// 最大无slot的时间,和上面结合起来,考虑转本地
	MaxNoSlotSIntervalTime = 30 * time.Second

	RefusedRecoverSeconds = 120
)

Variables

This section is empty.

Functions

func NewMgr

func NewMgr(pCtx context.Context, work *types.Work) types.RemoteMgr

NewMgr get a new Remote Mgr

Types

type Mgr

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

Mgr describe the remote manager provides the actions handler to remote workers

func (*Mgr) DecRemoteJobs

func (m *Mgr) DecRemoteJobs()

DecRemoteJobs dec remote jobs

func (*Mgr) ExecuteTask

ExecuteTask run the task in remote worker and ensure the dependent files

func (*Mgr) IncRemoteJobs

func (m *Mgr) IncRemoteJobs()

IncRemoteJobs inc remote jobs

func (*Mgr) Init

func (m *Mgr) Init()

Init do the initialization for remote manager !! only call once !!

func (*Mgr) SendFiles

func (m *Mgr) SendFiles(req *types.RemoteTaskSendFileRequest) ([]string, error)

SendFiles send the specific files to remote workers

func (*Mgr) Start

func (m *Mgr) Start()

func (*Mgr) TotalSlots

func (m *Mgr) TotalSlots() int

TotalSlots return available total slots

type RemoteSlotMgr

type RemoteSlotMgr interface {
	Handle(ctx context.Context)
	Reset(hl []*dcProtocol.Host) ([]*dcProtocol.Host, error)
	DisableAllWorker()
	GetDeadWorkers() []*worker
	RecoverDeadWorker(w *worker)
	DisableWorker(host *dcProtocol.Host)
	EnableWorker(host *dcProtocol.Host)
	CanWorkerRetry(host *dcProtocol.Host) bool // check if worker can retry, if can set worker status to retrying
	SetWorkerStatus(host *dcProtocol.Host, status Status)
	Lock(usage dcSDK.JobUsage, f string, banWorkerList []*dcProtocol.Host) *dcProtocol.Host
	Unlock(usage dcSDK.JobUsage, host *dcProtocol.Host)
	TotalSlots() int
	GetWorkers() []*worker
	CountWorkerError(w *worker)
	IsWorkerDead(w *worker, netErrorLimit int) bool
	WorkerDead(w *worker)
}

type Status

type Status int

Status save worker status

const (
	Init Status = iota
	Detecting
	DetectSucceed
	DetectFailed
	Refused
	InService
	Retrying
	RetrySucceed
	RetryFailed
	Unknown = 99
)

define file send status

func (Status) String

func (f Status) String() string

String return the string of FileSendStatus

Jump to

Keyboard shortcuts

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