models

package
v0.6.37 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint `gorm:"index;AUTO_INCREMENT"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

This is the base model definition every flyteadmin model embeds. This is nearly identical to http://doc.gorm.io/models.html#conventions except that flyteadmin models define their own primary keys rather than use the ID as the primary key

type Execution

type Execution struct {
	BaseModel
	ExecutionKey
	LaunchPlanID uint   `gorm:"index"`
	WorkflowID   uint   `gorm:"index"`
	TaskID       uint   `gorm:"index"`
	Phase        string `valid:"length(0|255)"`
	Closure      []byte
	Spec         []byte `gorm:"not null"`
	StartedAt    *time.Time
	// Corresponds to the CreatedAt field in the Execution closure.
	// Prefixed with Execution to avoid clashes with gorm.Model CreatedAt
	ExecutionCreatedAt *time.Time
	// Corresponds to the UpdatedAt field in the Execution closure
	// Prefixed with Execution to avoid clashes with gorm.Model UpdatedAt
	ExecutionUpdatedAt *time.Time
	Duration           time.Duration
	ExecutionEvents    []ExecutionEvent
	// In the case of an aborted execution this string may be non-empty.
	// It should be ignored for any other value of phase other than aborted.
	AbortCause string `valid:"length(0|255)"`
	// Corresponds to the execution mode used to trigger this execution
	Mode int32
	// The "parent" execution (if there is one) that is related to this execution.
	SourceExecutionID uint
	// Descendant execution related to this execution.
	DescendantExecution *Execution
	// The parent node execution if this was launched by a node
	ParentNodeExecutionID uint
	// Cluster where execution was triggered
	Cluster string `valid:"length(0|255)"`
	// Offloaded location of inputs LiteralMap. These are the inputs evaluated and contain applied defaults.
	InputsURI storage.DataReference
	// User specified inputs. This map might be incomplete and not include defaults applied
	UserInputsURI storage.DataReference
	// Execution Error Kind. nullable
	ErrorKind *string `gorm:"index"`
	// Execution Error Code nullable
	ErrorCode *string `valid:"length(0|255)"`
	// The user responsible for launching this execution.
	// This is also stored in the spec but promoted as a column for filtering.
	User string `gorm:"index" valid:"length(0|255)"`
}

Database model to encapsulate a (workflow) execution.

type ExecutionEvent

type ExecutionEvent struct {
	BaseModel
	ExecutionKey
	RequestID  string `valid:"length(0|255)"`
	OccurredAt time.Time
	Phase      string `gorm:"primary_key"`
}

type ExecutionKey

type ExecutionKey struct {
	Project string `gorm:"primary_key;column:execution_project" valid:"length(0|255)"`
	Domain  string `gorm:"primary_key;column:execution_domain" valid:"length(0|255)"`
	Name    string `gorm:"primary_key;column:execution_name" valid:"length(0|255)"`
}

Execution primary key

type LaunchPlan

type LaunchPlan struct {
	BaseModel
	LaunchPlanKey
	Spec       []byte `gorm:"not null"`
	WorkflowID uint   `gorm:"index"`
	Closure    []byte `gorm:"not null"`
	// GORM doesn't save the zero value for ints, so we use a pointer for the State field
	State      *int32 `gorm:"default:0"`
	Executions []Execution
	// Hash of the launch plan
	Digest       []byte
	ScheduleType LaunchPlanScheduleType
}

Database model to encapsulate a launch plan.

type LaunchPlanKey

type LaunchPlanKey struct {
	Project string `gorm:"primary_key;index:lp_project_domain_name_idx,lp_project_domain_idx" valid:"length(0|255)"`
	Domain  string `gorm:"primary_key;index:lp_project_domain_name_idx,lp_project_domain_idx" valid:"length(0|255)"`
	Name    string `gorm:"primary_key;index:lp_project_domain_name_idx" valid:"length(0|255)"`
	Version string `gorm:"primary_key" valid:"length(0|255)"`
}

Launch plan primary key

type LaunchPlanScheduleType

type LaunchPlanScheduleType string
const (
	// LaunchPlanScheduleTypeNONE is the const representing the launch plan does not have a schedule
	LaunchPlanScheduleTypeNONE LaunchPlanScheduleType = "NONE"
	// LaunchPlanScheduleTypeCRON is the const representing the launch plan has a CRON type of schedule
	LaunchPlanScheduleTypeCRON LaunchPlanScheduleType = "CRON"
	// LaunchPlanScheduleTypeRATE is the launch plan has a RATE type of schedule
	LaunchPlanScheduleTypeRATE LaunchPlanScheduleType = "RATE"
)

type NamedEntity added in v0.1.5

type NamedEntity struct {
	NamedEntityKey
	NamedEntityMetadataFields
}

Composes an identifier (NamedEntity) and its associated metadata fields

type NamedEntityKey added in v0.1.5

type NamedEntityKey struct {
	ResourceType core.ResourceType
	Project      string `valid:"length(0|255)"`
	Domain       string `valid:"length(0|255)"`
	Name         string `valid:"length(0|255)"`
}

NamedEntity key. This is used as a lookup for NamedEntityMetadata, so the fields here should match the ones in NamedEntityMetadataKey.

type NamedEntityMetadata added in v0.1.5

type NamedEntityMetadata struct {
	BaseModel
	NamedEntityMetadataKey
	NamedEntityMetadataFields
}

Database model to encapsulate metadata associated with a NamedEntity

type NamedEntityMetadataFields added in v0.1.5

type NamedEntityMetadataFields struct {
	Description string `gorm:"type:varchar(300)"`
	// GORM doesn't save the zero value for ints, so we use a pointer for the State field
	State *int32 `gorm:"default:0"`
}

Fields to be composed into any named entity

type NamedEntityMetadataKey added in v0.1.5

type NamedEntityMetadataKey struct {
	ResourceType core.ResourceType `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"`
	Project      string            `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"`
	Domain       string            `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"`
	Name         string            `gorm:"primary_key;index:named_entity_metadata_type_project_domain_name_idx" valid:"length(0|255)"`
}

