nomad

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeploymentStatusRunning  = "running"
	DeploymentStatusCanceled = "canceled"
	DeploymentStatusSuccess  = "successful"
	AllocationStateDead      = "dead"
	Running                  = "running"
)

Variables

This section is empty.

Functions

func IsConnectionErr

func IsConnectionErr(err error) bool

Types

type Client

type Client struct {
	API *api.Client
}

func NewClient

func NewClient(config *api.Config) (*Client, error)

func (*Client) LogJobs

func (n *Client) LogJobs(ctx context.Context, follow bool, origin string, offset int64, jobIDs []string) (io.ReadCloser, error)

func (*Client) Run

func (n *Client) Run(job *api.Job) (bool, error)

func (*Client) RunAndWait

func (n *Client) RunAndWait(ctx context.Context, job api.Job) error

func (*Client) Stop

func (n *Client) Stop(ctx context.Context, jobID string, purge bool) (bool, error)

type ConnectionError

type ConnectionError struct {
	Err error
}

func (*ConnectionError) Error

func (ce *ConnectionError) Error() string

type FrameReader

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

FrameReader is used to convert a stream of frames into a read closer.

func NewFrameReader

func NewFrameReader(frames <-chan *StreamFrame, errCh <-chan error, cancelCh chan struct{}) *FrameReader

NewFrameReader takes a channel of frames and returns a FrameReader which implements io.ReadCloser

func (*FrameReader) Close

func (f *FrameReader) Close() error

Close cancels the stream of frames

func (*FrameReader) Read

func (f *FrameReader) Read(p []byte) (n int, err error)

Read reads the data of the incoming frames into the bytes buffer. Returns EOF when there are no more frames.

func (*FrameReader) SetUnblockTime

func (f *FrameReader) SetUnblockTime(d time.Duration)

SetUnblockTime sets the time to unblock and return zero bytes read. If the duration is unset or is zero or less, the read will block until data is read.

type JobRunner

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

func NewJobRunner

func NewJobRunner(c *Client) *JobRunner

func (*JobRunner) RunNodeSets

func (r *JobRunner) RunNodeSets(ctx context.Context, nodeSets []types.NodeSet) ([]api.Job, error)

func (*JobRunner) StartNetwork

func (r *JobRunner) StartNetwork(gCtx context.Context, conf *config.Config, generatedSvcs *types.GeneratedServices) (*types.NetworkJobs, error)

func (*JobRunner) StopJobs

func (r *JobRunner) StopJobs(ctx context.Context, jobIDs []string) error

func (*JobRunner) StopNetwork

func (r *JobRunner) StopNetwork(ctx context.Context, jobs *types.NetworkJobs, nodesOnly bool) error

type StreamFrame

type StreamFrame struct {
	Name string
	*api.StreamFrame
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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