types

package
v0.0.0-...-6ac6f58 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0, BSD-3-Clause, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkIDLength = 5

	GlobalRecorderKey = "global_records"
)

Variables

View Source
var (
	ErrWorkIDGenerateFailed         = fmt.Errorf("work id generate failed")
	ErrNoAvailableWorkFound         = fmt.Errorf("no available work found")
	ErrWorkCannotBeRegistered       = fmt.Errorf("work can not be registered")
	ErrWorkCannotBeUnregistered     = fmt.Errorf("work can not be unregistered")
	ErrHostSlotOverLimit            = fmt.Errorf("host slot over limit")
	ErrHostNoFound                  = fmt.Errorf("host no found")
	ErrWorkNoFound                  = fmt.Errorf("work no found")
	ErrNoWork                       = fmt.Errorf("not any work")
	ErrNoAvailableHostSlotFound     = fmt.Errorf("no available host slot found")
	ErrWorkResourceCannotBeSet      = fmt.Errorf("work resource can not be set")
	ErrWorkSettingsCannotBeSet      = fmt.Errorf("work settings can not be set")
	ErrWorkIsNotWorking             = fmt.Errorf("work is not working")
	ErrWorkUnknownJobUsage          = fmt.Errorf("unknown job usage")
	ErrWorkNoAvailableJobUsageFound = fmt.Errorf("no available job usage found")
	ErrWorkCannotBeStart            = fmt.Errorf("work can not be start")
	ErrWorkCannotBeEnd              = fmt.Errorf("work can not be end")
	ErrFileNotFound                 = fmt.Errorf("not found file info")
	ErrWorkCannotBeUpdatedHeartbeat = fmt.Errorf("work can not be updated heartbeat")
	ErrSendFileFailed               = fmt.Errorf("send file failed")
	ErrTaskCannotBeReleased         = fmt.Errorf("task can not be released")
	ErrTaskAlreadyReleased          = fmt.Errorf("task already released")
	ErrSlotsLockFailed              = fmt.Errorf("slots lock failed`")
	ErrNoWaitingTask                = fmt.Errorf("no waitting task")
	ErrFileLock                     = fmt.Errorf("lock file failed")
	ErrWorkIDEmpty                  = fmt.Errorf("work id is empty")
)

define exported error messages

Functions

This section is empty.

Types

type BasicMgr

type BasicMgr interface {
	// if there a task running in work
	Alive() int64

	// call it when a task enter
	EnterTask()

	// call it when a task leave
	LeaveTask()

	// get work settings
	Settings() *WorkSettings

	// update work settings
	SetSettings(settings *WorkSettings)

	// get work info
	Info() *WorkInfo

	// update single job stats
	UpdateJobStats(stats *dcSDK.ControllerJobStats)

	// update work stats
	UpdateWorkStats(stats *WorkStats)

	// update work heartbeat
	Heartbeat() error

	// do register work
	Register(config *WorkRegisterConfig) error

	// do apply resource
	ApplyResource(config *WorkRegisterConfig) error

	// do unregister work
	Unregister(config *WorkUnregisterConfig) error

	// start work
	Start() error

	// end work
	End(timeoutBefore time.Duration) error

	// hang until the work is working(by someone else)
	WaitUntilWorking(ctx context.Context) bool

	// get work details
	GetDetails(jobIndex int) *WorkStatsDetail

	// get analysis status
	AnalysisStatus() *WorkAnalysisStatus

	// reset stat
	ResetStat() error

	// update toolchain
	SetToolChain(toolchain *ToolChain) error

	// get toolchain files by key
	GetToolChainFiles(key string) ([]dcSDK.FileDesc, int64, error)

	// get toolchain relative files by key
	GetToolChainRelativeFiles(key string) ([]dcSDK.FileDesc, int64, error)

	// get toolchain remote path by key
	GetToolChainRemotePath(key string) (string, error)

	// get toolchain remote Relative path by key
	GetToolChainRelativeRemotePath(key string) (string, error)

	// get toolchain timestamp by key
	GetToolChainTimestamp(key string) (int64, error)

	// add registered count for batch mode
	IncRegistered()

	// minus registered count for batch mode
	DecRegistered()
}

BasicMgr describe a manager for handling all actions with work basic issues

type CB4ResChanged

type CB4ResChanged func() error

CB4ResChanged call back function when remote resource changed

type CommonConfig

