domain

package
v0.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

Domain

The Scoot Scheduler's domain subdirectory provides:

  • domain - scheduler go objects: jobs, tasks and states, and thrift versions of these objects
    • gen-go/sched - generated code from the thrift definitions

Documentation

Overview

Package domain provides definitions for Scoot Jobs and Tasks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenJobId

func GenJobId() gopter.Gen

Randomly generates an Id that is valid for use as a sagaId or taskId

func GopterGenJob

func GopterGenJob() gopter.Gen

Wrapper function Generates a Job of Property Based Tests

func GopterGenJobDef

func GopterGenJobDef() gopter.Gen

Wrappper function that Generates a JobDefinition for Property Based Tests

func ValidateJob

func ValidateJob(job JobDefinition) error

Validate a job, returning an *InvalidJobRequest if invalid.

func ValidateMaxTasks

func ValidateMaxTasks(maxTasks int) error

Types

type Job

type Job struct {
	Id  string
	Def JobDefinition
}

Job is the job Scoot can schedule

func DeserializeJob

func DeserializeJob(input []byte) (*Job, error)

Desrialize a binary slice to a Job, an error is returned if it cannot be deserialized.

func GenJob

func GenJob(id string, numTasks int) Job

Generates a Random Job with the specified Id and number of Tasks

func GenRandomJob

func GenRandomJob(id string, numTasks int, rng *rand.Rand) Job

Generates a Random Job, using the supplied Rand with the specified Id and number of Tasks

func (*Job) Serialize

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

Serialize Job to binary slice, and error is returned if the object cannot be Serialized

type JobDefinition

type JobDefinition struct {
	JobType   string
	Requestor string
	Basis     string
	Tag       string
	Priority  Priority
	Tasks     []TaskDefinition
}

JobDefinition is the definition the client sent us

func GenJobDef

func GenJobDef(numTasks int) JobDefinition

Generates a Random JobDefintion with the specified number of tasks

func GenRandomJobDef

func GenRandomJobDef(numTasks int, rng *rand.Rand) *JobDefinition

Generates a Random Job Definition, using the supplied Rand with the specified number of Tasks

func (*JobDefinition) String

func (jd *JobDefinition) String() string

type OfflineWorkerReq

type OfflineWorkerReq struct {
	ID        string
	Requestor string
}

type Priority

type Priority int
const (
	// Default, queue new runs until any resources are available
	P0 Priority = iota

	// Run asap, ahead of priority=0, consuming nodes as they become available if no nodes are free
	P1

	// Run asap, ahead of priority=1, consuming nodes as they become available if no nodes are free
	P2
)

type ReinstateWorkerReq

type ReinstateWorkerReq struct {
	ID        string
	Requestor string
}

type Status

type Status int

Status for Job & Tasks

const (
	// NotRunning, waiting to be scheduled
	NotStarted Status = iota

	// Currently Scheduled and In Progress Job/Task
	InProgress

	// Successfully Completed Job/Task
	Completed

	// Job was Aborted, Compensating Tasks are being Applied.
	// A RollingBack task has not finished its compensating
	// tasks yet.
	RollingBack

	// Job/Task finished unsuccessfully all compensating actions
	// have been applied.
	RolledBack
)

func (Status) String

func (s Status) String() string

type TaskDefinition

type TaskDefinition struct {
	runner.Command
}

Task is one task to run

func GenRandomTask

func GenRandomTask(rng *rand.Rand, tag string) TaskDefinition

Generates a Random TaskDefinition, using the supplied Rand

func GenTask

func GenTask() TaskDefinition

Generates a Random TaskDefinition

Directories

Path Synopsis
gen-go

Jump to

Keyboard shortcuts

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