NamedEntityMetadata primary key

type NodeExecution

type NodeExecution struct {
	BaseModel
	NodeExecutionKey
	// Also stored in the closure, but defined as a separate column because it's useful for filtering and sorting.
	Phase     string
	InputURI  string
	Closure   []byte
	StartedAt *time.Time
	// Corresponds to the CreatedAt field in the NodeExecution closure
	// Prefixed with NodeExecution to avoid clashes with gorm.Model CreatedAt
	NodeExecutionCreatedAt *time.Time
	// Corresponds to the UpdatedAt field in the NodeExecution closure
	// Prefixed with NodeExecution to avoid clashes with gorm.Model UpdatedAt
	NodeExecutionUpdatedAt *time.Time
	Duration               time.Duration
	NodeExecutionEvents    []NodeExecutionEvent
	// Metadata about the node execution.
	NodeExecutionMetadata []byte
	// Parent that spawned this node execution - value is empty for executions at level 0
	ParentID *uint `sql:"default:null" gorm:"index"`
	// List of child node executions - for cases like Dynamic task, sub workflow, etc
	ChildNodeExecutions []NodeExecution `gorm:"foreignkey:ParentID"`
	// The task execution (if any) which launched this node execution.
	// TO BE DEPRECATED - as we have now introduced ParentID
	ParentTaskExecutionID uint `sql:"default:null" gorm:"index"`
	// The workflow execution (if any) which this node execution launched
	// NOTE: LaunchedExecution[foreignkey:ParentNodeExecutionID] refers to Workflow execution launched and is different from ParentID
	LaunchedExecution Execution `gorm:"foreignkey:ParentNodeExecutionID"`
	// Execution Error Kind. nullable, can be one of core.ExecutionError_ErrorKind
	ErrorKind *string `gorm:"index"`
	// Execution Error Code nullable. string value, but finite set determined by the execution engine and plugins
	ErrorCode *string
	// If the node is of Type Task, this should always exist for a successful execution, indicating the cache status for the execution
	CacheStatus *string
	// In the case of dynamic workflow nodes, the remote closure is uploaded to the path specified here.
	DynamicWorkflowRemoteClosureReference string
}

By convention, gorm foreign key references are of the form {ModelName}ID

type NodeExecutionEvent

type NodeExecutionEvent struct {
	BaseModel
	NodeExecutionKey
	RequestID  string
	OccurredAt time.Time
	Phase      string `gorm:"primary_key"`
}

type NodeExecutionKey

type NodeExecutionKey struct {
	ExecutionKey
	NodeID string `gorm:"primary_key;index" valid:"length(0|255)"`
}

type Project

type Project struct {
	BaseModel
	Identifier  string `gorm:"primary_key"`
	Name        string `valid:"length(0|255)"` // Human-readable name, not a unique identifier.
	Description string `gorm:"type:varchar(300)"`
	Labels      []byte
	// GORM doesn't save the zero value for ints, so we use a pointer for the State field
	State *int32 `gorm:"default:0;index"`
}

