task

package
v0.0.0-...-31fc794 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2014 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Run tasks on the hosts and get results

Provide the script structure and functions.

Provide the task structure and functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunOnHost

func RunOnHost(conn remote.Remote, task Task, host host.Host, resultChan chan<- RunOutput)

Run a task on a target host

func RunOnHostBalancedByScriptName

func RunOnHostBalancedByScriptName(conn remote.Remote, task Task, ch chan<- RunOutput)

func RunOnRandomHost

func RunOnRandomHost(conn remote.Remote, task Task, ch chan<- RunOutput)

Types

type NRunningScriptsOutput

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

type RunOutput

type RunOutput struct {
	Stdout string
	Stderr string
	Err    error
}

type Script

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

A script that runs on a target host

func NewScript

func NewScript(name string, maxConcurrent *uint32) Script

func NewScriptFromPath

func NewScriptFromPath(name string, path string, maxConcurrent *uint32) (Script, error)

Takes a name and a path to a shell script and returns a Script object

func NewScriptWithCommands

func NewScriptWithCommands(name string, commands []string, maxConcurrent *uint32) Script

type Task

type Task struct {
	// A unique ID for the task
	Id string
	// A list of files and/or directories that the task requires
	DepFiles []string
	// A script for the task to run
	Script Script
	// The number of seconds before giving up on a task after it has been
	// started
	Timeout uint32
}

A task that runs on a target host

func New

func New(depFiles []string, script Script, timeout uint32) (Task, error)

func (*Task) CreateDir

func (t *Task) CreateDir() (path string, err error)

Creates a directory from a task object. The directory contains everything needed to run the task (e.g., required files and the script to run). The path to the created file is returned If there is a problem a non-nil error is returned

Jump to

Keyboard shortcuts

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