command

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2017 License: GPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultSleepTime defines a default sleep time.
	DefaultSleepTime = 30 * time.Second
	// PrintTimeFormat defines time format to be used to print logs.
	PrintTimeFormat = "2006/01/02 15:04:05"
	// ConfigFile defines the default configuration file name.
	ConfigFile = "roadie.yml"
	// DefaultWaitTimeOfInstanceCreation defines the default waiting time
	// for creating an instance.
	DefaultWaitTimeOfInstanceCreation = 3 * time.Minute
)
View Source
const (
	// QueueStatusHeaderName is the header name for queue names.
	QueueStatusHeaderName = "QUEUE NAME"
	// QueueStatusHeaderRunning is the header name for the numbers of running tasks.
	QueueStatusHeaderRunning = "RUNNING"
	// QueueStatusHeaderWaiting is the header name for the numbers of waiting tasks.
	QueueStatusHeaderWaiting = "WAITING"
	// QueueStatusHeaderPending is the header name for the numbers of pending tasks.
	QueueStatusHeaderPending = "PENDING"
	// QueueStatusHeaderWorker is the header name for the number of worker instances.
	QueueStatusHeaderWorker = "WORKER"
	// TaskStatusHeaderName is the header name for task names.
	TaskStatusHeaderName = "TASK NAME"
	// TaskStatusHeaderStatus is the header name for task statuses.
	TaskStatusHeaderStatus = "STATUS"
)
View Source
const (
	// MsgNotSet is the message to be printed when some config isn't set.
	MsgNotSet = "Not set"
)
View Source
const (
	// StdoutFilePrefix defines a prefix for stdout result files.
	StdoutFilePrefix = "stdout"
)

Variables

View Source
var (
	// ErrNoMetadata is an error raised then no metadata are attached to contexts.
	ErrNoMetadata = fmt.Errorf("No metadata are attached")
	// ErrNoConfiguration is an error raised when no configurations are given.
	ErrNoConfiguration = fmt.Errorf("No configurations are given")
	// ErrServiceConfiguration is an error raised when the given service
	// configuration is not correct.
	ErrServiceConfiguration = fmt.Errorf("Cloud service configuration is not correct")
)

Functions

func CmdConfigMachineType added in v0.3.5

func CmdConfigMachineType(c *cli.Context) error

CmdConfigMachineType shows current configuration of machine type, or show help message when either -h or --help flag is set.

func CmdConfigMachineTypeList added in v0.3.5

func CmdConfigMachineTypeList(c *cli.Context) (err error)

CmdConfigMachineTypeList implements `config machine list` command.

func CmdConfigMachineTypeSet added in v0.3.5

func CmdConfigMachineTypeSet(c *cli.Context) (err error)

CmdConfigMachineTypeSet implements `config machine set` command.

func CmdConfigMachineTypeShow added in v0.3.5

func CmdConfigMachineTypeShow(c *cli.Context) (err error)

CmdConfigMachineTypeShow implements `config machine set` command.

func CmdConfigProject

func CmdConfigProject(c *cli.Context) error

CmdConfigProject shows or sets project ID to config file.

func CmdConfigProjectSet

func CmdConfigProjectSet(c *cli.Context) (err error)

CmdConfigProjectSet implements `config project set` command.

func CmdConfigProjectShow

func CmdConfigProjectShow(c *cli.Context) (err error)

CmdConfigProjectShow implements `config project show` command.

func CmdConfigRegion added in v0.3.5

func CmdConfigRegion(c *cli.Context) error

CmdConfigRegion shows current configuration of zone, or show help message when either -h or --help flag is set.

func CmdConfigRegionList added in v0.3.5

func CmdConfigRegionList(c *cli.Context) (err error)

CmdConfigRegionList implements `config region list` command.

func CmdConfigRegionSet added in v0.3.5

func CmdConfigRegionSet(c *cli.Context) (err error)

CmdConfigRegionSet implements `config region set` command.

