types

package
v0.0.0-...-33a8802 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DatasetUpload is a data set that has been uploaded to the system.
	DatasetUpload = "upload"

	// DatasetLocal is a data set that resides on a file system that is local to the easeml service.
	DatasetLocal = "local"

	// DatasetDownload is a data set that has been downloaded from a remote location.
	DatasetDownload = "download"

	// DatasetGit is a data set that has been fetched from a git repository
	DatasetGit = "git"

	// DatasetCreated is the status of a dataset when it is recorded in the system but the data is not yet transferred.
	DatasetCreated = "created"

	// DatasetTransferred is the status of a dataset when it is transferred but hasn't been unpacked yet.
	DatasetTransferred = "transferred"

	// DatasetUnpacked is the status of a dataset when all its files have been extracted and is ready for validation.
	DatasetUnpacked = "unpacked"

	// DatasetValidated is the status of a dataset when it has been validated and is ready to be used.
	DatasetValidated = "validated"

	// DatasetArchived is the status of a dataset when it is no longer usable.
	DatasetArchived = "archived"

	// DatasetError is the status of a dataset when something goes wrong. The details will be logged.
	DatasetError = "error"
)
View Source
const (
	// JobScheduled is a job that is scheduled but not running yet.
	JobScheduled = "scheduled"

	// JobRunning is a job that is picked up by the scheduler and started running.
	JobRunning = "running"

	// JobPausing is a job that is in a pausing state. All its tasks are being paused.
	JobPausing = "pausing"

	// JobPaused is a job that is paused but may be resumed.
	JobPaused = "paused"

	// JobResuming is a job that is leaving the paused state. All its paused tasks are being resumed.
	JobResuming = "resuming"

	// JobCompleted is a job that has been completed.
	JobCompleted = "completed"

	// JobTerminating is a job that is in a terminating state. All its tasks are being terminated.
	JobTerminating = "terminating"

	// JobTerminated is a job that was terminated before completion.
	JobTerminated = "terminated"

	// JobError is a job that is in an error state. The error information is logged.
	JobError = "error"

	// DefaultMaxTasks is the default number of tasks per job.
	DefaultMaxTasks = 100
)
View Source
const (
	// ModuleModel is the module type that represent machine learning models.
	ModuleModel = "model"

	// ModuleObjective is the module type that represents objective functions.
	ModuleObjective = "objective"

	// ModuleOptimizer is the module type representing optimizers.
	ModuleOptimizer = "optimizer"

	// ModuleUpload is a module that has veen uploaded to the system.
	ModuleUpload = "upload"

	// ModuleDownload is a module that has been downloaded from a remote location.
	ModuleDownload = "download"

	// ModuleLocal is a module that resides on a file system that is local to the easeml service.
	ModuleLocal = "local"

	// ModuleRegistry is a module that is obtained from a Docker registry.
	ModuleRegistry = "registry"

	// ModuleCreated is the status of a module that is recorded in the system but not yet transferred.
	ModuleCreated = "created"

	// ModuleTransferred is the status of a module that is transferred but not yet validated.
	ModuleTransferred = "transferred"

	// ModuleActive is the status of a module that is transferred and ready to use.
	ModuleActive = "active"

	// ModuleArchived is the status of a module that is no longer usable.
	ModuleArchived = "archived"

	// ModuleError is the status of a mofule when something goes wrong. The details will be logged.
	ModuleError = "error"
)
View Source
const (
	// ProcController is the type of process that serves as the interface between
	// the users and the data model, as well as controlling the operation of the system.
	ProcController = "controller"

	// ProcWorker is the type of process that trains models and evaluates them.
	ProcWorker = "worker"

	// ProcScheduler is the type of process that handles scheduling of tasks.
	ProcScheduler = "scheduler"

	// ProcIdle is the status of the process when it is running but not doing any work.
	ProcIdle = "idle"

	// ProcWorking is the status of the process when it is running and doing work.
	ProcWorking = "working"

	// ProcTerminated is the status of the process that is not running anymore.
	ProcTerminated = "terminated"
)
View Source
const (
	// TaskScheduled is a task that is scheduled but not running yet.
	TaskScheduled = "scheduled"

	// TaskRunning is a task that is picked up by the worker and started running.
	TaskRunning = "running"

	// TaskPausing is a task that is in a pausing state. It will be paused when the current stage ends.
	TaskPausing = "pausing"

	// TaskPaused is a task that is paused but may be resumed.
	TaskPaused = "paused"

	// TaskCompleted is a task that has been completed.
	TaskCompleted = "completed"

	// TaskTerminating is a task that is in a terminating state. It will be terminated when the current stage ends.
	TaskTerminating = "terminating"

	// TaskTerminated is a task that was terminated before completion.
	TaskTerminated = "terminated"

	// TaskCanceled is a task that was scheduled but the job was completed before the task got to be executed.
	TaskCanceled = "canceled"

	// TaskError is a task that is in an error state. The error information is logged.
	TaskError = "error"

	// TaskStageBegin is the stage before any other.
	TaskStageBegin = "begin"

	// TaskStageTraining is the stage when a model is being trained.
	TaskStageTraining = "training"

	// TaskStagePredicting is the stage when predictions are made.
	TaskStagePredicting = "predicting"

	// TaskStageEvaluating is the stage when the evaluation takes place.
	TaskStageEvaluating = "evaluating"

	// TaskStageEnd is entered when all stages complete.
	TaskStageEnd = "end"
)
View Source
const (
	// UserRoot is the name of the root user. This user has no password, cannot log in or
	// log out and can only be authenticated with an API key.
	UserRoot = "root"

	// UserAnon is the user id assigned to unauthenticated users.
	UserAnon = "anonymous"

	// UserThis is the user id of the currently logged in user.
	UserThis = "this"
)

