model

package
v1.7.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 7

Documentation

Index

Constants

View Source
const (
	RunTerminatingConditions string = "Terminating"
)

Variables

This section is empty.

Functions

func GetExperimentTablePrimaryKeyColumn

func GetExperimentTablePrimaryKeyColumn() string

func GetJobTablePrimaryKeyColumn

func GetJobTablePrimaryKeyColumn() string

func GetNamespaceFromModelResourceReferences

func GetNamespaceFromModelResourceReferences(resourceRefs []*ResourceReference) string

func GetPipelineTablePrimaryKeyColumn

func GetPipelineTablePrimaryKeyColumn() string

func GetRunTablePrimaryKeyColumn

func GetRunTablePrimaryKeyColumn() string

Types

type CronSchedule

type CronSchedule struct {
	// Time at which scheduling starts.
	// If no start time is specified, the StartTime is the creation time of the schedule.
	CronScheduleStartTimeInSec *int64 `gorm:"column:CronScheduleStartTimeInSec;"`

	// Time at which scheduling ends.
	// If no end time is specified, the EndTime is the end of time.
	CronScheduleEndTimeInSec *int64 `gorm:"column:CronScheduleEndTimeInSec;"`

	// Cron string describing when a workflow should be created within the
	// time interval defined by StartTime and EndTime.
	Cron *string `gorm:"column:Schedule;"`
}

type DBStatus

type DBStatus struct {
	HaveSamplesLoaded bool `gorm:"column:HaveSamplesLoaded; not null"`
}

type DefaultExperiment

type DefaultExperiment struct {
	DefaultExperimentId string `gorm:"column:DefaultExperimentId; not null"`
}

type Experiment

type Experiment struct {
	UUID           string `gorm:"column:UUID; not null; primary_key"`
	Name           string `gorm:"column:Name; not null; unique_index:idx_name_namespace"`
	Description    string `gorm:"column:Description; not null"`
	CreatedAtInSec int64  `gorm:"column:CreatedAtInSec; not null"`
	Namespace      string `gorm:"column:Namespace; not null; unique_index:idx_name_namespace"`
	StorageState   string `gorm:"column:StorageState; not null;"`
}

func (*Experiment) APIToModelFieldMap

func (e *Experiment) APIToModelFieldMap() map[string]string

APIToModelFieldMap returns a map from API names to field names for model Experiment.

func (*Experiment) DefaultSortField

func (e *Experiment) DefaultSortField() string

DefaultSortField returns the default sorting field for model Experiment.

func (*Experiment) GetField

func (e *Experiment) GetField(name string) (string, bool)

func (*Experiment) GetFieldValue

func (e *Experiment) GetFieldValue(name string) interface{}

func (*Experiment) GetKeyFieldPrefix

func (e *Experiment) GetKeyFieldPrefix() string

func (*Experiment) GetModelName

func (e *Experiment) GetModelName() string

GetModelName returns table name used as sort field prefix

func (*Experiment) GetSortByFieldPrefix

func (e *Experiment) GetSortByFieldPrefix(name string) string

func (Experiment) GetValueOfPrimaryKey

func (e Experiment) GetValueOfPrimaryKey() string

func (*Experiment) PrimaryKeyColumnName

func (e *Experiment) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key for model Experiment.

type Job

type Job struct {
	UUID               string `gorm:"column:UUID; not null; primary_key"`
	DisplayName        string `gorm:"column:DisplayName; not null;"` /* The name that user provides. Can contain special characters*/
	Name               string `gorm:"column:Name; not null;"`        /* The name of the K8s resource. Follow regex '[a-z0-9]([-a-z0-9]*[a-z0-9])?'*/
	Namespace          string `gorm:"column:Namespace; not null;"`
	ServiceAccount     string `gorm:"column:ServiceAccount; not null;"`
	Description        string `gorm:"column:Description; not null"`
	MaxConcurrency     int64  `gorm:"column:MaxConcurrency;not null"`
	NoCatchup          bool   `gorm:"column:NoCatchup; not null"`
	CreatedAtInSec     int64  `gorm:"column:CreatedAtInSec; not null"` /* The time this record is stored in DB*/
	UpdatedAtInSec     int64  `gorm:"column:UpdatedAtInSec; not null"`
	Enabled            bool   `gorm:"column:Enabled; not null"`
	ResourceReferences []*ResourceReference
	Trigger
	PipelineSpec
	Conditions string `gorm:"column:Conditions; not null"`
}

func (*Job) APIToModelFieldMap

func (k *Job) APIToModelFieldMap() map[string]string

APIToModelFieldMap returns a map from API names to field names for model Job.

