tasks

package
v0.0.0-...-5d4f8f2 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOUNT_TYPE_DEFAULT int = iota
	MOUNT_TYPE_PIPE
	MOUNT_TYPE_FUSE
)

Variables

View Source
var TaskStatusKey = map[int]string{
	0:  "TASK_CREATED",
	10: "WAITING_FOR_POD",
	20: "TASK_STARTING",
	30: "POD_ASSIGNED",
	40: "WORKER_ASSIGNED",
	50: "TASK_INITIATED",
	60: "TASK_CONFIGURED",
	70: "TASK_WAITING",
	80: "TASK_RUNNING",

	90: "CMD_STARTED",
	91: "CMD_WAITING",
	92: "CMD_COMPLETE",

	100: "CMD_FAILED",
	110: "CMD_WARNING",

	120: "LOG_UPLOAD_FAILED",
	130: "LOG_UPLOAD_COMPLETE",

	140: "MODEL_UPLOAD_COMPLETE",
	150: "MODEL_UPLOAD_FAILED",

	160: "OUTPUT_UPLOAD_COMPLETE",
	170: "OUTPUT_UPLOAD_FAILED",

	180: "TASK_COMPLETING",
	190: "TASK_STOPPING",
	200: "TASK_CANCELLING",
	300: "TASK_FAILED",
	310: "TASK_STOPPED",
	320: "TASK_COMPLETED",
	330: "TASK_WARNING",
	340: "TASK_CANCELLED",
}

Functions

func NewTaskKey

func NewTaskKey() string

func TaskStatusByKey

func TaskStatusByKey(key TaskStatus) string

Types

type MountConfig

type MountConfig struct {
	//repo
	RepoName string

	//repo_type
	RepoType ws.RepoType

	//branch
	BranchName string

	// commit ID for file map
	CommitId string

	// target path for mount
	Target string

	// PIPE, FUSE or DEFAULT
	MountType int
}

details of mount file system this is usually tied to a repo or commit key

type MountMap

type MountMap map[string]MountConfig

func NewMountConfig

func NewMountConfig(repoName string, branchName string, commitId string, targetPath string, mountType int) MountMap

type Task

type Task struct {
	Id string
}

type TaskAttrs

type TaskAttrs struct {
	Task *Task
	// map of repo to target mounted paths
	// used during unmounting
	OpenMounts map[string]string

	// add time
	WorkDir string
	Cmd     string
	CmdArgs []string

	Status  TaskStatus
	Created time.Time

	Started   time.Time
	Completed time.Time

	Failed        time.Time
	FailureReason string

	CompletionText string

	TaskConfig *TaskConfig

	WorkerPref map[string]string
}

func NewTaskAttrs

func NewTaskAttrs(tc *TaskConfig) *TaskAttrs

func (*TaskAttrs) GetTaskConfig

func (t *TaskAttrs) GetTaskConfig() *TaskConfig

func (*TaskAttrs) MasterRepo

func (t *TaskAttrs) MasterRepo() (repoName, branchName, commitId string)

type TaskConfig

type TaskConfig struct {
	// repo to mount path mapping
	MountMap MountMap

	Cmd     string
	CmdArgs []string

	WorkDir string
}

func NewTaskConfig

func NewTaskConfig(cmd string, cargs []string, wdir string, mmap MountMap) *TaskConfig

type TaskStatus

type TaskStatus int
const (
	TASK_CREATED    TaskStatus = 0
	WAITING_FOR_POD TaskStatus = 10
	TASK_STARTING   TaskStatus = 20
	TASK_ASSIGNED   TaskStatus = 30
	POD_ASSIGNED    TaskStatus = 40
	TASK_INITIATED  TaskStatus = 50
	TASK_CONFIGURED TaskStatus = 60
	TASK_WAITING    TaskStatus = 70
	TASK_RUNNING    TaskStatus = 80

	CMD_STARTED  TaskStatus = 90
	CMD_WAITING  TaskStatus = 91
	CMD_COMPLETE TaskStatus = 92

	CMD_FAILED             TaskStatus = 100
	CMD_WARNING            TaskStatus = 110
	LOG_UPLOAD_FAILED      TaskStatus = 120
	LOG_UPLOAD_COMPLETE    TaskStatus = 130
	MODEL_UPLOAD_COMPLETE  TaskStatus = 140
	MODEL_UPLOAD_FAILED    TaskStatus = 150
	OUTPUT_UPLOAD_COMPLETE TaskStatus = 160
	OUTPUT_UPLOAD_FAILED   TaskStatus = 170
	TASK_COMPLETING        TaskStatus = 180
	TASK_STOPPING          TaskStatus = 190
	TASK_CANCELLING        TaskStatus = 200
	TASK_FAILED            TaskStatus = 300
	TASK_STOPPED           TaskStatus = 310
	TASK_COMPLETED         TaskStatus = 320
	TASK_WARNING           TaskStatus = 330
	TASK_CANCELLED         TaskStatus = 340
)

func (TaskStatus) DisplayText

func (ts TaskStatus) DisplayText() string

Jump to

Keyboard shortcuts

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