Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDownloader ¶
Types ¶
type Archiver ¶
func NewArchive ¶
type Client ¶
type Client struct { // Config contains the runtime configuration for the application Config *config.Config // Executor is the task invoker Executor *Executor }
func NewClientFromYaml ¶
func (*Client) AddEventHandler ¶
func (client *Client) AddEventHandler(handler EventHandler)
type EventHandler ¶
type EventHandler interface { // Register a task with the handler Register(task *Task) // Unregister a task from the handler Unregister(task *Task) // OnEvent is invoked by a task when execution state changes OnEvent(task *Task, e TaskEvent) // Close the handler Close() // AddRuntimeData makes realtime statistics available to the handler AddRuntimeData(data *TaskStatistics) }
EventHandler represents a type that can listen to Task events managed by the Executor
type Executor ¶
type Executor struct { // Environment is a mapping of all environment variables passed to each task on execution (except parallel tasks) Environment map[string]string // Tasks is a list of all Task objects that will be invoked Tasks []*Task // Statistics contains runtime statistics of all planned tasks Statistics *TaskStatistics // contains filtered or unexported fields }
type Task ¶
type Task struct { Id uuid.UUID // Config is the user-defined values parsed from the run yaml Config config.TaskConfig Options *config.Options // Command represents all non-Config items used to Execute and track task progress Command command // Children is a list of all sub-Tasks that should be run concurrently Children []*Task // TaskStatus is the last known TaskStatus value that represents the entire list of child commands Status TaskStatus // Started indicates whether the Task has been attempted to run Started bool // Completed indicates whether the Task has been finished execution Completed bool // FailedChildren is a list of Tasks with a non-zero return value FailedChildren int // contains filtered or unexported fields }
Task is a runtime object derived from the TaskConfig (parsed from the user yaml) and contains everything needed to Execute, track, and display the task.
func NewTask ¶
func NewTask(taskConfig config.TaskConfig, runtimeOptions *config.Options) *Task
NewTask creates a new task in the context of the user configuration at a particular screen location (row)
func (*Task) Execute ¶
func (task *Task) Execute(eventChan chan TaskEvent, waiter *sync.WaitGroup, environment map[string]string)
run executes a Tasks primary command (not child task commands) and monitors command events
func (*Task) Kill ¶
func (task *Task) Kill()
Kill will stop any running command (including child Tasks) with a -9 signal
func (*Task) UpdateExec ¶
UpdateExec reinstantiates the planned command to run based on the given path to an executable
type TaskEvent ¶
type TaskEvent struct { // Task is the task which the command was run from Task *Task // Status is the current pending/running/error/success TaskStatus of the command Status TaskStatus // Stdout is a single line from standard out (optional) Stdout string // Stderr is a single line from standard error (optional) Stderr string // Completed indicates if the command has exited Complete bool // todo: remove return code from an event // ReturnCode is the sub-process return code value upon completion ReturnCode int }
TaskEvent represents an output from stdout/stderr during command execution or when a command has markCompleted
type TaskStatistics ¶
type TaskStatistics struct { // Failed is a list of Task objects with non-zero return codes upon invocation Failed []*Task // Running indicates the number of actively running Tasks Running int // Completed is a list of Task objects that have been invoked (regardless of the return code value) Completed []*Task // Total indicates the number of tasks that can be run (Note: this is not necessarily the same number of tasks planned to be run) Total int }
type TaskStatus ¶
type TaskStatus int32
TaskStatus represents whether a task command is about to run, already running, or has completed (in which case, was it successful or not)
const ( StatusRunning TaskStatus = iota StatusPending StatusSuccess StatusError )