Documentation
¶
Index ¶
- Constants
- Variables
- func IsDatasetSpecErr(err error) bool
- func IsRaceConditionErr(err error) bool
- func IsValidationErr(err error) bool
- func ValidateAbsPath(fl validator.FieldLevel) bool
- type CreateDatasetInput
- type CreateDatasetOutput
- type DI
- type DatasetDetails
- type DeleteDatasetInput
- type DeleteDatasetOutput
- type DeleteJobInput
- type DeleteJobOutput
- type FetchJobLogsInput
- type FetchJobLogsOutput
- type GetDatasetInput
- type GetDatasetOutput
- type JobDetails
- type JobDetailsPhase
- type JobVolume
- type JobVolumeType
- type Kube
- func (k *Kube) CreateDataset(ctx context.Context, in *CreateDatasetInput) (out *CreateDatasetOutput, err error)
- func (k *Kube) DeleteDataset(ctx context.Context, in *DeleteDatasetInput) (out *DeleteDatasetOutput, err error)
- func (k *Kube) DeleteJob(ctx context.Context, in *DeleteJobInput) (out *DeleteJobOutput, err error)
- func (k *Kube) FetchJobLogs(ctx context.Context, in *FetchJobLogsInput) (out *FetchJobLogsOutput, err error)
- func (k *Kube) GetDataset(ctx context.Context, in *GetDatasetInput) (out *GetDatasetOutput, err error)
- func (k *Kube) ListDatasets(ctx context.Context, in *ListDatasetsInput) (out *ListDatasetsOutput, err error)
- func (k *Kube) ListJobs(ctx context.Context, in *ListJobsInput) (out *ListJobsOutput, err error)
- func (k *Kube) RunJob(ctx context.Context, in *RunJobInput) (out *RunJobOutput, err error)
- func (k *Kube) UpdateDataset(ctx context.Context, in *UpdateDatasetInput) (out *UpdateDatasetOutput, err error)
- type ListDatasetItem
- type ListDatasetsInput
- type ListDatasetsOutput
- type ListJobItem
- type ListJobsInput
- type ListJobsOutput
- type Logger
- type RunJobInput
- type RunJobOutput
- type UpdateDatasetInput
- type UpdateDatasetOutput
- type Validator
Constants ¶
const ( //JobVolumeTypeInput determines the volume to be input JobVolumeTypeInput = JobVolumeType("input") //JobVolumeTypeOutput determines the volume to output JobVolumeTypeOutput = JobVolumeType("output") )
Variables ¶
var ErrMinikubeOnly = errors.New("temp DI can only be created on Minikube")
ErrMinikubeOnly is returned when a temp di is created on something thats not minikube
var ( //JobDefaultBackoffLimit determines how often we will retry a pod's job on when its failing JobDefaultBackoffLimit = int32(3) )
Functions ¶
func IsDatasetSpecErr ¶
IsDatasetSpecErr is returned when a invalid input/output spec was given
func IsRaceConditionErr ¶
IsRaceConditionErr is returned when we couldn't retrieve any logs for the job
func IsValidationErr ¶
IsValidationErr asserts for a validation error
func ValidateAbsPath ¶
func ValidateAbsPath(fl validator.FieldLevel) bool
Derived from https://github.com/golang/go/blob/1106512db54fc2736c7a9a67dd553fc9e1fca742/src/path/filepath/path_unix.go#L12
Types ¶
type CreateDatasetInput ¶
type CreateDatasetInput struct {
Name string `validate:"printascii"`
Size uint64
StoreOptions transferstore.StoreOptions `validate:"required"`
ArchiverOptions transferarchiver.ArchiverOptions `validate:"required"`
}
CreateDatasetInput is the input to CreateDataset
type CreateDatasetOutput ¶
type CreateDatasetOutput struct {
Name string
}
CreateDatasetOutput is the output to CreateDataset
type DI ¶
type DI interface {
Kube() kubernetes.Interface
Crd() crd.Interface
Validator() Validator
Logger() Logger
Namespace() string
}
DI provides dependencies for our services
type DatasetDetails ¶
type DatasetDetails struct {
CreatedAt time.Time
Size uint64
InputFor []string
OutputFrom []string
}
DatasetDetails tells us more about the dataset by looking at underlying resources
type DeleteDatasetInput ¶
type DeleteDatasetInput struct {
Name string `validate:"min=1,printascii"`
}
DeleteDatasetInput is the input to DeleteDataset
type DeleteDatasetOutput ¶
type DeleteDatasetOutput struct{}
DeleteDatasetOutput is the output to DeleteDataset
type DeleteJobInput ¶
type DeleteJobInput struct {
Name string `validate:"min=1,printascii"`
}
DeleteJobInput is the input to DeleteJob
type FetchJobLogsInput ¶
type FetchJobLogsInput struct {
Tail int64 `validate:"min=0"`
Name string `validate:"min=1,printascii"`
}
FetchJobLogsInput is the input to FetchJobLogs
type FetchJobLogsOutput ¶
type FetchJobLogsOutput struct {
Data []byte
}
FetchJobLogsOutput is the output to FetchJobLogs
type GetDatasetInput ¶
type GetDatasetInput struct {
Name string `validate:"printascii"`
}
GetDatasetInput is the input to GetDataset
type GetDatasetOutput ¶
type GetDatasetOutput struct {
Name string
Size uint64
InputFor []string
OutputFrom []string
StoreOptions transferstore.StoreOptions
ArchiverOptions transferarchiver.ArchiverOptions
}
GetDatasetOutput is the output to GetDataset
func GetDatasetOutputFromSpec ¶
func GetDatasetOutputFromSpec(dataset *datasetsv1.Dataset) *GetDatasetOutput
GetDatasetOutputFromSpec allows easy output creation from dataset
type JobDetails ¶
type JobDetails struct {
SeenAt time.Time
Phase JobDetailsPhase
Scheduled bool //indicate if the pod was scheduled
Parallelism int32 //job width, if 0 this means it was stopped
WaitingReason string //why the job -> pod -> container is waiting
WaitingMessage string //explains why we're waiting
TerminatedReason string //termination of main container
TerminatedMessage string //explains why its terminated
UnschedulableReason string //when scheduling condition is false
UnschedulableMessage string
}
JobDetails tells us more about the job by looking at underlying resources
type JobDetailsPhase ¶
type JobDetailsPhase string
JobDetailsPhase is a high level description of the underlying pod
var ( // JobDetailsPhasePending means the pod has been accepted by the system, but one or more of the containers // has not been started. This includes time before being bound to a node, as well as time spent // pulling images onto the host. JobDetailsPhasePending JobDetailsPhase = "Pending" // JobDetailsPhaseRunning means the pod has been bound to a node and all of the containers have been started. // At least one container is still running or is in the process of being restarted. JobDetailsPhaseRunning JobDetailsPhase = "Running" // JobDetailsPhaseSucceeded means that all containers in the pod have voluntarily terminated // with a container exit code of 0, and the system is not going to restart any of these containers. JobDetailsPhaseSucceeded JobDetailsPhase = "Succeeded" // JobDetailsPhaseFailed means that all containers in the pod have terminated, and at least one container has // terminated in a failure (exited with a non-zero exit code or was stopped by the system). JobDetailsPhaseFailed JobDetailsPhase = "Failed" // JobDetailsPhaseUnknown means that for some reason the state of the pod could not be obtained, typically due // to an error in communicating with the host of the pod. JobDetailsPhaseUnknown JobDetailsPhase = "Unknown" )
type JobVolume ¶
type JobVolume struct {
MountPath string `validate:"is-abs-path"`
InputDataset string
OutputDataset string
}
JobVolume can be used in a job
type JobVolumeType ¶
type JobVolumeType string
JobVolumeType determines if its content will be uploaded or downloaded
type Kube ¶
type Kube struct {
// contains filtered or unexported fields
}
Kube interacts with the kubernetes backend
func (*Kube) CreateDataset ¶
func (k *Kube) CreateDataset(ctx context.Context, in *CreateDatasetInput) (out *CreateDatasetOutput, err error)
CreateDataset will create a dataset on kubernetes
func (*Kube) DeleteDataset ¶
func (k *Kube) DeleteDataset(ctx context.Context, in *DeleteDatasetInput) (out *DeleteDatasetOutput, err error)
DeleteDataset will create a dataset on kubernetes
func (*Kube) DeleteJob ¶
func (k *Kube) DeleteJob(ctx context.Context, in *DeleteJobInput) (out *DeleteJobOutput, err error)
DeleteJob will create a job on kubernetes
func (*Kube) FetchJobLogs ¶
func (k *Kube) FetchJobLogs(ctx context.Context, in *FetchJobLogsInput) (out *FetchJobLogsOutput, err error)
FetchJobLogs will create a job on kubernetes
func (*Kube) GetDataset ¶
func (k *Kube) GetDataset(ctx context.Context, in *GetDatasetInput) (out *GetDatasetOutput, err error)
GetDataset will create a dataset on kubernetes
func (*Kube) ListDatasets ¶
func (k *Kube) ListDatasets(ctx context.Context, in *ListDatasetsInput) (out *ListDatasetsOutput, err error)
ListDatasets will create a dataset on kubernetes
func (*Kube) ListJobs ¶
func (k *Kube) ListJobs(ctx context.Context, in *ListJobsInput) (out *ListJobsOutput, err error)
ListJobs will list jobs on kubernetes
func (*Kube) RunJob ¶
func (k *Kube) RunJob(ctx context.Context, in *RunJobInput) (out *RunJobOutput, err error)
RunJob will create a job on kubernetes
func (*Kube) UpdateDataset ¶
func (k *Kube) UpdateDataset(ctx context.Context, in *UpdateDatasetInput) (out *UpdateDatasetOutput, err error)
UpdateDataset will update a dataset resource. Fields that can be updated: name, input, output and size. Input and output are the jobs the dataset is used for or coming from.
type ListDatasetItem ¶
type ListDatasetItem struct {
Name string
Details DatasetDetails
}
ListDatasetItem is a dataset listing item
type ListDatasetsInput ¶
type ListDatasetsInput struct{}
ListDatasetsInput is the input to ListDatasets
type ListDatasetsOutput ¶
type ListDatasetsOutput struct {
Items []*ListDatasetItem
}
ListDatasetsOutput is the output to ListDatasets
type ListJobItem ¶
type ListJobItem struct {
Name string
Image string
Input []string
Output []string
Memory string
VCPU string
CreatedAt time.Time
DeletedAt time.Time
ActiveAt time.Time
CompletedAt time.Time
FailedAt time.Time
Details JobDetails
}
ListJobItem is a job listing item
type ListJobsOutput ¶
type ListJobsOutput struct {
Items []*ListJobItem
}
ListJobsOutput is the output to ListJobs
type Logger ¶
type Logger interface {
Debugf(format string, args ...interface{})
}
Logger describes the logging dependency the services require
type RunJobInput ¶
type RunJobInput struct {
Image string `validate:"min=1"`
Name string `validate:"printascii"`
Env map[string]string
BackoffLimit *int32
Args []string
Volumes []JobVolume
Memory string
VCPU string
}
RunJobInput is the input to RunJob
type UpdateDatasetInput ¶
type UpdateDatasetInput struct {
Name string `validate:"printascii"`
NewName string `validate:"printascii"`
Size *uint64
InputFor string
OutputFrom string
}
UpdateDatasetInput is the input for UpdateDataset
type UpdateDatasetOutput ¶
type UpdateDatasetOutput struct {
Name string
}
UpdateDatasetOutput is the output for UpdateDataset