type CommonConfig struct {
	Configkey dcSDK.CommonConfigKey
	WorkerKey WorkerKeyConfig
	Data      []byte
	Config    interface{}
}

CommonConfig common work config

func (*CommonConfig) KeyEqual

func (ccf *CommonConfig) KeyEqual(other *CommonConfig) bool

Equal check if the two key are point to one work config

type FileCollectionInfo

type FileCollectionInfo struct {
	UniqID     string           `json:"uniq_id"`
	SendStatus FileSendStatus   `json:"send_status"`
	Files      []dcSDK.FileDesc `json:"files"`
	Timestamp  int64            `json:"timestamp"`
}

FileCollectionInfo save file collection send status

type FileInfo

type FileInfo struct {
	FullPath           string         `json:"full_path"`
	Size               int64          `json:"size"`
	LastModifyTime     int64          `json:"last_modify_time"`
	Md5                string         `json:"md5"`
	TargetRelativePath string         `json:"target_relative_path"`
	FileMode           uint32         `json:"file_mode"`
	LinkTarget         string         `json:"link_target"`
	SendStatus         FileSendStatus `json:"send_status"`
}

FileInfo record file info

func (*FileInfo) Match

func (f *FileInfo) Match(other dcSDK.FileDesc) bool

Match check if the FileDesc is point to some file as this FileInfo

type FileSendStatus

type FileSendStatus int

FileSendStatus save file send status

const (
	FileSendInit FileSendStatus = iota
	FileSending
	FileSendSucceed
	FileSendFailed
	FileSendUnknown = 99
)

define file send status

func (FileSendStatus) String

func (f FileSendStatus) String() string

String return the string of FileSendStatus

type FilesByServer

type FilesByServer struct {
	Server string
	Files  []*FileInfo
}

FilesByServer record files info to send for one server

type FilesDetails

type FilesDetails struct {
	Servers []*dcProtocol.Host
	File    dcSDK.FileDesc
}

FilesDetails describe the files details and the target server to send to.

type JobStats

type JobStats struct {
	Pid         int    `json:"pid"`
	WorkID      string `json:"work_id"`
	TaskID      string `json:"task_id"`
	BoosterType string `json:"booster_type"`

	Success           bool `json:"success"`
	PreWorkSuccess    bool `json:"pre_work_success"`
	RemoteWorkSuccess bool `json:"remote_work_success"`
	PostWorkSuccess   bool `json:"post_work_success"`
	FinalWorkSuccess  bool `json:"final_work_success"`
	LocalWorkSuccess  bool `json:"local_work_success"`

	OriginArgs []string `json:"origin_args"`

	EnterTime int64 `json:"enter_time"`
	LeaveTime int64 `json:"leave_time"`

	PreWorkEnterTime  int64 `json:"pre_work_enter_time"`
	PreWorkLeaveTime  int64 `json:"pre_work_leave_time"`
	PreWorkLockTime   int64 `json:"pre_work_lock_time"`
	PreWorkUnlockTime int64 `json:"pre_work_unlock_time"`
	PreWorkStartTime  int64 `json:"pre_work_start_time"`
	PreWorkEndTime    int64 `json:"pre_work_end_time"`

	PostWorkEnterTime  int64 `json:"post_work_enter_time"`
	PostWorkLeaveTime  int64 `json:"post_work_leave_time"`
	PostWorkLockTime   int64 `json:"post_work_lock_time"`
	PostWorkUnlockTime int64 `json:"post_work_unlock_time"`
	PostWorkStartTime  int64 `json:"post_work_start_time"`
	PostWorkEndTime    int64 `json:"post_work_end_time"`

	FinalWorkStartTime int64 `json:"final_work_start_time"`
	FinalWorkEndTime   int64 `json:"final_work_end_time"`

	RemoteWorkEnterTime           int64 `json:"remote_work_enter_time"`
	RemoteWorkLeaveTime           int64 `json:"remote_work_leave_time"`
	RemoteWorkLockTime            int64 `json:"remote_work_lock_time"`
	RemoteWorkUnlockTime          int64 `json:"remote_work_unlock_time"`
	RemoteWorkStartTime           int64 `json:"remote_work_start_time"`
	RemoteWorkEndTime             int64 `json:"remote_work_end_time"`
	RemoteWorkPackStartTime       int64 `json:"remote_work_pack_start_time"`
	RemoteWorkPackEndTime         int64 `json:"remote_work_pack_end_time"`
	RemoteWorkSendStartTime       int64 `json:"remote_work_send_start_time"`
	RemoteWorkSendEndTime         int64 `json:"remote_work_send_end_time"`
	RemoteWorkPackCommonStartTime int64 `json:"remote_work_pack_common_start_time"`
	RemoteWorkPackCommonEndTime   int64 `json:"remote_work_pack_common_end_time"`
	RemoteWorkSendCommonStartTime int64 `json:"remote_work_send_common_start_time"`
	RemoteWorkSendCommonEndTime   int64 `json:"remote_work_send_common_end_time"`
	RemoteWorkProcessStartTime    int64 `json:"remote_work_process_start_time"`
	RemoteWorkProcessEndTime      int64 `json:"remote_work_process_end_time"`
	RemoteWorkReceiveStartTime    int64 `json:"remote_work_receive_start_time"`
	RemoteWorkReceiveEndTime      int64 `json:"remote_work_receive_end_time"`
	RemoteWorkUnpackStartTime     int64 `json:"remote_work_unpack_start_time"`
	RemoteWorkUnpackEndTime       int64 `json:"remote_work_unpack_end_time"`

	LocalWorkEnterTime  int64 `json:"local_work_enter_time"`
	LocalWorkLeaveTime  int64 `json:"local_work_leave_time"`
	LocalWorkLockTime   int64 `json:"local_work_lock_time"`
	LocalWorkUnlockTime int64 `json:"local_work_unlock_time"`
	LocalWorkStartTime  int64 `json:"local_work_start_time"`
	LocalWorkEndTime    int64 `json:"local_work_end_time"`
}

