jobs

package
v0.8.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

/ factory is imported in ../external/factory.go, which allows Spin Cycle to be build without external jobs.

Index

Constants

This section is empty.

Variables

View Source
var Factory job.Factory = factory{}

Factory is a job.Factory that makes "shell-command" type jobs.

Functions

This section is empty.

Types

type Nop

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

Nop is a no-op job that does nothing and always returns success. It's used in place of jobs that we want to include in a job chain but haven't implemented yet.

func NewNop

func NewNop(jid job.Id) *Nop

func (*Nop) Create

func (j *Nop) Create(jobArgs map[string]interface{}) error

func (*Nop) Deserialize

func (j *Nop) Deserialize(bytes []byte) error

func (*Nop) Id

func (j *Nop) Id() job.Id

func (*Nop) Run

func (j *Nop) Run(jobData map[string]interface{}) (job.Return, error)

func (*Nop) Serialize

func (j *Nop) Serialize() ([]byte, error)

func (*Nop) Status

func (j *Nop) Status() string

func (*Nop) Stop

func (j *Nop) Stop() error

type ShellCommand

type ShellCommand struct {
	// Internal data (serialized)
	Cmd  string   `json:"cmd"`            // command to execute
	Args []string `json:"args,omitempty"` // args to cmd

	*sync.RWMutex
	// contains filtered or unexported fields
}

ShellCommand is a job.Job that runs a single shell command with arguments.

func NewShellCommand

func NewShellCommand(jid job.Id) *ShellCommand

NewShellCommand instantiates a new ShellCommand job. This should only be called by the Factory. jobName must be unique within a job chain.

func (*ShellCommand) Create

func (j *ShellCommand) Create(jobArgs map[string]interface{}) error

Create is a job.Job interface method.

func (*ShellCommand) Deserialize

func (j *ShellCommand) Deserialize(bytes []byte) error

Deserialize is a job.Job interface method.

func (*ShellCommand) Id

func (j *ShellCommand) Id() job.Id

Name is a job.Job interface method.

func (*ShellCommand) Run

func (j *ShellCommand) Run(jobData map[string]interface{}) (job.Return, error)

Run is a job.Job interface method.

func (*ShellCommand) Serialize

func (j *ShellCommand) Serialize() ([]byte, error)

Serialize is a job.Job interface method.

func (*ShellCommand) Status

func (j *ShellCommand) Status() string

Status is a job.Job interface method.

func (*ShellCommand) Stop

func (j *ShellCommand) Stop() error

Stop is a job.Job interface method.

Jump to

Keyboard shortcuts

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