func (*Job) DefaultSortField

func (j *Job) DefaultSortField() string

DefaultSortField returns the default sorting field for model Job.

func (*Job) GetField

func (j *Job) GetField(name string) (string, bool)

func (*Job) GetFieldValue

func (j *Job) GetFieldValue(name string) interface{}

func (*Job) GetKeyFieldPrefix

func (j *Job) GetKeyFieldPrefix() string

func (*Job) GetModelName

func (j *Job) GetModelName() string

GetModelName returns table name used as sort field prefix

func (*Job) GetSortByFieldPrefix

func (j *Job) GetSortByFieldPrefix(name string) string

func (Job) GetValueOfPrimaryKey

func (j Job) GetValueOfPrimaryKey() string

func (*Job) PrimaryKeyColumnName

func (j *Job) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key for model Job.

type ListableDataModel

type ListableDataModel interface {
	// Get the value of the key field.
	GetValueOfPrimaryKey() string
}

The data model that supports List APIs.

type PeriodicSchedule

type PeriodicSchedule struct {
	// Time at which scheduling starts.
	// If no start time is specified, the StartTime is the creation time of the schedule.
	PeriodicScheduleStartTimeInSec *int64 `gorm:"column:PeriodicScheduleStartTimeInSec;"`

	// Time at which scheduling ends.
	// If no end time is specified, the EndTime is the end of time.
	PeriodicScheduleEndTimeInSec *int64 `gorm:"column:PeriodicScheduleEndTimeInSec;"`

	// Interval describing when a workflow should be created within the
	// time interval defined by StartTime and EndTime.
	IntervalSecond *int64 `gorm:"column:IntervalSecond;"`
}

type Pipeline

type Pipeline struct {
	UUID           string `gorm:"column:UUID; not null; primary_key"`
	CreatedAtInSec int64  `gorm:"column:CreatedAtInSec; not null"`
	Name           string `gorm:"column:Name; not null"`
	Description    string `gorm:"column:Description; not null; size:65535"` // Same as below, set size to large number so it will be stored as longtext
	// TODO(jingzhang36): remove Parameters when no code is accessing this
	// field. Should use PipelineVersion.Parameters instead.
	/* Set size to 65535 so it will be stored as longtext. https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html */
	Parameters string         `gorm:"column:Parameters; not null; size:65535"`
	Status     PipelineStatus `gorm:"column:Status; not null"`
	// Default version of this pipeline. It could be null.
	DefaultVersionId string           `gorm:"column:DefaultVersionId;"`
	DefaultVersion   *PipelineVersion `gorm:"-"`
	Namespace        string           `gorm:"column:Namespace; size:63; default:''"`
}

func (*Pipeline) APIToModelFieldMap

func (p *Pipeline) APIToModelFieldMap() map[string]string

APIToModelFieldMap returns a map from API names to field names for model Pipeline.

func (*Pipeline) DefaultSortField

func (p *Pipeline) DefaultSortField() string

DefaultSortField returns the default sorting field for model Pipeline.

func (*Pipeline) GetField

func (p *Pipeline) GetField(name string) (string, bool)

func (*Pipeline) GetFieldValue

func (p *Pipeline) GetFieldValue(name string) interface{}

func (*Pipeline) GetKeyFieldPrefix

func (p *Pipeline) GetKeyFieldPrefix() string

func (*Pipeline) GetModelName

func (p *Pipeline) GetModelName() string

GetModelName returns table name used as sort field prefix

func (*Pipeline) GetSortByFieldPrefix

func (p *Pipeline) GetSortByFieldPrefix(name string) string

func (Pipeline) GetValueOfPrimaryKey

func (p Pipeline) GetValueOfPrimaryKey() string

func (*Pipeline) PrimaryKeyColumnName

func (p *Pipeline) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key for model Pipeline.

type PipelineRuntime

type PipelineRuntime struct {
	PipelineRuntimeManifest string `gorm:"column:PipelineRuntimeManifest; not null; size:65535"`
	/* Argo CRD. Set size to 65535 so it will be stored as longtext. https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html */
	WorkflowRuntimeManifest string `gorm:"column:WorkflowRuntimeManifest; not null; size:65535"`
}

type PipelineSpec

