model

package
v0.0.0-...-4f670de Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) GetModelName

func (e *Experiment) GetModelName() string

GetModelName returns table name used as sort field prefix

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) GetModelName

func (j *Job) GetModelName() string

GetModelName returns table name used as sort field prefix

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; unique"`
	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:"-"`
}

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) GetModelName

func (p *Pipeline) GetModelName() string

GetModelName returns table name used as sort field prefix

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) GetModelName

func (p *PipelineVersion) GetModelName() string

GetModelName returns table name used as sort field prefix

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) GetModelName

func (r *Run) GetModelName() string

GetModelName returns table name used as sort field prefix

func (Run) GetValueOfPrimaryKey

func (r Run) GetValueOfPrimaryKey() string

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 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