func CmdConfigRegionShow added in v0.3.5

func CmdConfigRegionShow(c *cli.Context) (err error)

CmdConfigRegionShow implements `config region show` command.

func CmdDataPut

func CmdDataPut(c *cli.Context) (err error)

CmdDataPut uploads a given file.

func CmdInit

func CmdInit(c *cli.Context) (err error)

CmdInit helps to create a configuration file.

func CmdLog

func CmdLog(c *cli.Context) (err error)

CmdLog shows logs of a given instance.

func CmdQueueAdd added in v0.3.5

func CmdQueueAdd(c *cli.Context) (err error)

CmdQueueAdd adds a given script to a given named queue.

func CmdQueueDelete added in v0.3.5

func CmdQueueDelete(c *cli.Context) (err error)

CmdQueueDelete deletes a task in a queue or whole queue.

func CmdQueueInstanceAdd added in v0.3.0

func CmdQueueInstanceAdd(c *cli.Context) (err error)

CmdQueueInstanceAdd implements `queue instance add`.

func CmdQueueInstanceList added in v0.3.0

func CmdQueueInstanceList(c *cli.Context) (err error)

CmdQueueInstanceList implements `queue instance list` command.

func CmdQueueLog added in v0.3.5

func CmdQueueLog(c *cli.Context) error

CmdQueueLog prints all log from a queue if only queue name is given; otherwise prints log of a specific task.

func CmdQueueRestart added in v0.3.0

func CmdQueueRestart(c *cli.Context) (err error)

CmdQueueRestart implements `queue restart` command.

func CmdQueueStatus added in v0.3.5

func CmdQueueStatus(c *cli.Context) error

CmdQueueStatus lists up existing queue information if no arguments given; otherwise lists up existing tasks' information in a given queue. Each information should have queue name, the number of items in the queue, the number of instances working to the queue.

func CmdQueueStop added in v0.3.0

func CmdQueueStop(c *cli.Context) (err error)

CmdQueueStop implements `queue stop` command.

func CmdResult

func CmdResult(c *cli.Context) error

CmdResult defines the default behavior which is showing help with --help or -h. Otherwise, do as list command.

func CmdResultDelete

func CmdResultDelete(c *cli.Context) (err error)

CmdResultDelete deletes result files which belong to a given instance and matches given queries.

func CmdResultGet

func CmdResultGet(c *cli.Context) error

CmdResultGet downloads results files which belong to a given named instance and matches one of given queries. If no queries are given, the wild card * will be used instead.

func CmdResultList

func CmdResultList(c *cli.Context) (err error)

CmdResultList shows a list of instance names or result files belonging to an instance. This command takes one optional argument, instance name. If an instance name is given, this command shows result files associated with the given instance. If any instance names are not given, this command shows names of instances of which results are stored in a cloud storage.

func CmdResultShow

func CmdResultShow(c *cli.Context) (err error)

CmdResultShow shows results of a given named instance. This command takes two arguments, instance name and file name; and prints the body of the given named file belonging to the given named instance. File name argument can be omitted and then all files which have prefix `stdout` will be printed.

func CmdRun

func CmdRun(c *cli.Context) (err error)

CmdRun specifies the behavior of `run` command.

func CmdSourcePut

func CmdSourcePut(c *cli.Context) (err error)

CmdSourcePut archives a given folder and uploads it as a given named file. This command takes two arguments: - filepath: path for a file or a directory - name: uploading archive name Argument name can be omitted. If name is omitted, the name of file or directory where filepath points will be used as the name argument. Note that source files are archived by tar-gz method and actual uploaded file will have `.tar.gz` suffix.

The source put command also takes --exclude flag. If the flag is given, any files mathing the excluding patters will be omitted from the source archive file.

func CmdStatus

func CmdStatus(c *cli.Context) error

CmdStatus shows status of instances.

func CmdStatusKill

func CmdStatusKill(c *cli.Context) error