Variables

View Source
var (
	// ErrWrongCredentials is returned when the wrong username or password are provided.
	ErrWrongCredentials = e.New("wrong username or password provided")

	// ErrWrongAPIKey is returned when the wrong API key is provided.
	ErrWrongAPIKey = e.New("wrong API key provided")

	// ErrNotPermitedForRoot is returned for actions that are not permitted to root users.
	ErrNotPermitedForRoot = e.New("this action is not permitted for the root user")

	// ErrNotPermitedForAnon is returned for actions that are not permitted to root users.
	ErrNotPermitedForAnon = e.New("this action is not permitted for anonimous users")

	// ErrUnauthorized is returned when a user tries to perform a forbidden action.
	ErrUnauthorized = e.New("this action is not permitted for the given user")

	// ErrIdentifierTaken is returned when we attempt to insert an item with an identifier that already exists.
	ErrIdentifierTaken = e.New("the specified identifier is already taken")
)

Functions

This section is empty.

Types

type CollectionMetadata

type CollectionMetadata struct {

	// The total size of the result after applying query filters but before pagination.
	TotalResultSize int `json:"total-result-size"`

	// The size of the current page of results that is being returned.
	ReturnedResultSize int `json:"returned-result-size"`

	// The string to pass as a cursor to obtain the next page of results.
	NextPageCursor string `json:"next-page-cursor"`
}

CollectionMetadata contains additional information about a query that returns arrays as results. This information aids the caller with navigating the partial results.

type ConfigCache

type ConfigCache struct {
	Model      string                        `bson:"model" json:"model"`
	Config     string                        `bson:"config" json:"config"`
	AvgQuality float64                       `bson:"avg-quality" json:"avg-quality"`
	Quality    map[string]map[string]float64 `bson:"quality" json:"quality"`
}

ConfigCache is a structure that holds all measurements obtained for a certain model and its configuration.

func (ConfigCache) Distance

func (c1 ConfigCache) Distance(c2 ConfigCache) float64

Distance measures the distance between two config points by comparing their training history.

type Dataset

