nomad

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeploymentStatusRunning  = "running"
	DeploymentStatusCanceled = "cancelled"
	DeploymentStatusSuccess  = "successful"
	AllocationStateDead      = "dead"
	Running                  = "running"
	Dead                     = "dead"
	Pending                  = "pending"
	Terminated               = "terminated"
)

Variables

This section is empty.

Functions

func GetJobPorts added in v0.2.3

func GetJobPorts(job *api.Job) []int64

func IsConnectionErr

func IsConnectionErr(err error) bool

func IsJobTimeoutErr added in v0.3.0

func IsJobTimeoutErr(err error) bool

Types

type Client

type Client struct {
	API *api.Client
}

func NewClient

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

func (*Client) Info added in v0.2.3

func (n *Client) Info(ctx context.Context, jobID string) (*api.Job, error)

func (*Client) JobRunning added in v0.3.0

func (n *Client) JobRunning(ctx context.Context, jobID string) bool

func (*Client) List added in v0.2.3

func (n *Client) List(ctx context.Context) ([]*api.JobListStub, error)

List returns all the jobs wrapped in the slice of the `api.JobListStub` structs

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(ctx context.Context, job *api.Job) (bool, error)

func (*Client) RunAndWait

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

func (*Client) Stop

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

Stop stops a specific job

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 {
	Client *Client
	// contains filtered or unexported fields
}

func NewJobRunner

func NewJobRunner(c *Client, capsuleBinaryPath, logsOutputDir string) (*JobRunner, error)

func (*JobRunner) ListExposedPorts added in v0.2.3

func (r *JobRunner) ListExposedPorts(ctx context.Context) (map[string][]int64, error)

ListExposedPorts returns exposed ports across all nodes

func (*JobRunner) ListExposedPortsPerJob added in v0.2.3

func (r *JobRunner) ListExposedPortsPerJob(ctx context.Context, jobID string) ([]int64, error)

ListExposedPortsPerJob returns exposed ports per node

func (*JobRunner) RunDockerJob added in v0.69.0

func (r *JobRunner) RunDockerJob(ctx context.Context, dc config.DockerConfig) (string, error)

func (*JobRunner) RunExecJob added in v0.69.0

func (r *JobRunner) RunExecJob(ctx context.Context, ec config.ExecConfig) (string, error)

func (*JobRunner) RunNodeSets

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

RunNodeSets returns list of started jobs. When one of the jobs fails during startup it returns jobs that has alredy started before that.

func (*JobRunner) RunRawNomadJobs added in v0.2.0

func (r *JobRunner) RunRawNomadJobs(ctx context.Context, rawJobs []string) ([]types.RawJobWithNomadJob, error)

func (*JobRunner) StartFaucet added in v0.69.0

func (r *JobRunner) StartFaucet(
	ctx context.Context,
	faucetConfig *config.FaucetConfig,
	genFaucet *types.Faucet,
) (string, error)

func (*JobRunner) StartNetwork

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

func (*JobRunner) StartWallet added in v0.69.0

func (r *JobRunner) StartWallet(
	ctx context.Context,
	walletConfig *config.WalletConfig,
	genWallet *types.Wallet,
) (string, error)

func (*JobRunner) StopJobs

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

func (*JobRunner) StopNetwork

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

type JobTimeoutError added in v0.2.3

type JobTimeoutError struct {
	JobID string
}

func (*JobTimeoutError) Error added in v0.2.3

func (ce *JobTimeoutError) Error() string

type StreamFrame

type StreamFrame struct {
	Name string
	*api.StreamFrame
}

type VoidJobRunner added in v0.2.0

type VoidJobRunner struct{}

func NewVoidJobRunner added in v0.2.0

func NewVoidJobRunner() *VoidJobRunner

func (*VoidJobRunner) GetJobPorts added in v0.2.3

func (r *VoidJobRunner) GetJobPorts(job *api.Job) []int64

func (*VoidJobRunner) RunRawNomadJobs added in v0.2.0

func (r *VoidJobRunner) RunRawNomadJobs(ctx context.Context, rawJobs []string) ([]types.RawJobWithNomadJob, error)

func (*VoidJobRunner) StopNetwork added in v0.2.0

func (r *VoidJobRunner) StopNetwork(ctx context.Context, jobs *types.NetworkJobs, nodesOnly bool) ([]string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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