Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Migrations = []*gormigrate.Migration{ { ID: "2019-05-22-projects", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Project{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("projects") }, }, { ID: "2018-05-23-tasks", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Task{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("tasks") }, }, { ID: "2018-05-23-workflows", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Workflow{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("workflows") }, }, { ID: "2019-05-23-lp", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.LaunchPlan{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("launch_plans") }, }, { ID: "2019-05-23-executions", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("executions") }, }, { ID: "2019-01-29-executions-events", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.ExecutionEvent{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("executions_events") }, }, { ID: "2019-04-17-node-executions", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("node_executions") }, }, { ID: "2019-01-29-node-executions-events", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NodeExecutionEvent{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("node_executions_events") }, }, { ID: "2019-03-16-task-executions", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&TaskExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("task_executions") }, }, { ID: "2019-04-17-node-executions-backfill", Migrate: func(tx *gorm.DB) error { return tx.Exec("update node_executions set parent_task_execution_id = NULL where parent_task_execution_id = 0").Error }, }, { ID: "2019-09-27-executions", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE executions DROP COLUMN IF EXISTS cluster").Error }, }, { ID: "2019-10-09-project-description", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Project{}) }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE projects DROP COLUMN IF EXISTS description").Error }, }, { ID: "2019-10-15-offload-inputs", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE executions DROP COLUMN IF EXISTS InputsURI, DROP COLUMN IF EXISTS UserInputsURI").Error }, }, { ID: "2019-11-05-named-entity-metadata", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NamedEntityMetadata{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("named_entity_metadata") }, }, { ID: "2020-01-10-resource", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Resource{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("resources") }, }, { ID: "2020-03-17-task-type", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Task{}) }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE tasks DROP COLUMN IF EXISTS type").Error }, }, { ID: "2020-04-03-named-entity-state", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NamedEntityMetadata{}) }, Rollback: func(tx *gorm.DB) error { return tx.Table("named_entity_metadata").Migrator().DropColumn(&models.NamedEntityMetadata{}, "state") }, }, { ID: "2020-04-03-named-entity-state-default", Migrate: func(tx *gorm.DB) error { return tx.Exec("UPDATE named_entity_metadata SET state = 0").Error }, Rollback: func(tx *gorm.DB) error { return tx.Exec("UPDATE named_entity_metadata set state = NULL").Error }, }, { ID: "2020-04-03-workflow-state", Migrate: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE workflows DROP COLUMN IF EXISTS state").Error }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE workflows ADD COLUMN IF NOT EXISTS state integer;").Error }, }, { ID: "2020-04-29-executions", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}, &models.NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { if err := tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "error_code"); err != nil { return err } if err := tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "error_kind"); err != nil { return err } if err := tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "error_code"); err != nil { return err } if err := tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "error_kind"); err != nil { return err } return nil }, }, { ID: "2020-04-14-task-type", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Exec("ALTER TABLE executions DROP COLUMN IF EXISTS task_id").Error }, }, { ID: "2020-07-27-cachestatus", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "cache_status") }, }, { ID: "2020-07-31-node-execution", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { if err := tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "parent_id"); err != nil { return err } return tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "node_execution_metadata") }, }, { ID: "2020-08-17-labels-addition", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Project{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.Project{}).Migrator().DropColumn(&models.Project{}, "labels") }, }, { ID: "2020-09-01-task-exec-idx", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&TaskExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&TaskExecution{}).Migrator().DropIndex(&TaskExecution{}, "idx_task_executions_exec") }, }, { ID: "2020-11-03-project-state-addition", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Project{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.Project{}).Migrator().DropColumn(&models.Project{}, "state") }, }, { ID: "2020-11-03-project-state-default", Migrate: func(tx *gorm.DB) error { return tx.Exec("UPDATE projects set state = 0").Error }, Rollback: func(tx *gorm.DB) error { return tx.Exec("UPDATE projects set state = NULL").Error }, }, { ID: "2021-01-22-execution-user", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "user") }, }, { ID: "2021-04-19-node-execution_dynamic-workflow", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.NodeExecution{}).Migrator().DropColumn(&models.NodeExecution{}, "dynamic_workflow_remote_closure_reference") }, }, { ID: "2021-07-22-schedulable_entities", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&schedulerModels.SchedulableEntity{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable(&schedulerModels.SchedulableEntity{}, "schedulable_entities") }, }, { ID: "2021-08-05-schedulable_entities_snapshot", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&schedulerModels.ScheduleEntitiesSnapshot{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable(&schedulerModels.ScheduleEntitiesSnapshot{}, "schedulable_entities_snapshot") }, }, { ID: "2022-01-11-id-to-bigint", Migrate: func(tx *gorm.DB) error { db, err := tx.DB() if err != nil { return err } return alterTableColumnType(db, "id", "bigint") }, Rollback: func(tx *gorm.DB) error { db, err := tx.DB() if err != nil { return err } return alterTableColumnType(db, "id", "int") }, }, { ID: "2022-01-11-execution-state", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Table("execution").Migrator().DropColumn(&models.Execution{}, "state") }, }, { ID: "2022-03-29-node-execution-internal-data", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&NodeExecution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Table("node_execution").Migrator().DropColumn(&NodeExecution{}, "internal_data") }, }, { ID: "2022-04-04-execution-created-at-index", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.Execution{}).Migrator().DropIndex(&models.Execution{}, "idx_executions_created_at") }, }, { ID: "2022-04-11-signals", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Signal{}) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("signals") }, }, { ID: "2022-12-09-execution-launch-type", Migrate: func(tx *gorm.DB) error { return tx.AutoMigrate(&models.Execution{}) }, Rollback: func(tx *gorm.DB) error { return tx.Model(&models.Execution{}).Migrator().DropColumn(&models.Execution{}, "launch_entity") }, }, }
Functions ¶
Types ¶
type ExecutionKey ¶
type NodeExecution ¶
type NodeExecution struct { models.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 // The task execution (if any) which launched this node execution. ParentTaskExecutionID uint `sql:"default:null" gorm:"index"` // The workflow execution (if any) which this node execution launched LaunchedExecution models.Execution `gorm:"foreignKey:ParentNodeExecutionID;references:ID"` // In the case of dynamic workflow nodes, the remote closure is uploaded to the path specified here. DynamicWorkflowRemoteClosureReference string // Metadata that is only relevant to the flyteadmin service that is used to parse the model and track additional attributes. InternalData []byte }
type NodeExecutionKey ¶
type NodeExecutionKey struct { ExecutionKey NodeID string `gorm:"primary_key;index"` }
type TaskExecution ¶
type TaskExecution struct { models.BaseModel TaskExecutionKey Phase string PhaseVersion uint32 InputURI string 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;references:ID"` }
type TaskExecutionKey ¶
type TaskExecutionKey struct { TaskKey Project string `gorm:"primary_key;column:execution_project;index:idx_task_executions_exec"` Domain string `gorm:"primary_key;column:execution_domain;index:idx_task_executions_exec"` Name string `gorm:"primary_key;column:execution_name;index:idx_task_executions_exec"` NodeID string `gorm:"primary_key;index:idx_task_executions_exec;index"` // *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;AUTO_INCREMENT:FALSE"` }
Click to show internal directories.
Click to hide internal directories.