JobStats describe the single job stats

type LocalMgr

type LocalMgr interface {
	// init handler
	Init()

	Start()

	// lock local slot
	LockSlots(usage dcSDK.JobUsage, weight int32) bool

	// unlock local slot
	UnlockSlots(usage dcSDK.JobUsage, weight int32)

	// do task execution
	ExecuteTask(req *LocalTaskExecuteRequest,
		globalWork *Work,
		withlocalresource bool) (*LocalTaskExecuteResult, error)

	// get caches in pump mode
	GetPumpCache() (*analyser.FileCache, *analyser.RootCache)

	// get local slots info
	Slots() (int, int)
}

LocalMgr describe a manager for handling all actions with local execution for work

type LocalSlotsFreeConfig

type LocalSlotsFreeConfig struct {
	Usage  dcSDK.JobUsage
	Weight int32 `json:"weight"`
}

LocalSlotsFreeConfig describe the local slot unlock config

type LocalSlotsOccupyConfig

type LocalSlotsOccupyConfig struct {
	Usage  dcSDK.JobUsage
	Weight int32 `json:"weight"`
}

LocalSlotsOccupyConfig describe the local slot lock config

type LocalTaskExecuteRequest

type LocalTaskExecuteRequest struct {
	Pid          int
	Dir          string
	User         user.User
	Commands     []string
	Environments []string
	Stats        *dcSDK.ControllerJobStats
}

LocalTaskExecuteRequest describe the local task execution param

type LocalTaskExecuteResult

type LocalTaskExecuteResult struct {
	Result *dcSDK.LocalTaskResult
}

LocalTaskExecuteResult describe the local task execution result

type Mgr