type PipelineSpec struct {
	// Pipeline ID will be optional. It's available only if the resource is created through
	// a pipeline ID.
	PipelineId string `gorm:"column:PipelineId; not null"`

	// Pipeline Name will be required if ID is not empty.
	PipelineName string `gorm:"column:PipelineName; not null"`

	// Pipeline YAML definition. This is the pipeline interface for creating a pipeline.
	// Set size to 65535 so it will be stored as longtext.
	// https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html
	PipelineSpecManifest string `gorm:"column:PipelineSpecManifest; size:65535"`

	// Argo workflow YAML definition. This is the Argo Spec converted from Pipeline YAML.
	WorkflowSpecManifest string `gorm:"column:WorkflowSpecManifest; not null; size:65535"`

	// Store parameters key-value pairs as serialized string.
	Parameters string `gorm:"column:Parameters; size:65535"`
}

type PipelineStatus

type PipelineStatus string

PipelineStatus a label for the status of the Pipeline. This is intend to make pipeline creation and deletion atomic.

const (
	PipelineCreating PipelineStatus = "CREATING"
	PipelineReady    PipelineStatus = "READY"
	PipelineDeleting PipelineStatus = "DELETING"
)

type PipelineVersion

type PipelineVersion struct {
	UUID           string `gorm:"column:UUID; not null; primary_key"`
	CreatedAtInSec int64  `gorm:"column:CreatedAtInSec; not null; index"`
	Name           string `gorm:"column:Name; not null; unique_index:idx_pipelineid_name"`
	// Set size to 65535 so it will be stored as longtext.
	// https://dev.mysql.com/doc/refman/8.0/en/column-count-limit.html
	Parameters string `gorm:"column:Parameters; not null; size:65535"`
	// PipelineVersion belongs to Pipeline. If a pipeline with a specific UUID
	// is deleted from Pipeline table, all this pipeline's versions will be
	// deleted from PipelineVersion table.
	PipelineId string                `gorm:"column:PipelineId; not null;index; unique_index:idx_pipelineid_name"`
	Status     PipelineVersionStatus `gorm:"column:Status; not null"`
	// Code source url links to the pipeline version's definition in repo.
	CodeSourceUrl string `gorm:"column:CodeSourceUrl;"`
}

func (*PipelineVersion) APIToModelFieldMap

func (p *PipelineVersion) APIToModelFieldMap() map[string]string

APIToModelFieldMap returns a map from API names to field names for model PipelineVersion.

func (*PipelineVersion) DefaultSortField

func (p *PipelineVersion) DefaultSortField() string

DefaultSortField returns the default sorting field for model Pipeline.

func (*PipelineVersion) GetField

func (p *PipelineVersion) GetField(name string) (string, bool)

func (*PipelineVersion) GetFieldValue

func (p *PipelineVersion) GetFieldValue(name string) interface{}

func (*PipelineVersion) GetKeyFieldPrefix

func (p *PipelineVersion) GetKeyFieldPrefix() string

func (*PipelineVersion) GetModelName

func (p *PipelineVersion) GetModelName() string

GetModelName returns table name used as sort field prefix

func (*PipelineVersion) GetSortByFieldPrefix

func (p *PipelineVersion) GetSortByFieldPrefix(name string) string

func (PipelineVersion) GetValueOfPrimaryKey

func (p PipelineVersion) GetValueOfPrimaryKey() string

func (*PipelineVersion) PrimaryKeyColumnName

func (p *PipelineVersion) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key for model PipelineVersion.

type PipelineVersionStatus

type PipelineVersionStatus string

PipelineVersionStatus a label for the status of the Pipeline. This is intend to make pipeline creation and deletion atomic.

const (
	PipelineVersionCreating PipelineVersionStatus = "CREATING"
	PipelineVersionReady    PipelineVersionStatus = "READY"
	PipelineVersionDeleting PipelineVersionStatus = "DELETING"
)

type ResourceReference

type ResourceReference struct {
	// ID of the resource object
	ResourceUUID string `gorm:"column:ResourceUUID; not null; primary_key"`

	// The type of the resource object
	ResourceType common.ResourceType `gorm:"column:ResourceType; not null; primary_key; index:referencefilter"`

	// The ID of the resource that been referenced to.
	ReferenceUUID string `gorm:"column:ReferenceUUID; not null; index:referencefilter"`

	// The name of the resource that been referenced to.
	ReferenceName string `gorm:"column:ReferenceName; not null; "`

	// The type of the resource that been referenced to.
	ReferenceType common.ResourceType `gorm:"column:ReferenceType; not null; primary_key; index:referencefilter"`

	// The relationship between the resource object and the resource that been referenced to.
	Relationship common.Relationship `gorm:"column:Relationship; not null; "`

	// The json formatted blob of the resource reference.
	Payload string `gorm:"column:Payload; not null; size:65535 "`
}

Resource reference table models the relationship between resources in a loosely coupled way.

type Run