CmdStatusKill kills an instance.

func GenerateDeleteAction

func GenerateDeleteAction(container string) func(*cli.Context) error

GenerateDeleteAction generates an action which deletes files from a given container.

func GenerateGetAction

func GenerateGetAction(container string) func(*cli.Context) error

GenerateGetAction generates an action which downloads files from a given container.

func GenerateListAction

func GenerateListAction(container string) func(*cli.Context) error

GenerateListAction generates an action which prints list of files in a given container. If url is true, show urls, too.

func PrepareCommand added in v0.3.4

func PrepareCommand(c *cli.Context) (err error)

PrepareCommand prepares executing any command; it loads the configuratio file, checkes global flags.

func PrintDirList

func PrintDirList(m *Metadata, container, prefix string, url, quiet bool) (err error)

PrintDirList prints a list of directoris in a given prefix.

func PrintFileList

func PrintFileList(m *Metadata, container, prefix string, url, quiet bool) (err error)

PrintFileList prints a list of files having a given prefix.

func UpdateResultSection added in v0.3.5

func UpdateResultSection(s *script.Script, overwrite bool, warning io.Writer) (err error)

UpdateResultSection updates result section of the given script file.

func UpdateSourceSection added in v0.3.5

func UpdateSourceSection(m *Metadata, s *script.Script, opt *SourceOpt, storage *cloud.Storage) (err error)

UpdateSourceSection updates source secrion of the given script according to the given option.

Types

type AddRecorder

type AddRecorder func(table *uitable.Table, info *cloud.FileInfo, quiet bool)

AddRecorder is a callback to add file information to a table.

type Metadata added in v0.3.5

type Metadata struct {
	// Context for running a command.
	Context context.Context
	// Config for running a command.
	Config *config.Config
	// Stdin in an io.Readre to read user's input.
	Stdin io.Reader
	// Stdout is an io.Writer to output messages to the standard output.
	Stdout io.Writer
	// Stderr is an io.Writer to output messages to the standard error.
	Stderr io.Writer
	// Logger to output logs.
	Logger *log.Logger
	// Spinner for decorating output standard message; not logging information.
	// If verbose mode is set, the spinner will be disabled.
	Spinner *spinner.Spinner
	// contains filtered or unexported fields
}

Metadata is a set of data used for any commands.

func (*Metadata) InstanceManager added in v0.3.5

func (m *Metadata) InstanceManager() (cloud.InstanceManager, error)

InstanceManager returns an instance manager interface.

func (*Metadata) LogManager added in v0.3.5

func (m *Metadata) LogManager() (cloud.LogManager, error)

LogManager returns a log manager interface.

func (*Metadata) QueueManager added in v0.3.5

func (m *Metadata) QueueManager() (cloud.QueueManager, error)

QueueManager returns a queue manager interface.

func (*Metadata) ResourceManager added in v0.3.5

func (m *Metadata) ResourceManager() (cloud.ResourceManager, error)

ResourceManager returns a resource manager interface.

func (*Metadata) StorageManager added in v0.3.5

func (m *Metadata) StorageManager() (cloud.StorageManager, error)

StorageManager returns a storage manager interface.

type QueueName added in v0.3.0

type QueueName struct {
	// Queue name.
	QueueName string
}

QueueName is a structure to obtaine QueueName attribute from entities in cloud datastore.

type SourceOpt added in v0.3.5

type SourceOpt struct {
	// Git specifies a URL for a git repository to be used as source code.
	Git string
	// URL specifies a URL of an archive or executable file.
	URL string
	// Local specifies a local path which contains source code. All files except
	// matched the exclude pattern are archived and uploaded to a cloud storage.
	Local string
	// Exclude specifies a glob patters. Matched paths are excluded from the
	// source code archive. This option works with the local option.
	Exclude []string
	// Source specifies a file name in uploaded as source code already.
	Source string
}

SourceOpt defines options to update source section

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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