type Mgr interface {
	// brings up the handler
	Run()

	// register work with config, return the work information,
	// and tell the caller if he is a leader in batch mode(always true in normal mode)
	RegisterWork(config *WorkRegisterConfig) (*WorkInfo, bool, error)

	// unregister specific work
	UnregisterWork(workID string, config *WorkUnregisterConfig) error

	// update heartbeat to work
	Heartbeat(workID string) error

	// start the work
	StartWork(workID string) error

	// end the work
	EndWork(workID string) error

	// update work settings
	SetWorkSettings(workID string, settings *WorkSettings) error

	// get work settings
	GetWorkSettings(workID string) (*WorkSettings, error)

	// get work status
	GetWorkStatus(workID string) (*dcSDK.WorkStatusDetail, error)

	// lock a local slot
	LockLocalSlots(workID string, usage dcSDK.JobUsage, weight int32) error

	// unlock a local slot
	UnlockLocalSlots(workID string, usage dcSDK.JobUsage, weight int32) error

	// do task
	ExecuteLocalTask(workID string, req *LocalTaskExecuteRequest) (*LocalTaskExecuteResult, error)

	// do remote task directly
	ExecuteRemoteTask(workID string, req *RemoteTaskExecuteRequest) (*RemoteTaskExecuteResult, error)

	// send files to remote worker
	SendRemoteFile(workID string, req *RemoteTaskSendFileRequest) error

	// update single job stats
	UpdateJobStats(workID string, stats *dcSDK.ControllerJobStats) error

	// update work stats
	UpdateWorkStats(workID string, stats *WorkStats) error

	// get work list
	GetWorkDetailList() WorkStatsDetailList

	// get work detail
	GetWorkDetail(workID string, index int) (*WorkStatsDetail, error)

	// update common controller config
	SetCommonConfig(config *CommonConfig) error

	// get caches in pump mode
	GetPumpCache(workID string) (*analyser.FileCache, *analyser.RootCache, error)

	// Get first workid
	GetFirstWorkID() (string, error)

	// Get first bazelNoLauncher workid
	GetFirstBazelNoLauncherWorkID() (string, error)
}

Mgr describe a manager for handling all actions in controller

type MgrSet

type MgrSet struct {
	Basic    func(context.Context, *Work) BasicMgr
	Local    func(context.Context, *Work) LocalMgr
	Remote   func(context.Context, *Work) RemoteMgr
	Resource func(context.Context, *Work) ResourceMgr
}

MgrSet describe the newer functions for work

type RemoteMgr

type RemoteMgr interface {
	// init handler
	Init()

	Start()

	// run task in remote worker
	ExecuteTask(req *RemoteTaskExecuteRequest) (*RemoteTaskExecuteResult, error)

	// send files to remote worker
	SendFiles(req *RemoteTaskSendFileRequest) ([]string, error)

	// get total remote worker slots
	TotalSlots() int

	// inc remote jobs
	IncRemoteJobs()

	// dec remote jobs
	DecRemoteJobs()
}

RemoteMgr describe a manager for handling all actions with remote workers for work

type RemoteTaskExecuteRequest

type RemoteTaskExecuteRequest struct {
	Pid           int
	Server        *dcProtocol.Host
	Req           *dcSDK.BKDistCommand
	Stats         *dcSDK.ControllerJobStats
	Sandbox       *dcSyscall.Sandbox
	IOTimeout     int
	BanWorkerList []*dcProtocol.Host
}

RemoteTaskExecuteRequest describe the remote task execution param

type RemoteTaskExecuteResult

type RemoteTaskExecuteResult struct {
	Result *dcSDK.BKDistResult
}

RemoteTaskExecuteResult describe the remote task execution result

type RemoteTaskSendFileRequest

type RemoteTaskSendFileRequest struct {
	Pid     int
	Server  *dcProtocol.Host
	Req     []dcSDK.FileDesc
	Sandbox *dcSyscall.Sandbox
	Stats   *dcSDK.ControllerJobStats
}

RemoteTaskSendFileRequest describe the file sending param

type RemoteTaskSendFileResult

type RemoteTaskSendFileResult struct {
	Result *dcSDK.BKSendFileResult
}

RemoteTaskSendFileResult describe the file sending result

type ResourceMgr

type ResourceMgr interface {
	// check if there are ready-to-work workers
	HasAvailableWorkers() bool

	// update tbs-server target
	SetServerHost(serverHost string)

	// update specific worker list
	SetSpecificHosts(hostList []string)

	// send stats, if brief true, then will not send the job stats
	SendStats(brief bool) error

	// send stats and reset after sent, if brief true, then will not send the job stats
	// !! this will call m.work.Lock() , to avoid dead lock
	SendAndResetStats(brief bool, resapplytimes []int64) error

	// get resource status
	GetStatus() *v2.RespTaskInfo

	// get worker list
	GetHosts() []*dcProtocol.Host

	// apply resource
	Apply(req *v2.ParamApply, force bool) (*v2.RespTaskInfo, error)

	// release resource
	Release(req *v2.ParamRelease) error

	// register call back function
	RegisterCallback(f CB4ResChanged) error

	// check whether apply finished
	IsApplyFinished() bool

	// TODO : check whether support abs path
	SupportAbsPath() bool
}

ResourceMgr describe a manager for handling all actions with resource and server for work

type ToolChain