type Resource added in v0.3.38

type Resource struct {
	ID           int64 `gorm:"AUTO_INCREMENT;column:id;primary_key"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	DeletedAt    *time.Time `sql:"index"`
	Project      string     `gorm:"unique_index:resource_idx" valid:"length(0|255)"`
	Domain       string     `gorm:"unique_index:resource_idx" valid:"length(0|255)"`
	Workflow     string     `gorm:"unique_index:resource_idx" valid:"length(0|255)"`
	LaunchPlan   string     `gorm:"unique_index:resource_idx" valid:"length(0|255)"`
	ResourceType string     `gorm:"unique_index:resource_idx" valid:"length(0|255)"`
	Priority     ResourcePriority
	// Serialized flyteidl.admin.MatchingAttributes.
	Attributes []byte
}

Represents Flyte resources repository. In this model, the combination of (Project, Domain, Workflow, LaunchPlan, ResourceType) is unique

type ResourcePriority added in v0.3.38

type ResourcePriority int32
const (
	ResourcePriorityDomainLevel        ResourcePriority = 1
	ResourcePriorityProjectDomainLevel ResourcePriority = 10
	ResourcePriorityWorkflowLevel      ResourcePriority = 100
	ResourcePriorityLaunchPlanLevel    ResourcePriority = 1000
)

type Task

type Task struct {
	BaseModel
	TaskKey
	Closure []byte `gorm:"not null"`
	// Hash of the compiled task closure
	Digest []byte
	// Task type (also stored in the closure put promoted as a column for filtering).
	Type string `valid:"length(0|255)"`
}

Database model to encapsulate a task.

type TaskExecution

type TaskExecution struct {
	BaseModel
	TaskExecutionKey
	Phase        string `valid:"length(0|255)"`
	PhaseVersion uint32
	InputURI     string `valid:"length(0|255)"`
	Closure      []byte
	StartedAt    *time.Time
	// Corresponds to the CreatedAt field in the TaskExecution closure
	// This field is prefixed with TaskExecution because it signifies when
	// the execution was createdAt, not to be confused with gorm.Model.CreatedAt
	TaskExecutionCreatedAt *time.Time
	// Corresponds to the UpdatedAt field in the TaskExecution closure
	// This field is prefixed with TaskExecution because it signifies when
	// the execution was UpdatedAt, not to be confused with gorm.Model.UpdatedAt
	TaskExecutionUpdatedAt *time.Time
	Duration               time.Duration
	// The child node executions (if any) launched by this task execution.
	ChildNodeExecution []NodeExecution `gorm:"foreignkey:ParentTaskExecutionID"`
}

By convention, gorm foreign key references are of the form {ModelName}ID

type TaskExecutionKey

type TaskExecutionKey struct {
	TaskKey
	NodeExecutionKey
	// *IMPORTANT* This is a pointer to an int in order to allow setting an empty ("0") value according to gorm convention.
	// Because RetryAttempt is part of the TaskExecution primary key is should *never* be null.
	RetryAttempt *uint32 `gorm:"primary_key"`
}

Task execution primary key

type TaskKey

type TaskKey struct {
	Project string `gorm:"primary_key;index:task_project_domain_name_idx,task_project_domain_idx" valid:"length(0|255)"`
	Domain  string `gorm:"primary_key;index:task_project_domain_name_idx,task_project_domain_idx" valid:"length(0|255)"`
	Name    string `gorm:"primary_key;index:task_project_domain_name_idx" valid:"length(0|255)"`
	Version string `gorm:"primary_key" valid:"length(0|255)"`
}

Task primary key

type Workflow

type Workflow struct {
	BaseModel
	WorkflowKey
	TypedInterface          []byte
	RemoteClosureIdentifier string `gorm:"not null" valid:"length(0|255)"`
	LaunchPlans             []LaunchPlan
	Executions              []Execution
	// Hash of the compiled workflow closure
	Digest []byte
}

Database model to encapsulate a workflow.

type WorkflowKey

type WorkflowKey struct {
	Project string `gorm:"primary_key;index:workflow_project_domain_name_idx,workflow_project_domain_idx"  valid:"length(0|255)"`
	Domain  string `gorm:"primary_key;index:workflow_project_domain_name_idx,workflow_project_domain_idx"  valid:"length(0|255)"`
	Name    string `gorm:"primary_key;index:workflow_project_domain_name_idx"  valid:"length(0|255)"`
	Version string `gorm:"primary_key"`
}

Workflow primary key

Jump to

Keyboard shortcuts

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