type Dataset struct {
	ObjectID      bson.ObjectId `bson:"_id"`
	ID            string        `bson:"id" json:"id"`
	User          string        `bson:"user" json:"user"`
	Name          string        `bson:"name" json:"name"`
	Description   string        `bson:"description" json:"description"`
	SchemaIn      string        `bson:"schema-in" json:"schema-in"`
	SchemaOut     string        `bson:"schema-out" json:"schema-out"`
	Source        string        `bson:"source" json:"source"`
	SourceAddress string        `bson:"source-address" json:"source-address"`
	CreationTime  time.Time     `bson:"creation-time" json:"creation-time"`
	Status        string        `bson:"status" json:"status"`
	StatusMessage string        `bson:"status-message" json:"status-message"`
	Process       bson.ObjectId `bson:"process,omitempty" json:"process"`
	AccessKey     string        `bson:"access-key,omitempty" json:"access-key"`
}

Dataset contains information about datasets.

type Job

type Job struct {
	ID                bson.ObjectId `bson:"_id" json:"id"`
	User              string        `bson:"user" json:"user"`
	Dataset           string        `bson:"dataset" json:"dataset"`
	Models            []string      `bson:"models" json:"models"`
	ConfigSpace       string        `bson:"config-space" json:"config-space"`
	AcceptNewModels   bool          `bson:"accept-new-models" json:"accept-new-models"`
	Objective         string        `bson:"objective" json:"objective"`
	AltObjectives     []string      `bson:"alt-objectives" json:"alt-objectives"`
	MaxTasks          uint64        `bson:"max-tasks" json:"max-tasks"`
	CreationTime      time.Time     `bson:"creation-time" json:"creation-time"`
	RunningTime       TimeInterval  `bson:"running-time" json:"running-time"`
	RunningDuration   uint64        `bson:"running-duration,omitempty" json:"running-duration"`
	PauseStartTime    time.Time     `bson:"pause-start-time"`
	PauseDuration     uint64        `bson:"pause-duration,omitempty" json:"pause-duration"`
	PrevPauseDuration uint64        `bson:"prev-pause-duration"`
	Status            string        `bson:"status" json:"status"`
	StatusMessage     string        `bson:"status-message" json:"status-message"`
	Process           bson.ObjectId `bson:"process,omitempty" json:"process"`
}

Job contains information about jobs.

func (Job) GetPauseDuration

func (job Job) GetPauseDuration() uint64

GetPauseDuration computes the total time that the job has spent in the paused state.

func (Job) GetRunningDuration

func (job Job) GetRunningDuration() uint64

GetRunningDuration computes the total time the job has spent running (including pauses).

func (Job) IsEnded

func (job Job) IsEnded() bool

IsEnded returns true when the job has either completed, terminated or is in an error state.

func (Job) IsPaused

func (job Job) IsPaused() bool

IsPaused returns true when the job is in the paused state.

func (Job) IsStarted

func (job Job) IsStarted() bool

IsStarted returns true when the job has passed the "scheduled" state.

type Module

type Module struct {
	ObjectID      bson.ObjectId `bson:"_id"`
	ID            string        `bson:"id" json:"id"`
	User          string        `bson:"user" json:"user"`
	Type          string        `bson:"type" json:"type"`
	Label         string        `bson:"label" json:"label"`
	Name          string        `bson:"name" json:"name"`
	Description   string        `bson:"description" json:"description"`
	SchemaIn      string        `bson:"schema-in" json:"schema-in"`
	SchemaOut     string        `bson:"schema-out" json:"schema-out"`
	ConfigSpace   string        `bson:"config-space" json:"config-space"`
	Source        string        `bson:"source" json:"source"`
	SourceAddress string        `bson:"source-address" json:"source-address"`
	CreationTime  time.Time     `bson:"creation-time" json:"creation-time"`
	Status        string        `bson:"status" json:"status"`
	StatusMessage string        `bson:"status-message" json:"status-message"`
	Process       bson.ObjectId `bson:"process,omitempty" json:"process"`
}

Module contains information about modules which are stateless Docker images.

type Process

type Process struct {
	ID            bson.ObjectId `bson:"_id" json:"id"`
	ProcessID     uint64        `bson:"process-id" json:"process-id"`
	HostID        string        `bson:"host-id" json:"host-id"`
	HostAddress   string        `bson:"host-address" json:"host-address"`
	StartTime     time.Time     `bson:"start-time" json:"start-time"`
	LastKeepalive time.Time     `bson:"last-keepalive" json:"last-keepalive"`
	Type          string        `bson:"type" json:"type"`
	Resource      string        `bson:"resource" json:"resource"`
	Status        string        `bson:"status" json:"status"`
	RunningOrinal int           `bson:"running-ordinal" json:"running-ordinal"`
}