type ToolChain struct {
	ToolKey                string
	ToolName               string
	ToolLocalFullPath      string
	ToolRemoteRelativePath string
	Files                  []dcSDK.ToolFile
	Timestamp              int64
}

ToolChain describe the toolchain info

type Work

type Work struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Work describe a set of complete actions one work, one resource

func NewWork

func NewWork(id string, conf *config.ServerConfig, mgrSet MgrSet, rp *recorder.RecordersPool) *Work

NewWork get a new Work

func (*Work) Basic

func (w *Work) Basic() BasicMgr

Basic return basic manager

func (*Work) Cancel

func (w *Work) Cancel()

Cancel cancel all handlers in work

func (*Work) Config

func (w *Work) Config() *config.ServerConfig

Config return config

func (*Work) GetRecorder

func (w *Work) GetRecorder(key string) (*recorder.Recorder, error)

GetRecorder return the Recorder instance for given key

func (*Work) ID

func (w *Work) ID() string

ID return work id

func (*Work) Local

func (w *Work) Local() LocalMgr

Local return local manager

func (*Work) Lock

func (w *Work) Lock()

Lock lock work

func (*Work) LockMgr

func (w *Work) LockMgr() dcSDK.LockMgr

LockMgr return local manager as dcSDK.LockMgr

func (*Work) RLock

func (w *Work) RLock()

RLock rLock work

func (*Work) RUnlock

func (w *Work) RUnlock()

RUnlock rUnlock work

func (*Work) Remote

func (w *Work) Remote() RemoteMgr

Remote return remote manager

func (*Work) Resource

func (w *Work) Resource() ResourceMgr

Resource return resource manager

func (*Work) Unlock

func (w *Work) Unlock()

Unlock unlock work

type WorkAnalysisStatus

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

WorkAnalysisStatus describe the work analyasus status

func NewWorkAnalysisStatus

func NewWorkAnalysisStatus() *WorkAnalysisStatus

NewWorkAnalysisStatus get a new WorkAnalysisStatus

func (*WorkAnalysisStatus) BasicCount

func (was *WorkAnalysisStatus) BasicCount() (remoteOK, remoteError, localOK, localError int)

BasicCount return some counts for job data

func (*WorkAnalysisStatus) DumpJobs

func (was *WorkAnalysisStatus) DumpJobs() []byte

DumpJobs encode WorkAnalysisStatus into json bytes

func (*WorkAnalysisStatus) GetJobsByIndex

func (was *WorkAnalysisStatus) GetJobsByIndex(index int) []*dcSDK.ControllerJobStats

GetJobsByIndex get the jobs whose index is larger than the given index

func (*WorkAnalysisStatus) Reset

func (was *WorkAnalysisStatus) Reset() error

Reset reset stat datas

func (*WorkAnalysisStatus) Update

func (was *WorkAnalysisStatus) Update(stats *dcSDK.ControllerJobStats)

Update 管理所有的job stats信息, 根据pid和进入executor的时间作为key来存储, 默认同一个key的caller需要保证stats是按照时间顺序来update的, 后来的会直接覆盖前者

type WorkCommonStatus

type WorkCommonStatus struct {
	Status                  dcSDK.WorkStatus
	Message                 string
	LastStatusChangeTime    time.Time
	InitTime                time.Time
	StartTime               time.Time
	EndTime                 time.Time
	RegisteredTime          time.Time
	UnregisteredTime        time.Time
	ResourceApplyingTime    time.Time
	ResourceAppliedTime     time.Time
	ResourceApplyFailedTime time.Time
	RemovableTime           time.Time
}

WorkCommonStatus describe the work status and actions timestamp

type WorkInfo

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

WorkInfo describe the information in a single work

func NewInitWorkInfo

func NewInitWorkInfo(id string) *WorkInfo

NewInitWorkInfo get a new work info by id

func (WorkInfo) BazelNoLauncher

func (wi WorkInfo) BazelNoLauncher() bool

BazelNoLauncher return bazelNoLauncher

func (*WorkInfo) CanBeEnd

func (wi *WorkInfo) CanBeEnd() bool

CanBeEnd check if work can be ended now

func (*WorkInfo) CanBeHeartbeat

func (wi *WorkInfo) CanBeHeartbeat() bool

CanBeHeartbeat check if work can be updated heartbeat from booster now

func (*WorkInfo) CanBeRegister

