job

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2016 License: MIT Imports: 29 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeSSHClientStore

func InitializeSSHClientStore(ttl time.Duration)

InitializeSSHClientStore initialies the global SSH connection store and sets the time-to-live for unused connections.

Types

type Config

type Config struct {
	Name       string      `json:"name,omitempty"`
	Schedule   string      `json:"schedule,omitempty"`
	Timeout    string      `json:"timeout,omitempty"`
	Output     *output     `json:"output,omitempty"`
	Host       *host       `json:"host,omitempty"`
	HostsFile  *hostsFile  `json:"hosts,omitempty"`
	Pre        *command    `json:"pre,omitempty"`
	Command    *command    `json:"command,omitempty"`
	Post       *command    `json:"post,omitempty"`
	Forwarding *forwarding `json:"forwarding,omitempty"`
	Tunnel     *forwarding `json:"tunnel,omitempty"`
	SCP        *scpData    `json:"scp,omitempty"`
}

Config is the in-memory representation of a job configuration.

func ReadConfig

func ReadConfig(file string) (*Config, error)

ReadConfig parses the file into a Config.

func (*Config) ExecutionTree

func (c *Config) ExecutionTree() (flunc.Flunc, error)

ExecutionTree creates the execution tree necessary to executeCommand the configured steps.

func (*Config) JSON

func (c *Config) JSON() string

JSON generates the Config's JSON representation.

func (*Config) String

func (c *Config) String() string

func (*Config) Tree

func (c *Config) Tree(full, raw bool, maxHosts, maxCommands int) string

Tree returns a textual representation of the Config's execution tree. When full is true, housekeeping steps are included. When raw is true, template string are output in the un-interpolated form.

type EventFilter added in v0.9.0

type EventFilter func(e NodeEvent) bool

A EventFilter returns wether the e matches the filter.

type LogMessage added in v0.9.0

type LogMessage struct {
	Timestamp     time.Time
	Line          int
	File, Message string
}

A LogMessage .

type Logger added in v0.9.0

type Logger interface {
	SetOutput(w io.Writer)
	Flags() int
	SetFlags(flag int)
	Prefix() string
	SetPrefix(prefix string)
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
	Panic(v ...interface{})
	Panicf(format string, v ...interface{})
	Panicln(v ...interface{})
	Output(calldepth int, s string) error
}

Logger is an interface for loggers. It is satisfied by log.Logger.

type NodeEvent added in v0.9.0

type NodeEvent struct {
	Timestamp time.Time
	Status    NodeStatus
	Typ, Text string
}

NodeEvent describes a event during execution

type NodeEvents added in v0.9.0

type NodeEvents []NodeEvent

NodeEvents is a list of events

func (*NodeEvents) Filter added in v0.9.0

func (e *NodeEvents) Filter(f EventFilter) NodeEvents

Filter returns all NodeEvents matching f.

func (*NodeEvents) FilterStatus added in v0.9.0

func (e *NodeEvents) FilterStatus(status NodeStatus) NodeEvents

FilterStatus returns all NodeEvents with status status.

func (*NodeEvents) FilterType added in v0.9.0

func (e *NodeEvents) FilterType(typ string) NodeEvents

FilterType returns all NodeEvents with type typ.

type NodeStatus added in v0.9.0

type NodeStatus int

NodeStatus describes the status of a node.

const (
	// Execution didn't start yet.
	NotStartedNode NodeStatus = iota
	// Node is currently executed.
	RunningNode
	// Execution completed.
	CompletedNode
	// Execution failed.
	FailedNode
)

type TelemetryInfo added in v0.9.0

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

TelemetryInfo holds informations about an instrumented job

func Instrument added in v0.9.0

func Instrument(c *Config) (*TelemetryInfo, error)

Instrument the given job.

func (*TelemetryInfo) Events added in v0.9.0

func (t *TelemetryInfo) Events() NodeEvents

Events returns a list of event that occured during execution

func (*TelemetryInfo) GetFlunc added in v0.9.0

func (t *TelemetryInfo) GetFlunc() (flunc.Flunc, <-chan string)

GetFlunc executes the instrumented job, the channel must be serviced, otherwise execution hangs.

Jump to

Keyboard shortcuts

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