Documentation ¶
Index ¶
Constants ¶
const UUID = "uuid"
UUID indentifier for tasks
Variables ¶
var ActionRecomposatorRegistry map[string]func(docker *client.Client, project string, cfg map[string]interface{}) (ActionRecomposator, error)
var ActionValidatorRegistry map[string]func(map[string]interface{}) (ActionValidator, error)
var ActionsRegistry map[string]func() action.Action
ActionsRegistry register all Action implementation
var IsLabelValid = regexp.MustCompile(`^[a-z0-9]+([.-][a-z0-9]+)*$`).MatchString
IsLabelValid is a simple function used to check validity of both key and value pairs in labels
var RunRegistry map[string]func() _run.Run
RunRegistry register all Run implementation
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // Validate if attributes are correct Validate() error // Run with a context, a working directory and environments variables. Up(pwd string, environments map[string]string, runID int) (run.Run, error) // RegisteredName is registered name RegisteredName() string }
Action interface describe behavior of a job
type ActionRecomposator ¶
type ActionValidator ¶
type DummyAction ¶
type DummyAction struct { Name string `json:"name"` Wait time.Duration `json:"wait"` Counter int64 `json:"counter"` ExitCode int `json:"exit_code"` // contains filtered or unexported fields }
DummyAction is the most basic action, used for tests and illustration purpose
func (*DummyAction) RegisteredName ¶
func (da *DummyAction) RegisteredName() string
func (*DummyAction) Validate ¶
func (da *DummyAction) Validate() error
Validate action interface implementation
type DummyActionValidator ¶
type DummyActionValidator struct{}
func (*DummyActionValidator) ValidateAction ¶
func (d *DummyActionValidator) ValidateAction(a Action) []error
type DummyRun ¶
type DummyRun struct {
// contains filtered or unexported fields
}
func (*DummyRun) RegisteredName ¶
type RawTask ¶
type RawTask struct { Start time.Time `json:"start"` // Start time MaxWaitTime Duration `json:"max_wait_time"` // Max wait time before starting Action MaxExectionTime Duration `json:"max_execution_time"` // Max execution time CPU int `json:"cpu"` // CPU quota RAM int `json:"ram"` // RAM quota Action map[string]json.RawMessage `json:"action"` // Action is an abstract, the thing to do Id uuid.UUID `json:"id"` // Id Status status.Status `json:"status"` // Status Mtime time.Time `json:"mtime"` // Modified time Owner string `json:"owner"` // Owner Retry int `json:"retry"` // Number of retry before crash Every time.Duration `json:"every"` // Periodic execution. Exclusive with Cron Cron string `json:"cron"` // Cron definition. Exclusive with Every Environments map[string]string `json:"environments,omitempty"` Run map[string]json.RawMessage `json:"run"` RunCounter int `json:"run_counter"` Runs []_run.Data `json:"runs"` Labels map[string]string `json:"labels"` }
type Recomposator ¶
type Recomposator struct { Recomposators map[string]map[string]interface{} `yaml:"recomposators"` // contains filtered or unexported fields }
func (*Recomposator) RecomposeAction ¶
func (r *Recomposator) RecomposeAction(a Action) (Action, error)
type Resp ¶
type Resp struct { Start time.Time `json:"start"` // Start time MaxWaitTime time.Duration `json:"max_wait_time"` // Max wait time before starting Action MaxExectionTime time.Duration `json:"max_execution_time"` // Max execution time CPU int `json:"cpu"` // CPU quota RAM int `json:"ram"` // RAM quota Id uuid.UUID `json:"id"` // Id Status status.Status `json:"status"` // Status Mtime time.Time `json:"mtime"` // Modified time Owner string `json:"owner"` // Owner Retry int `json:"retry"` // Number of retry before crash Every time.Duration `json:"every"` // Periodic execution. Exclusive with Cron Cron string `json:"cron"` // Cron definition. Exclusive with Every Environments map[string]string `json:"environments,omitempty"` Run _run.Data `json:"run"` RunCounter int `json:"run_counter"` Runs []_run.Data `json:"runs"` Labels map[string]string `json:"labels"` }
Resp represent a task that can be send directly on the wire
type Task ¶
type Task struct { Start time.Time `json:"start"` // Start time MaxWaitTime time.Duration `json:"max_wait_time"` // Max wait time before starting Action MaxExectionTime time.Duration `json:"max_execution_time"` // Max execution time CPU int `json:"cpu"` // CPU quota RAM int `json:"ram"` // RAM quota Action action.Action `json:"action"` // Action is an abstract, the thing to do Id uuid.UUID `json:"id"` // Id Cancel context.CancelFunc `json:"-"` // Cancel the action Status status.Status `json:"status"` // Status Mtime time.Time `json:"mtime"` // Modified time Owner string `json:"owner"` // Owner Retry int `json:"retry"` // Number of retry before crash Every time.Duration `json:"every"` // Periodic execution. Exclusive with Cron Cron string `json:"cron"` // Cron definition. Exclusive with Every Environments map[string]string `json:"environments,omitempty"` Run _run.Run `json:"run"` RunCounter int `json:"run_counter"` Runs []_run.Data `json:"runs"` Labels map[string]string `json:"labels"` // contains filtered or unexported fields }
Task something to do
func (*Task) AddRunToHistory ¶
AddRunToHistory adds run to history by prepending it
func (*Task) InjectPredefinedEnv ¶
func (t *Task) InjectPredefinedEnv()
InjectPredefinedEnv is used to inject or modifiy Density predefined env variables
func (*Task) MarshalJSON ¶
func (*Task) PrepareReschedule ¶
func (t *Task) PrepareReschedule()
PrepareRechedule is used to modify start date in the future in case of a configured cron or every ! This does no check if cron or every is a valid value
func (*Task) ToTaskResp ¶
ToTaskResp will Convert a Task to TaskResp
func (*Task) UnmarshalJSON ¶
type TaskByKarma ¶
type TaskByKarma []*Task
func (TaskByKarma) Len ¶
func (t TaskByKarma) Len() int
func (TaskByKarma) Less ¶
func (t TaskByKarma) Less(i, j int) bool
func (TaskByKarma) Swap ¶
func (t TaskByKarma) Swap(i, j int)
type TaskByStart ¶
type TaskByStart []*Task
func (TaskByStart) Len ¶
func (t TaskByStart) Len() int
func (TaskByStart) Less ¶
func (t TaskByStart) Less(i, j int) bool
func (TaskByStart) Swap ¶
func (t TaskByStart) Swap(i, j int)