func (wi *WorkInfo) CanBeRegister() bool

CanBeRegistered check if work can be registered now

func (*WorkInfo) CanBeRemoved

func (wi *WorkInfo) CanBeRemoved() bool

CanBeRemoved check if work can be removed now

func (*WorkInfo) CanBeResourceApplied

func (wi *WorkInfo) CanBeResourceApplied() bool

CanBeResourceApplied check if work can be set resource applied now

func (*WorkInfo) CanBeResourceApplyFailed

func (wi *WorkInfo) CanBeResourceApplyFailed() bool

CanBeResourceApplyFailed check if work can be set resource apply failed now

func (*WorkInfo) CanBeResourceApplying

func (wi *WorkInfo) CanBeResourceApplying() bool

CanBeResourceApplying check if work can apply resource now

func (*WorkInfo) CanBeSetSettings

func (wi *WorkInfo) CanBeSetSettings() bool

CanBeSetSettings check if work can be set settings now

func (*WorkInfo) CanBeStart

func (wi *WorkInfo) CanBeStart() bool

CanBeStart check if work can be started now

func (*WorkInfo) CanBeUnregistered

func (wi *WorkInfo) CanBeUnregistered() bool

CanBeUnregistered check if work can be unregistered now

func (*WorkInfo) CommonStatus

func (wi *WorkInfo) CommonStatus() WorkCommonStatus

CommonStatus return work common status

func (*WorkInfo) DecPrepared

func (wi *WorkInfo) DecPrepared()

DecPrepared to inc preared remote task number

func (WorkInfo) Dump

func (wi WorkInfo) Dump() []byte

Dump encode work info into json

func (*WorkInfo) End

func (wi *WorkInfo) End(timeoutBefore time.Duration)

End set work end

func (*WorkInfo) EndTime

func (wi *WorkInfo) EndTime(t time.Time)

End set work end time

func (*WorkInfo) GetPrepared

func (wi *WorkInfo) GetPrepared() int32

GetPrepared to get preared remote task number

func (*WorkInfo) IncPrepared

func (wi *WorkInfo) IncPrepared()

IncPrepared to inc preared remote task number

func (*WorkInfo) Init

func (wi *WorkInfo) Init()

Init set work init

func (*WorkInfo) IsBatchMode

func (wi *WorkInfo) IsBatchMode() bool

IsBatchMode check if the work is in batch mode

func (*WorkInfo) IsUnregistered

func (wi *WorkInfo) IsUnregistered() bool

IsUnregistered check if work is unregistered

func (*WorkInfo) IsWorking

func (wi *WorkInfo) IsWorking() bool

IsWorking check if work is working

func (*WorkInfo) LastHeartbeat

func (wi *WorkInfo) LastHeartbeat() time.Time

LastHeartbeat return the last heartbeat time

func (WorkInfo) ProjectID

func (wi WorkInfo) ProjectID() string

ProjectID return project id

func (*WorkInfo) Register

func (wi *WorkInfo) Register(batchMode bool)

Register set work register

func (*WorkInfo) RegisterTime

func (wi *WorkInfo) RegisterTime(t time.Time)

Start set work start time

func (*WorkInfo) ResourceApplied

func (wi *WorkInfo) ResourceApplied()

ResourceApplied set work resource applied

func (*WorkInfo) ResourceApplyFailed

func (wi *WorkInfo) ResourceApplyFailed()

ResourceApplyFailed set work resource apply failed

func (*WorkInfo) ResourceApplying

func (wi *WorkInfo) ResourceApplying()

ResourceApplying set work resource apply

func (WorkInfo) Scene

func (wi WorkInfo) Scene() string

Scene return scene

func (*WorkInfo) SetBazelNoLauncher

func (wi *WorkInfo) SetBazelNoLauncher(flag bool)

SetBazelNoLauncher update bazelNoLauncher

func (*WorkInfo) SetProjectID

func (wi *WorkInfo) SetProjectID(projectID string)

SetProjectID update project id

func (*WorkInfo) SetRemovable

func (wi *WorkInfo) SetRemovable()

SetRemovable set work removable

func (*WorkInfo) SetScene

func (wi *WorkInfo) SetScene(scene string)

SetScene update scene

func (*WorkInfo) SetSettings

func (wi *WorkInfo) SetSettings(settings *WorkSettings)

SetSettings update work settings

func (*WorkInfo) SetStats