Process contains information about processes.

type Task

type Task struct {
	ObjectID        bson.ObjectId      `bson:"_id"`
	ID              string             `bson:"id" json:"id"`
	Job             bson.ObjectId      `bson:"job" json:"job"`
	Process         bson.ObjectId      `bson:"process,omitempty" json:"process"`
	User            string             `bson:"user" json:"user"`
	Dataset         string             `bson:"dataset" json:"dataset"`
	Model           string             `bson:"model" json:"model"`
	Objective       string             `bson:"objective" json:"objective"`
	AltObjectives   []string           `bson:"alt-objectives" json:"alt-objectives"`
	Config          string             `bson:"config" json:"config"`
	Quality         float64            `bson:"quality" json:"quality"`
	QualityTrain    float64            `bson:"quality-train" json:"quality-train"`
	QualityExpected float64            `bson:"quality-expected" json:"quality-expected"`
	AltQualities    []float64          `bson:"alt-qualities" json:"alt-qualities"`
	Status          string             `bson:"status" json:"status"`
	StatusMessage   string             `bson:"status-message" json:"status-message"`
	Stage           string             `bson:"stage" json:"stage"`
	StageTimes      TaskStageIntervals `bson:"stage-times" json:"stage-times"`
	StageDurations  TaskStageDurations `bson:"stage-durations,omitempty" json:"stage-durations"`
	CreationTime    time.Time          `bson:"creation-time" json:"creation-time"`
	RunningDuration uint64             `bson:"running-duration,omitempty" json:"running-duration"`
}

Task contains information about tasks.

func (Task) GetRunningDuration

func (task Task) GetRunningDuration() uint64

GetRunningDuration computes the total running duration of all tasks as a sum of training, predicting and evaluating durations.

func (Task) GetStageDurations

func (task Task) GetStageDurations() (d TaskStageDurations)

GetStageDurations returns durations of all completed stages in milliseconds. Incompleted stages are left with a zero duration.

func (Task) IsEnded

func (task Task) IsEnded() bool

IsEnded returns true when the task has either completed, terminated or is in an error state.

func (Task) IsPaused

func (task Task) IsPaused() bool

IsPaused returns true when the task is in the paused state.

func (Task) IsStarted

func (task Task) IsStarted() bool

IsStarted returns true when the task has passed the "scheduled" state.

type TaskStageDurations

type TaskStageDurations struct {
	Training   uint64 `bson:"training" json:"training"`
	Predicting uint64 `bson:"predicting" json:"predicting"`
	Evaluating uint64 `bson:"evaluating" json:"evaluating"`
}

TaskStageDurations contains information about the length of all task stages in milliseconds.

type TaskStageIntervals

type TaskStageIntervals struct {
	Training   TimeInterval `bson:"training" json:"training"`
	Predicting TimeInterval `bson:"predicting" json:"predicting"`
	Evaluating TimeInterval `bson:"evaluating" json:"evaluating"`
}

TaskStageIntervals contains information about start and end times of various task stages.

type TimeInterval

type TimeInterval struct {
	Start time.Time `bson:"start" json:"start"`
	End   time.Time `bson:"end" json:"end"`
}

TimeInterval represents a time interval with specific start and end times.

type User

type User struct {
	ObjectID     bson.ObjectId `bson:"_id"`
	ID           string        `bson:"id" json:"id"`
	Name         string        `bson:"name" json:"name"`
	Status       string        `bson:"status" json:"status"`
	PasswordHash string        `bson:"password-hash" json:"password,omitempty"`
	APIKey       string        `bson:"api-key" json:"-"`
}

User contains information about users.

func GetAnonUser

func GetAnonUser() User

GetAnonUser returns an anonymous user instance.

func (User) IsAnon

func (user User) IsAnon() bool

IsAnon returns true if the given user is the anonymous user.

func (User) IsRoot

func (user User) IsRoot() bool

IsRoot returns true if the given user is the root user.

Jump to

Keyboard shortcuts

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