nomad

package
v0.5.0-rc9 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package nomad is an interface to nomad for retrieving tasks and launching parameterized jobs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*api.Client
}

A Client is a wrapper around a nomad API client which allows much more convenient methods to be built on top of it to provide information to the caller and simplify task dispatch.

func New

func New() (*Client, error)

New returns a new nomad client initialized with parameters from the environment.

func (*Client) Dispatch

func (c *Client) Dispatch(name string, kv map[string]string) error

Dispatch can be used to dispatch a parameterized task.

func (*Client) ListNamespaces

func (c *Client) ListNamespaces() ([]string, error)

ListNamespaces returns a list of namespaces in the given cluster.

func (*Client) ListTasks

func (c *Client) ListTasks(cfg QueryOpts) ([]Task, error)

ListTasks crawls nomad for running tasks. This can include batch tasks, service tasks, system tasks, and any other kind of task as long as it is running.

type QueryOpts

type QueryOpts struct {
	Region    string
	Namespace string
	Prefix    string
}

QueryOpts shadows the nomad type of the same name.

type Task

type Task struct {
	Namespace string
	Job       string
	Group     string
	Name      string
	Driver    string
	URL       string
	Meta      map[string]string
	Docker    docker.Image
}

Task represents a simplified view of a nomad task.

func (Task) Path

func (t Task) Path() string

Path returns a path like string representation of where the task lives in the hierarchy.

Jump to

Keyboard shortcuts

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