tasks

package
v0.0.0-...-847bbec Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const MachineReadOperationTimeout = 900

Variables

View Source
var TaskMutex sync.RWMutex

Functions

func ConvertActivityTaskInString

func ConvertActivityTaskInString(task ActivityTask) string

func ConvertSubActivityTaskInString

func ConvertSubActivityTaskInString(task ActivityTask) string

func DumpData

func DumpData(file string, data interface{}, overwrite bool)

func GetExclusionListExceptInstanceList

func GetExclusionListExceptInstanceList(infrastructure model.Infrastructure, instanceIds []string) []string

func SortGroups

func SortGroups(groups []ActivityGroup)

Types

type ActivityCouple

type ActivityCouple struct {
	Project    model.Project
	Infra      model.Infrastructure
	IsCloud    bool
	IsInstance bool
	Machine    model.LocalMachine
	CMachine   model.CloudMachine
	Instance   model.LocalInstance
	CInstance  model.CloudInstance
	Plans      []model.InstallationPlan
	Task       ActivityTask
	NewInfra   bool
}

func GetPostBuildTaskActivities

func GetPostBuildTaskActivities(infrastructure model.Infrastructure, task ActivityTask, exclusionList []string) ([]ActivityCouple, error)

func GetTaskActivities

func GetTaskActivities(project model.Project, infrastructure model.Infrastructure, task ActivityTask) ([]ActivityCouple, error)

func GetTaskActivitiesExclusion

func GetTaskActivitiesExclusion(project model.Project, infrastructure model.Infrastructure, task ActivityTask, exclusionList []string) ([]ActivityCouple, error)

type ActivityGroup

type ActivityGroup struct {
	Name       string
	Subject    string
	Activities []ActivityCouple
	NewInfra   bool
	Task       ActivityTask
	IsCloud    bool
}

func GroupActivitiesBySubject

func GroupActivitiesBySubject(activities []ActivityCouple) []ActivityGroup

type ActivityTask

type ActivityTask int
const (
	CreateMachine ActivityTask = iota
	DestroyMachine
	StopMachine
	StartMachine
	RestartMachine
	MachineStatus
	MachineEnv
	MachineInspect
	MachineIPAddress
	MachineExtendsDisk
)

type Job

type Job struct {
	Id       string
	Name     string
	Runnable Runnable
	Async    bool
	Sequence int
	Of       int
	State    bool
}

func (*Job) Abort

func (job *Job) Abort()

func (*Job) GetRunnable

func (job *Job) GetRunnable() Runnable

func (*Job) HasErrors

func (job *Job) HasErrors() bool

func (*Job) Init

func (job *Job) Init(Sequence int, Global int)

func (*Job) IsAsync

func (job *Job) IsAsync() bool

func (*Job) IsRunning

func (job *Job) IsRunning() bool

func (*Job) Run

func (job *Job) Run()

func (*Job) WaitFor

func (job *Job) WaitFor()

type JobProcess

type JobProcess interface {
	Run()
	IsRunning() bool
	IsAsync() bool
	HasErrors() bool
	Abort()
	Init(Sequence int, Global int)
	WaitFor()
	GetRunnable() Runnable
}

type MachineOperationsJob

type MachineOperationsJob struct {
	Name             string
	State            bool
	OutChan          chan *MachineOperationsJob
	OwnState         term.KeyValueElement
	Project          model.Project
	Infra            model.Infrastructure
	InstanceId       string
	Activity         ActivityCouple
	ActivityGroup    ActivityGroup
	MachineMessage   procedures.MachineMessage
	Index            int
	PartOf           int
	SendStartMessage bool
	Command          string
	Machine          string
	// contains filtered or unexported fields
}

func (*MachineOperationsJob) IsError

func (job *MachineOperationsJob) IsError() bool

func (*MachineOperationsJob) IsInterrupted

func (job *MachineOperationsJob) IsInterrupted() bool

func (*MachineOperationsJob) Response

func (job *MachineOperationsJob) Response() interface{}

func (*MachineOperationsJob) Start

func (job *MachineOperationsJob) Start(exitChannel chan bool)

func (*MachineOperationsJob) Status

func (job *MachineOperationsJob) Status() bool

func (*MachineOperationsJob) Stop

func (job *MachineOperationsJob) Stop()

func (*MachineOperationsJob) WaitFor

func (job *MachineOperationsJob) WaitFor()

type Runnable

type Runnable interface {
	Start(exitChannel chan bool)
	Stop()
	Status() bool
	IsInterrupted() bool
	IsError() bool
	Response() interface{}
	WaitFor()
}

type SchedulerState

type SchedulerState struct {
	Active bool
	Paused bool
	Pool   []SchedulerTask
}

type SchedulerTask

type SchedulerTask struct {
	Id        string
	Jobs      []JobProcess
	Active    bool
	Working   bool
	LastIndex int
	State     *state.StateContext
}

func (*SchedulerTask) Abort

func (task *SchedulerTask) Abort()

func (*SchedulerTask) Deactivate

func (task *SchedulerTask) Deactivate()

func (*SchedulerTask) Execute

func (task *SchedulerTask) Execute()

func (*SchedulerTask) Init

func (task *SchedulerTask) Init(context *state.StateContext)

func (*SchedulerTask) IsRunning

func (task *SchedulerTask) IsRunning() bool

func (*SchedulerTask) Wait

func (task *SchedulerTask) Wait()

type SortGroupType

type SortGroupType []ActivityGroup

func (SortGroupType) Len

func (a SortGroupType) Len() int

func (SortGroupType) Less

func (a SortGroupType) Less(i, j int) bool

func (SortGroupType) Swap

func (a SortGroupType) Swap(i, j int)

type TaskProcess

type TaskProcess interface {
	Run()
	IsRunning() bool
	Abort()
	Init(context *state.StateContext)
	Wait()
	Deactivate()
}

type TaskSignal

type TaskSignal struct {
	TaskId      string
	Complete    bool
	Errors      bool
	Interrupted bool
	Done        int
	Jobs        int
}

func (*TaskSignal) IsDone

func (Signal *TaskSignal) IsDone() bool

Jump to

Keyboard shortcuts

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