job

package
v0.0.0-...-31bcc22 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//StatusFail when job fails
	StatusFail = "FAIL"
	//StatusPending when job has been validated, but DS has not been created
	StatusPending = "PENDING"
	//StatusDeploying when job related resources are being deployed. Used as internal lock
	StatusDeploying = "DEPLOYING"
	//StatusDeployed when job related resources have been created in the desired namespace
	StatusDeployed = "DEPLOYED"
	//StatusMap when job is in map phase
	StatusMap = "MAP"
	//StatusReduce when job is in reduce phase
	StatusReduce = "REDUCE"
	//StatusComplete when job has been processed successfully
	StatusComplete = "COMPLETE"
	//StatusProgress when job is in progress
	StatusProgress = "PROGRESS"
)

Variables

This section is empty.

Functions

func Init

func Init()

Init adds log filename hook

Types

type Client

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

Client uses a jobs http API

func NewClient

func NewClient(baseurl string) *Client

NewClient creates new job client

func (*Client) GetJob

func (cl *Client) GetJob() (*MapReduceJob, error)

GetJob gets the job at this baseurl

func (*Client) PutMap

func (cl *Client) PutMap(task MapTask, taskid int) (bool, error)

PutMap puts MapTask

func (*Client) PutReduce

func (cl *Client) PutReduce(task ReduceTask, taskid int) (bool, error)

PutReduce puts ReduceTask

type Config

type Config struct {
	//one of https://godoc.org/gopkg.in/amz.v1/aws#pkg-variables ap-northeast-1, ap-southeast-1, etc...
	S3Region     string //The S3 region we wanna use for temporary stuff
	S3Endpoint   string //overrides region
	BucketName   string //A pre-existing bucket
	BucketPrefix string //Prepended to all keys, to reduce clutter in bucket root
	JobURL       string //The URL for job
}

Config holds values required for workers for kubemr internal things Not passed to user code

func NewConfigEnv

func NewConfigEnv() *Config

NewConfigEnv populates Config struct from env

func (*Config) Map

func (config *Config) Map() map[string]string

Map converts config to data item for configmap

func (*Config) Validate

func (config *Config) Validate() error

Validate validates the config

type MapReduceJob

type MapReduceJob struct {
	*sync.RWMutex
	Name      string             `json:"name"`      //Name generated by system
	Namespace string             `json:"namespace"` //Name generated by system
	Status    string             `json:"status"`    //Status of the job
	Err       string             `json:"error"`     //Errors, if any
	Maps      map[int]MapTask    `json:"maps"`
	Reduces   map[int]ReduceTask `json:"reduces"`
	Results   []string           `json:"results"`
	Replicas  *int32             `json:"replicas"` //Number of workers to run in parallel
	Inputs    []string           `json:"inputs"`   //List of initial inputs for the map phase
	//UserSecretName string              `json:"usersecretname"` //Optional: Name of secret in job's namespace to be available to worker
	Template v1.PodTemplateSpec `json:"template"` //Pod template for the job
	// contains filtered or unexported fields
}

MapReduceJob defines TPR object for a map-reduce job

func (*MapReduceJob) Init

func (jb *MapReduceJob) Init(cl kubernetes.Interface, addr, myip string, cfg *Config) error

Init initializes the job, setting sane defaults

func (*MapReduceJob) Start

func (jb *MapReduceJob) Start(timeout time.Duration) error

Start deploys the job and starts the server

type MapTask

type MapTask struct {
	Worker  string         `json:"worker"`  //Hostname, used for locking
	Input   string         `json:"input"`   //One input per map
	Outputs map[int]string `json:"outputs"` //Multiple possible outputs
	Err     string         `json:"error"`
	Status  string         `json:"status"`
}

MapTask holds the values for individual map task

type ReduceTask

type ReduceTask struct {
	Worker string   `json:"worker"` //Hostname, used for locking
	Inputs []string `json:"inputs"` //Multiple possible inputs for a reduce job
	Output string   `json:"output"` //Single output from reduce
	Err    string   `json:"error"`
	Status string   `json:"status"`
}

ReduceTask holds the values for individual map task

type Result

type Result string

Result describes the final result to be consumed by the user

Jump to

Keyboard shortcuts

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