func (wi *WorkInfo) SetStats(stats *WorkStats)

SetStats update the work stats

func (*WorkInfo) SetStatusMessage

func (wi *WorkInfo) SetStatusMessage(s string)

SetStatusMessage update the status message

func (*WorkInfo) Start

func (wi *WorkInfo) Start()

Start set work start

func (*WorkInfo) StartTime

func (wi *WorkInfo) StartTime(t time.Time)

Start set work start time

func (*WorkInfo) Status

func (wi *WorkInfo) Status() dcSDK.WorkStatus

Status return work status

func (*WorkInfo) StatusMessage

func (wi *WorkInfo) StatusMessage() string

StatusMessage return the status message

func (WorkInfo) Success

func (wi WorkInfo) Success() bool

Success check if work is successful

func (WorkInfo) TaskID

func (wi WorkInfo) TaskID() string

TaskID return task id

func (*WorkInfo) Unregister

func (wi *WorkInfo) Unregister()

Unregister set work unregister

func (*WorkInfo) UpdateHeartbeat

func (wi *WorkInfo) UpdateHeartbeat(t time.Time)

UpdateHeartbeat update heartbeat time

func (WorkInfo) WorkID

func (wi WorkInfo) WorkID() string

WorkID return work id

type WorkRegisterConfig

type WorkRegisterConfig struct {
	BatchMode        bool           `json:"batch_mode"`
	ServerHost       string         `json:"server_host"`
	SpecificHostList []string       `json:"specific_host_list"`
	NeedApply        bool           `json:"need_apply"`
	Apply            *v2.ParamApply `json:"apply"`
}

WorkRegisterConfig describe the config of registering work

type WorkSettings

type WorkSettings struct {
	TaskID          string
	ProjectID       string
	Scene           string
	UsageLimit      map[dcSDK.JobUsage]int
	LocalTotalLimit int
	Preload         *dcSDK.PreloadConfig
	FilterRules     dcSDK.FilterRules
	Degraded        bool
	GlobalSlots     bool
}

WorkSettings describe the work settings

func (*WorkSettings) Dump

func (ws *WorkSettings) Dump() []byte

Dump encode work settings to json bytes

type WorkStats

type WorkStats struct {
	Success bool `json:"success"`
}

WorkStats describe the work stats

type WorkStatsDetail

type WorkStatsDetail struct {
	CurrentTime      int64                       `json:"current_time"`
	WorkID           string                      `json:"work_id"`
	TaskID           string                      `json:"task_id"`
	Scene            string                      `json:"scene"`
	Status           string                      `json:"status"`
	Success          bool                        `json:"success"`
	RegisteredTime   int64                       `json:"registered_time"`
	UnregisteredTime int64                       `json:"unregistered_time"`
	StartTime        int64                       `json:"start_time"`
	EndTime          int64                       `json:"end_time"`
	JobRemoteOK      int                         `json:"job_remote_ok"`
	JobRemoteError   int                         `json:"job_remote_error"`
	JobLocalOK       int                         `json:"job_local_ok"`
	JobLocalError    int                         `json:"job_local_error"`
	Jobs             []*dcSDK.ControllerJobStats `json:"jobs"`
}

WorkStatsDetail describe the work stats details

type WorkStatsDetailList

type WorkStatsDetailList []*WorkStatsDetail

func (WorkStatsDetailList) Len

func (wsl WorkStatsDetailList) Len() int

Len return the length

func (WorkStatsDetailList) Less

func (wsl WorkStatsDetailList) Less(i, j int) bool

Less do the comparing

func (WorkStatsDetailList) Swap

func (wsl WorkStatsDetailList) Swap(i, j int)

Swap do the data swap

type WorkUnregisterConfig

type WorkUnregisterConfig struct {
	Force         bool             `json:"force"`
	TimeoutBefore time.Duration    `json:"timeout_before"`
	Release       *v2.ParamRelease `json:"release"`
}

WorkUnregisterConfig describe the config of unregistering work

type WorkerKeyConfig

type WorkerKeyConfig struct {
	BatchMode bool
	ProjectID string
	Scene     string
}

WorkerKeyConfig describe the work unique key

func (*WorkerKeyConfig) Equal

func (wkc *WorkerKeyConfig) Equal(other *WorkerKeyConfig) bool

Equal check if the two key are point to one work

Jump to

Keyboard shortcuts

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