type Run struct {
	UUID               string `gorm:"column:UUID; not null; primary_key"`
	ExperimentUUID     string `gorm:"column:ExperimentUUID; not null;"`
	DisplayName        string `gorm:"column:DisplayName; not null;"` /* The name that user provides. Can contain special characters*/
	Name               string `gorm:"column:Name; not null;"`        /* The name of the K8s resource. Follow regex '[a-z0-9]([-a-z0-9]*[a-z0-9])?'*/
	StorageState       string `gorm:"column:StorageState; not null;"`
	Namespace          string `gorm:"column:Namespace; not null;"`
	ServiceAccount     string `gorm:"column:ServiceAccount; not null;"`
	Description        string `gorm:"column:Description; not null;"`
	CreatedAtInSec     int64  `gorm:"column:CreatedAtInSec; not null;"`
	ScheduledAtInSec   int64  `gorm:"column:ScheduledAtInSec; default:0;"`
	FinishedAtInSec    int64  `gorm:"column:FinishedAtInSec; default:0;"`
	Conditions         string `gorm:"column:Conditions; not null"`
	Metrics            []*RunMetric
	ResourceReferences []*ResourceReference
	PipelineSpec
}

func (*Run) APIToModelFieldMap

func (r *Run) APIToModelFieldMap() map[string]string

APIToModelFieldMap returns a map from API names to field names for model Run.

func (*Run) DefaultSortField

func (r *Run) DefaultSortField() string

DefaultSortField returns the default sorting field for model Run.

func (*Run) GetField

func (r *Run) GetField(name string) (string, bool)

func (*Run) GetFieldValue

func (r *Run) GetFieldValue(name string) interface{}

func (*Run) GetKeyFieldPrefix

func (r *Run) GetKeyFieldPrefix() string

func (*Run) GetModelName

func (r *Run) GetModelName() string

GetModelName returns table name used as sort field prefix

func (*Run) GetSortByFieldPrefix

func (r *Run) GetSortByFieldPrefix(name string) string

func (Run) GetValueOfPrimaryKey

func (r Run) GetValueOfPrimaryKey() string

func (*Run) IsRegularField

func (r *Run) IsRegularField(name string) bool

Regular fields are the fields that are mapped to columns in Run table. Non-regular fields are the run metrics for now. Could have other non-regular sorting fields later.

func (*Run) PrimaryKeyColumnName

func (r *Run) PrimaryKeyColumnName() string

PrimaryKeyColumnName returns the primary key for model Run.

type RunDetail

type RunDetail struct {
	Run
	PipelineRuntime
}

type RunMetric

type RunMetric struct {
	RunUUID     string  `gorm:"column:RunUUID; not null;primary_key"`
	NodeID      string  `gorm:"column:NodeID; not null; primary_key"`
	Name        string  `gorm:"column:Name; not null;primary_key"`
	NumberValue float64 `gorm:"column:NumberValue"`
	Format      string  `gorm:"column:Format"`
	Payload     string  `gorm:"column:Payload; not null; size:65535"`
}

type Task

type Task struct {
	UUID              string `gorm:"column:UUID; not null; primary_key"`
	Namespace         string `gorm:"column:Namespace; not null;"`
	PipelineName      string `gorm:"column:PipelineName; not null;"`
	RunUUID           string `gorm:"column:RunUUID; not null;"`
	MLMDExecutionID   string `gorm:"column:MLMDExecutionID; not null;"`
	CreatedTimestamp  int64  `gorm:"column:CreatedTimestamp; not null"`
	FinishedTimestamp int64  `gorm:"column:FinishedTimestamp"`
	Fingerprint       string `gorm:"column:Fingerprint; not null;"`
}

func (Task) APIToModelFieldMap

func (t Task) APIToModelFieldMap() map[string]string

func (Task) DefaultSortField

func (t Task) DefaultSortField() string

func (Task) GetField

func (t Task) GetField(name string) (string, bool)

func (Task) GetFieldValue

func (t Task) GetFieldValue(name string) interface{}

func (Task) GetKeyFieldPrefix

func (t Task) GetKeyFieldPrefix() string

func (Task) GetModelName

func (t Task) GetModelName() string

func (Task) GetSortByFieldPrefix

func (t Task) GetSortByFieldPrefix(s string) string

func (Task) PrimaryKeyColumnName

func (t Task) PrimaryKeyColumnName() string

type Trigger

type Trigger struct {
	// Create workflows according to a cron schedule.
	CronSchedule
	// Create workflows periodically.
	PeriodicSchedule
}

Trigger specifies when to create a new workflow.

Jump to

Keyboard shortcuts

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