From 6b19c9ceb12cdb9f6719405781311a12e7464715 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Tue, 14 May 2024 10:00:34 +0800 Subject: [PATCH 01/15] wip Signed-off-by: Kevin Su --- flyteadmin/pkg/common/entity.go | 1 + .../pkg/manager/impl/execution_manager.go | 66 +++++++++++-------- flyteadmin/pkg/manager/impl/util/filters.go | 1 + .../pkg/repositories/config/migrations.go | 33 ++++++++++ .../repositories/gormimpl/execution_repo.go | 22 +++++-- .../repositories/interfaces/execution_repo.go | 2 +- .../pkg/repositories/mocks/execution_repo.go | 2 +- .../pkg/repositories/models/execution.go | 9 +++ .../repositories/transformers/execution.go | 23 +++++-- 9 files changed, 118 insertions(+), 41 deletions(-) diff --git a/flyteadmin/pkg/common/entity.go b/flyteadmin/pkg/common/entity.go index ed51d872b2..71c991dc4e 100644 --- a/flyteadmin/pkg/common/entity.go +++ b/flyteadmin/pkg/common/entity.go @@ -20,6 +20,7 @@ const ( Signal = "s" AdminTag = "at" ExecutionAdminTag = "eat" + ExecutionTag = "et" ) // ResourceTypeToEntity maps a resource type to an entity suitable for use with Database filters diff --git a/flyteadmin/pkg/manager/impl/execution_manager.go b/flyteadmin/pkg/manager/impl/execution_manager.go index fb2e0d377c..977e1f8179 100644 --- a/flyteadmin/pkg/manager/impl/execution_manager.go +++ b/flyteadmin/pkg/manager/impl/execution_manager.go @@ -819,29 +819,29 @@ func (m *ExecutionManager) fillInTemplateArgs(ctx context.Context, query core.Ar func (m *ExecutionManager) launchExecutionAndPrepareModel( ctx context.Context, request admin.ExecutionCreateRequest, requestedAt time.Time) ( - context.Context, *models.Execution, error) { + context.Context, *models.Execution, []*models.ExecutionTag, error) { err := validation.ValidateExecutionRequest(ctx, request, m.db, m.config.ApplicationConfiguration()) if err != nil { logger.Debugf(ctx, "Failed to validate ExecutionCreateRequest %+v with err %v", request, err) - return nil, nil, err + return nil, nil, nil, err } if request.Spec.LaunchPlan.ResourceType == core.ResourceType_TASK { logger.Debugf(ctx, "Launching single task execution with [%+v]", request.Spec.LaunchPlan) // When tasks can have defaults this will need to handle Artifacts as well. ctx, model, err := m.launchSingleTaskExecution(ctx, request, requestedAt) - return ctx, model, err + return ctx, model, nil, err } launchPlanModel, err := util.GetLaunchPlanModel(ctx, m.db, *request.Spec.LaunchPlan) if err != nil { logger.Debugf(ctx, "Failed to get launch plan model for ExecutionCreateRequest %+v with err %v", request, err) - return nil, nil, err + return nil, nil, nil, err } launchPlan, err := transformers.FromLaunchPlanModel(launchPlanModel) if err != nil { logger.Debugf(ctx, "Failed to transform launch plan model %+v with err %v", launchPlanModel, err) - return nil, nil, err + return nil, nil, nil, err } var lpExpectedInputs *core.ParameterMap @@ -860,23 +860,23 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( logger.Debugf(ctx, "Failed to CheckAndFetchInputsForExecution with request.Inputs: %+v"+ "fixed inputs: %+v and expected inputs: %+v with err %v", request.Inputs, launchPlan.Spec.FixedInputs, lpExpectedInputs, err) - return nil, nil, err + return nil, nil, nil, err } workflowModel, err := util.GetWorkflowModel(ctx, m.db, *launchPlan.Spec.WorkflowId) if err != nil { logger.Debugf(ctx, "Failed to get workflow with id %+v with err %v", launchPlan.Spec.WorkflowId, err) - return nil, nil, err + return nil, nil, nil, err } workflow, err := transformers.FromWorkflowModel(workflowModel) if err != nil { logger.Debugf(ctx, "Failed to get workflow with id %+v with err %v", launchPlan.Spec.WorkflowId, err) - return nil, nil, err + return nil, nil, nil, err } closure, err := util.FetchAndGetWorkflowClosure(ctx, m.storageClient, workflowModel.RemoteClosureIdentifier) if err != nil { logger.Debugf(ctx, "Failed to get workflow with id %+v with err %v", launchPlan.Spec.WorkflowId, err) - return nil, nil, err + return nil, nil, nil, err } closure.CreatedAt = workflow.Closure.CreatedAt workflow.Closure = closure @@ -900,7 +900,7 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( var sourceExecutionID uint parentNodeExecutionID, sourceExecutionID, err = m.getInheritedExecMetadata(ctx, requestSpec, &workflowExecutionID) if err != nil { - return nil, nil, err + return nil, nil, nil, err } // Dynamically assign task resource defaults. @@ -914,16 +914,16 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( inputsURI, err := common.OffloadLiteralMap(ctx, m.storageClient, executionInputs, workflowExecutionID.Project, workflowExecutionID.Domain, workflowExecutionID.Name, shared.Inputs) if err != nil { - return nil, nil, err + return nil, nil, nil, err } userInputsURI, err := common.OffloadLiteralMap(ctx, m.storageClient, request.Inputs, workflowExecutionID.Project, workflowExecutionID.Domain, workflowExecutionID.Name, shared.UserInputs) if err != nil { - return nil, nil, err + return nil, nil, nil, err } executionConfig, err := m.getExecutionConfig(ctx, &request, launchPlan) if err != nil { - return nil, nil, err + return nil, nil, nil, err } namespace := common.GetNamespaceName( @@ -931,15 +931,15 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( labels, err := resolveStringMap(executionConfig.GetLabels(), launchPlan.Spec.Labels, "labels", m.config.RegistrationValidationConfiguration().GetMaxLabelEntries()) if err != nil { - return nil, nil, err + return nil, nil, nil, err } labels, err = m.addProjectLabels(ctx, request.Project, labels) if err != nil { - return nil, nil, err + return nil, nil, nil, err } annotations, err := resolveStringMap(executionConfig.GetAnnotations(), launchPlan.Spec.Annotations, "annotations", m.config.RegistrationValidationConfiguration().GetMaxAnnotationEntries()) if err != nil { - return nil, nil, err + return nil, nil, nil, err } var rawOutputDataConfig *admin.RawOutputDataConfig if executionConfig.RawOutputDataConfig != nil { @@ -948,7 +948,7 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( clusterAssignment, err := m.getClusterAssignment(ctx, &request) if err != nil { - return nil, nil, err + return nil, nil, nil, err } var executionClusterLabel *admin.ExecutionClusterLabel @@ -972,7 +972,7 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( overrides, err := m.addPluginOverrides(ctx, &workflowExecutionID, launchPlan.GetSpec().WorkflowId.Name, launchPlan.Id.Name) if err != nil { - return nil, nil, err + return nil, nil, nil, err } if overrides != nil { executionParameters.TaskPluginOverrides = overrides @@ -1041,21 +1041,28 @@ func (m *ExecutionManager) launchExecutionAndPrepareModel( if err != nil { logger.Infof(ctx, "Failed to create execution model in transformer for id: [%+v] with err: %v", workflowExecutionID, err) - return nil, nil, err + return nil, nil, nil, err } - return ctx, executionModel, nil + executionTagModel, err := transformers.CreateExecutionTagModel(createExecModelInput) + if err != nil { + logger.Infof(ctx, "Failed to create execution tag model in transformer for id: [%+v] with err: %v", + workflowExecutionID, err) + return nil, nil, nil, err + } + + return ctx, executionModel, executionTagModel, nil } // Inserts an execution model into the database store and emits platform metrics. func (m *ExecutionManager) createExecutionModel( - ctx context.Context, executionModel *models.Execution) (*core.WorkflowExecutionIdentifier, error) { + ctx context.Context, executionModel *models.Execution, executionTagModel []*models.ExecutionTag) (*core.WorkflowExecutionIdentifier, error) { workflowExecutionIdentifier := core.WorkflowExecutionIdentifier{ Project: executionModel.ExecutionKey.Project, Domain: executionModel.ExecutionKey.Domain, Name: executionModel.ExecutionKey.Name, } - err := m.db.ExecutionRepo().Create(ctx, *executionModel) + err := m.db.ExecutionRepo().Create(ctx, *executionModel, executionTagModel) if err != nil { logger.Debugf(ctx, "failed to save newly created execution [%+v] with id %+v to db with err %v", workflowExecutionIdentifier, workflowExecutionIdentifier, err) @@ -1077,12 +1084,13 @@ func (m *ExecutionManager) CreateExecution( request.Inputs = request.GetSpec().GetInputs() } var executionModel *models.Execution + var executionTagModel []*models.ExecutionTag var err error - ctx, executionModel, err = m.launchExecutionAndPrepareModel(ctx, request, requestedAt) + ctx, executionModel, executionTagModel, err = m.launchExecutionAndPrepareModel(ctx, request, requestedAt) if err != nil { return nil, err } - workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel) + workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel, executionTagModel) if err != nil { return nil, err } @@ -1127,7 +1135,8 @@ func (m *ExecutionManager) RelaunchExecution( executionSpec.Metadata.ReferenceExecution = existingExecution.Id executionSpec.OverwriteCache = request.GetOverwriteCache() var executionModel *models.Execution - ctx, executionModel, err = m.launchExecutionAndPrepareModel(ctx, admin.ExecutionCreateRequest{ + var executionTagModel []*models.ExecutionTag + ctx, executionModel, executionTagModel, err = m.launchExecutionAndPrepareModel(ctx, admin.ExecutionCreateRequest{ Project: request.Id.Project, Domain: request.Id.Domain, Name: request.Name, @@ -1138,7 +1147,7 @@ func (m *ExecutionManager) RelaunchExecution( return nil, err } executionModel.SourceExecutionID = existingExecutionModel.ID - workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel) + workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel, executionTagModel) if err != nil { return nil, err } @@ -1178,7 +1187,8 @@ func (m *ExecutionManager) RecoverExecution( executionSpec.Metadata.Mode = admin.ExecutionMetadata_RECOVERED executionSpec.Metadata.ReferenceExecution = existingExecution.Id var executionModel *models.Execution - ctx, executionModel, err = m.launchExecutionAndPrepareModel(ctx, admin.ExecutionCreateRequest{ + var executionTagModel []*models.ExecutionTag + ctx, executionModel, executionTagModel, err = m.launchExecutionAndPrepareModel(ctx, admin.ExecutionCreateRequest{ Project: request.Id.Project, Domain: request.Id.Domain, Name: request.Name, @@ -1189,7 +1199,7 @@ func (m *ExecutionManager) RecoverExecution( return nil, err } executionModel.SourceExecutionID = existingExecutionModel.ID - workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel) + workflowExecutionIdentifier, err := m.createExecutionModel(ctx, executionModel, executionTagModel) if err != nil { return nil, err } diff --git a/flyteadmin/pkg/manager/impl/util/filters.go b/flyteadmin/pkg/manager/impl/util/filters.go index ccf6d6f9b1..e7747c0f96 100644 --- a/flyteadmin/pkg/manager/impl/util/filters.go +++ b/flyteadmin/pkg/manager/impl/util/filters.go @@ -64,6 +64,7 @@ var filterFieldEntityPrefix = map[string]common.Entity{ "signal": common.Signal, "admin_tag": common.AdminTag, "execution_admin_tag": common.ExecutionAdminTag, + "execution_tag": common.ExecutionTag, } func parseField(field string, primaryEntity common.Entity) (common.Entity, string) { diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index b05da0d4c9..537712efb6 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1182,6 +1182,39 @@ var NoopMigrations = []*gormigrate.Migration{ return tx.AutoMigrate(&Execution{}) }, }, + { + ID: "test-8", + Migrate: func(tx *gorm.DB) error { + type ExecutionTag struct { + gorm.Model + ExecutionKey + // The key of the tag. + Key string `gorm:"primary_key" valid:"length(0|255)"` + // The value of the tag. + Value string `gorm:"uniqueIndex" valid:"length(0|255)"` + } + + var sourceData []models.Execution + tx.Find(&sourceData) + println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].Tags) + + var sourceData2 []models.AdminTag + tx.Find(&sourceData2) + println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData2[0].Name) + + // Insert data into the destination table + for _, source := range sourceData { + for _, tag := range source.Tags { + println("tag.Name [%v]", tag.Name) + destination := ExecutionTag{Key: tag.Name} + tx.Create(&destination) + } + } + + // tx = tx.Model(&AdminTag{}) + return tx.AutoMigrate(&ExecutionTag{}) + }, + }, } // ContinuedMigrations - Above are a series of migrations labeled as no-op migrations. These are migrations that we diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go index c2957af0b6..f20aed4ca2 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go @@ -22,14 +22,24 @@ type ExecutionRepo struct { metrics gormMetrics } -func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution) error { +func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution, executionTagModel []*models.ExecutionTag) error { timer := r.metrics.CreateDuration.Start() - tx := r.db.WithContext(ctx).Omit("id").Create(&input) + err := r.db.WithContext(ctx).Transaction(func(_ *gorm.DB) error { + if executionTagModel != nil { + tx := r.db.WithContext(ctx).Omit("id").Create(executionTagModel) + if tx.Error != nil { + return r.errorTransformer.ToFlyteAdminError(tx.Error) + } + } + + tx := r.db.WithContext(ctx).Omit("id").Create(&input) + if tx.Error != nil { + return r.errorTransformer.ToFlyteAdminError(tx.Error) + } + return nil + }) timer.Stop() - if tx.Error != nil { - return r.errorTransformer.ToFlyteAdminError(tx.Error) - } - return nil + return err } func (r *ExecutionRepo) Get(ctx context.Context, input interfaces.Identifier) (models.Execution, error) { diff --git a/flyteadmin/pkg/repositories/interfaces/execution_repo.go b/flyteadmin/pkg/repositories/interfaces/execution_repo.go index 29e46c69ca..7036b2f83c 100644 --- a/flyteadmin/pkg/repositories/interfaces/execution_repo.go +++ b/flyteadmin/pkg/repositories/interfaces/execution_repo.go @@ -9,7 +9,7 @@ import ( // Defines the interface for interacting with workflow execution models. type ExecutionRepoInterface interface { // Inserts a workflow execution model into the database store. - Create(ctx context.Context, input models.Execution) error + Create(ctx context.Context, input models.Execution, executionTagModel []*models.ExecutionTag) error // This updates only an existing execution model with all non-empty fields in the input. Update(ctx context.Context, execution models.Execution) error // Returns a matching execution if it exists. diff --git a/flyteadmin/pkg/repositories/mocks/execution_repo.go b/flyteadmin/pkg/repositories/mocks/execution_repo.go index 8649bcaa3c..5b8bdf2a01 100644 --- a/flyteadmin/pkg/repositories/mocks/execution_repo.go +++ b/flyteadmin/pkg/repositories/mocks/execution_repo.go @@ -22,7 +22,7 @@ type MockExecutionRepo struct { countFunction CountExecutionFunc } -func (r *MockExecutionRepo) Create(ctx context.Context, input models.Execution) error { +func (r *MockExecutionRepo) Create(ctx context.Context, input models.Execution, executionTagModel []*models.ExecutionTag) error { if r.createFunction != nil { return r.createFunction(ctx, input) } diff --git a/flyteadmin/pkg/repositories/models/execution.go b/flyteadmin/pkg/repositories/models/execution.go index 4c236e093d..708125db5e 100644 --- a/flyteadmin/pkg/repositories/models/execution.go +++ b/flyteadmin/pkg/repositories/models/execution.go @@ -72,6 +72,15 @@ type AdminTag struct { Name string `gorm:"index:,unique;size:255"` } +type ExecutionTag struct { + gorm.Model + ExecutionKey + // The key of the tag. + Key string `gorm:"primary_key" valid:"length(0|255)"` + // The value of the tag. + Value string `gorm:"uniqueIndex" valid:"length(0|255)"` +} + func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) { tx.Statement.AddClause(clause.OnConflict{ Columns: []clause.Column{{Name: "name"}}, // key column diff --git a/flyteadmin/pkg/repositories/transformers/execution.go b/flyteadmin/pkg/repositories/transformers/execution.go index 3b8c556abd..b6eab055fa 100644 --- a/flyteadmin/pkg/repositories/transformers/execution.go +++ b/flyteadmin/pkg/repositories/transformers/execution.go @@ -111,10 +111,6 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e } activeExecution := int32(admin.ExecutionState_EXECUTION_ACTIVE) - tags := make([]models.AdminTag, len(input.RequestSpec.Tags)) - for i, tag := range input.RequestSpec.Tags { - tags[i] = models.AdminTag{Name: tag} - } executionModel := &models.Execution{ ExecutionKey: models.ExecutionKey{ @@ -136,7 +132,6 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e User: requestSpec.Metadata.Principal, State: &activeExecution, LaunchEntity: strings.ToLower(input.LaunchEntity.String()), - Tags: tags, } // A reference launch entity can be one of either or a task OR launch plan. Traditionally, workflows are executed // with a reference launch plan which is why this behavior is the default below. @@ -152,6 +147,24 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e return executionModel, nil } +// CreateExecutionTagModel transforms a ExecutionCreateRequest to a ExecutionTag model +func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.ExecutionTag, error) { + tags := make([]*models.ExecutionTag, 0, len(input.RequestSpec.Labels.Values)) + for k, v := range input.RequestSpec.Labels.Values { + tags = append(tags, &models.ExecutionTag{ + ExecutionKey: models.ExecutionKey{ + Project: input.WorkflowExecutionID.Project, + Domain: input.WorkflowExecutionID.Domain, + Name: input.WorkflowExecutionID.Name, + }, + Key: k, + Value: v, + }) + } + + return tags, nil +} + func reassignCluster(ctx context.Context, cluster string, executionID *core.WorkflowExecutionIdentifier, execution *models.Execution) error { logger.Debugf(ctx, "Updating cluster for execution [%v] with existing recorded cluster [%s] and setting to cluster [%s]", executionID, execution.Cluster, cluster) From 5e21ec6a4f15c1f8f63f8a8db7abf8203656a489 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Tue, 14 May 2024 14:45:22 +0800 Subject: [PATCH 02/15] wip Signed-off-by: Kevin Su --- .../pkg/repositories/config/migrations.go | 30 ++++++++++++------- .../repositories/gormimpl/execution_repo.go | 2 +- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index 537712efb6..ab1650b295 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1183,7 +1183,7 @@ var NoopMigrations = []*gormigrate.Migration{ }, }, { - ID: "test-8", + ID: "test-12", Migrate: func(tx *gorm.DB) error { type ExecutionTag struct { gorm.Model @@ -1195,23 +1195,31 @@ var NoopMigrations = []*gormigrate.Migration{ } var sourceData []models.Execution + tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.execution_name = %s.execution_name", + "execution_admin_tags", "executions", "execution_admin_tags")) + tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.id = %s.admin_tag_id", + "admin_tags", "admin_tags", "execution_admin_tags")) tx.Find(&sourceData) - println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].Tags) + println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].ExecutionKey.Name) + println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].Tags[0].Name) var sourceData2 []models.AdminTag tx.Find(&sourceData2) println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData2[0].Name) // Insert data into the destination table - for _, source := range sourceData { - for _, tag := range source.Tags { - println("tag.Name [%v]", tag.Name) - destination := ExecutionTag{Key: tag.Name} - tx.Create(&destination) - } - } - - // tx = tx.Model(&AdminTag{}) + //for _, source := range sourceData2 { + // for _, tag := range source.Tags { + // println("tag.Name [%v]", tag.Name) + // destination := ExecutionTag{Key: tag.Name} + // tx.Create(&destination) + // } + //} + + //query := tx.Model(&models.AdminTag{}) + //_ := tx.Migrator().CreateView("users_pets", gorm.ViewOption{Query: query}) + + tx = tx.Model(&models.AdminTag{}) return tx.AutoMigrate(&ExecutionTag{}) }, }, diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go index f20aed4ca2..c7e372b357 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go @@ -25,7 +25,7 @@ type ExecutionRepo struct { func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution, executionTagModel []*models.ExecutionTag) error { timer := r.metrics.CreateDuration.Start() err := r.db.WithContext(ctx).Transaction(func(_ *gorm.DB) error { - if executionTagModel != nil { + if executionTagModel != nil && len(executionTagModel) > 0 { tx := r.db.WithContext(ctx).Omit("id").Create(executionTagModel) if tx.Error != nil { return r.errorTransformer.ToFlyteAdminError(tx.Error) From f7764c7d5e13bd7d6131c5bd50928eb3e7b89753 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 20 May 2024 04:42:44 +0800 Subject: [PATCH 03/15] wip Signed-off-by: Kevin Su --- .../pkg/repositories/config/migrations.go | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index ab1650b295..08e6a92f47 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1183,7 +1183,7 @@ var NoopMigrations = []*gormigrate.Migration{ }, }, { - ID: "test-12", + ID: "test-3", Migrate: func(tx *gorm.DB) error { type ExecutionTag struct { gorm.Model @@ -1195,17 +1195,23 @@ var NoopMigrations = []*gormigrate.Migration{ } var sourceData []models.Execution - tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.execution_name = %s.execution_name", - "execution_admin_tags", "executions", "execution_admin_tags")) - tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.id = %s.admin_tag_id", - "admin_tags", "admin_tags", "execution_admin_tags")) + //tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.execution_name = %s.execution_name", + // "execution_admin_tags", "executions", "execution_admin_tags")) + //tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.id = %s.admin_tag_id", + // "admin_tags", "admin_tags", "execution_admin_tags")) tx.Find(&sourceData) - println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].ExecutionKey.Name) - println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData[0].Tags[0].Name) + tx.Exec("CREATE TABLE test1 select * from executions;") + println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData) + println("kkkkkkkkkkkkkkkkkkkkkksourceData", len(sourceData)) + for _, source := range sourceData { + if source.Tags != nil && len(source.Tags) != 0 { + println("fuckkkkkkkkkkkkkkkkkkkkkkkk") + } + } - var sourceData2 []models.AdminTag - tx.Find(&sourceData2) - println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData2[0].Name) + //var sourceData2 []models.AdminTag + //tx.Find(&sourceData2) + // println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData2[0].Name) // Insert data into the destination table //for _, source := range sourceData2 { @@ -1219,7 +1225,7 @@ var NoopMigrations = []*gormigrate.Migration{ //query := tx.Model(&models.AdminTag{}) //_ := tx.Migrator().CreateView("users_pets", gorm.ViewOption{Query: query}) - tx = tx.Model(&models.AdminTag{}) + // tx = tx.Model(&models.AdminTag{}) return tx.AutoMigrate(&ExecutionTag{}) }, }, From a43ca9a49f7289c70eb278163975b31b40d67429 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 20 May 2024 05:07:56 +0800 Subject: [PATCH 04/15] wip Signed-off-by: Kevin Su --- .../pkg/repositories/config/migrations.go | 53 ++++--------------- 1 file changed, 10 insertions(+), 43 deletions(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index 08e6a92f47..1139b47778 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1183,50 +1183,17 @@ var NoopMigrations = []*gormigrate.Migration{ }, }, { - ID: "test-3", + ID: "2024-5-20-execution-tags", Migrate: func(tx *gorm.DB) error { - type ExecutionTag struct { - gorm.Model - ExecutionKey - // The key of the tag. - Key string `gorm:"primary_key" valid:"length(0|255)"` - // The value of the tag. - Value string `gorm:"uniqueIndex" valid:"length(0|255)"` - } - - var sourceData []models.Execution - //tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.execution_name = %s.execution_name", - // "execution_admin_tags", "executions", "execution_admin_tags")) - //tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.id = %s.admin_tag_id", - // "admin_tags", "admin_tags", "execution_admin_tags")) - tx.Find(&sourceData) - tx.Exec("CREATE TABLE test1 select * from executions;") - println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData) - println("kkkkkkkkkkkkkkkkkkkkkksourceData", len(sourceData)) - for _, source := range sourceData { - if source.Tags != nil && len(source.Tags) != 0 { - println("fuckkkkkkkkkkkkkkkkkkkkkkkk") - } - } - - //var sourceData2 []models.AdminTag - //tx.Find(&sourceData2) - // println("kkkkkkkkkkkkkkkkkkkkkksourceData", sourceData2[0].Name) - - // Insert data into the destination table - //for _, source := range sourceData2 { - // for _, tag := range source.Tags { - // println("tag.Name [%v]", tag.Name) - // destination := ExecutionTag{Key: tag.Name} - // tx.Create(&destination) - // } - //} - - //query := tx.Model(&models.AdminTag{}) - //_ := tx.Migrator().CreateView("users_pets", gorm.ViewOption{Query: query}) - - // tx = tx.Model(&models.AdminTag{}) - return tx.AutoMigrate(&ExecutionTag{}) + // Deprecate execution_admin_tags and admin_tags tables, and create a new table execution_tags + // to store tags associated with executions. + sql := "CREATE TABLE execution_tags as select execution_project, execution_domain, execution_name," + + " created_at, updated_at, deleted_at, name as key, null as value from execution_admin_tags" + + " INNER JOIN admin_tags a on execution_admin_tags.admin_tag_id = a.id;" + return tx.Exec(sql).Error + }, + Rollback: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("execution_tags") }, }, } From bf6b05637956fb7545496188919d446ea82ff299 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Mon, 20 May 2024 16:05:24 +0800 Subject: [PATCH 05/15] wip Signed-off-by: Kevin Su --- flyteadmin/pkg/repositories/gormimpl/execution_repo.go | 2 +- flyteadmin/pkg/repositories/models/execution.go | 2 +- flyteadmin/pkg/repositories/transformers/execution.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go index c7e372b357..071dff1ee1 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go @@ -26,7 +26,7 @@ func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution, exec timer := r.metrics.CreateDuration.Start() err := r.db.WithContext(ctx).Transaction(func(_ *gorm.DB) error { if executionTagModel != nil && len(executionTagModel) > 0 { - tx := r.db.WithContext(ctx).Omit("id").Create(executionTagModel) + tx := r.db.WithContext(ctx).Create(executionTagModel) if tx.Error != nil { return r.errorTransformer.ToFlyteAdminError(tx.Error) } diff --git a/flyteadmin/pkg/repositories/models/execution.go b/flyteadmin/pkg/repositories/models/execution.go index 708125db5e..f20ad718a9 100644 --- a/flyteadmin/pkg/repositories/models/execution.go +++ b/flyteadmin/pkg/repositories/models/execution.go @@ -73,7 +73,7 @@ type AdminTag struct { } type ExecutionTag struct { - gorm.Model + BaseModel ExecutionKey // The key of the tag. Key string `gorm:"primary_key" valid:"length(0|255)"` diff --git a/flyteadmin/pkg/repositories/transformers/execution.go b/flyteadmin/pkg/repositories/transformers/execution.go index b6eab055fa..51fa90db20 100644 --- a/flyteadmin/pkg/repositories/transformers/execution.go +++ b/flyteadmin/pkg/repositories/transformers/execution.go @@ -147,7 +147,7 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e return executionModel, nil } -// CreateExecutionTagModel transforms a ExecutionCreateRequest to a ExecutionTag model +// CreateExecutionTagModel transforms a CreateExecutionModelInput to a ExecutionTag model func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.ExecutionTag, error) { tags := make([]*models.ExecutionTag, 0, len(input.RequestSpec.Labels.Values)) for k, v := range input.RequestSpec.Labels.Values { From dfbafff66ea0fdf573ed549ce4f223b4599fddf8 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 14:22:04 -0700 Subject: [PATCH 06/15] update list Signed-off-by: Kevin Su --- flyteadmin/pkg/manager/impl/util/filters.go | 4 +- .../pkg/repositories/config/migrations.go | 26 ++++++--- .../pkg/repositories/gormimpl/common.go | 2 + .../repositories/gormimpl/execution_repo.go | 8 ++- .../gormimpl/execution_repo_test.go | 54 +++++++++++++++++-- .../pkg/repositories/models/execution.go | 7 +-- .../repositories/transformers/execution.go | 1 + flyteadmin/tests/bootstrap.go | 2 + flyteadmin/tests/execution_test.go | 16 +++--- 9 files changed, 90 insertions(+), 30 deletions(-) diff --git a/flyteadmin/pkg/manager/impl/util/filters.go b/flyteadmin/pkg/manager/impl/util/filters.go index e7747c0f96..dfdadc8dc2 100644 --- a/flyteadmin/pkg/manager/impl/util/filters.go +++ b/flyteadmin/pkg/manager/impl/util/filters.go @@ -122,7 +122,7 @@ func prepareValues(field string, values []string) (interface{}, error) { } var allowedJoinEntities = map[common.Entity]sets.String{ - common.Execution: sets.NewString(common.Execution, common.LaunchPlan, common.Workflow, common.Task, common.AdminTag), + common.Execution: sets.NewString(common.Execution, common.LaunchPlan, common.Workflow, common.Task, common.AdminTag, common.ExecutionTag), common.LaunchPlan: sets.NewString(common.LaunchPlan, common.Workflow), common.NodeExecution: sets.NewString(common.NodeExecution, common.Execution), common.NodeExecutionEvent: sets.NewString(common.NodeExecutionEvent), @@ -134,6 +134,7 @@ var allowedJoinEntities = map[common.Entity]sets.String{ common.Project: sets.NewString(common.Project), common.Signal: sets.NewString(common.Signal), common.AdminTag: sets.NewString(common.AdminTag), + common.ExecutionTag: sets.NewString(common.ExecutionTag), } var entityColumns = map[common.Entity]sets.String{ @@ -149,6 +150,7 @@ var entityColumns = map[common.Entity]sets.String{ common.Project: models.ProjectColumns, common.Signal: models.SignalColumns, common.AdminTag: models.AdminTagColumns, + common.ExecutionTag: models.ExecutionTagColumns, } func ParseFilters(filterParams string, primaryEntity common.Entity) ([]common.InlineFilter, error) { diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index 1139b47778..6715812ed0 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1182,15 +1182,27 @@ var NoopMigrations = []*gormigrate.Migration{ return tx.AutoMigrate(&Execution{}) }, }, + { - ID: "2024-5-20-execution-tags", + ID: "2024-5-24-execution-tags", Migrate: func(tx *gorm.DB) error { - // Deprecate execution_admin_tags and admin_tags tables, and create a new table execution_tags - // to store tags associated with executions. - sql := "CREATE TABLE execution_tags as select execution_project, execution_domain, execution_name," + - " created_at, updated_at, deleted_at, name as key, null as value from execution_admin_tags" + - " INNER JOIN admin_tags a on execution_admin_tags.admin_tag_id = a.id;" - return tx.Exec(sql).Error + return tx.Transaction(func(_ *gorm.DB) error { + // Create an execution_tags Table + if err := tx.AutoMigrate(&models.ExecutionTag{}); err != nil { + return err + } + // Deprecate execution_admin_tags and admin_tags tables, and create a new table execution_tags + // to store tags associated with executions. + sql := "INSERT INTO execution_tags (execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, key, value)" + + " SELECT execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, name as key, null as value" + + " FROM execution_admin_tags" + + " INNER JOIN admin_tags a on execution_admin_tags.admin_tag_id = a.id;" + if err := tx.Exec(sql).Error; err != nil { + return err + } + sql = "ALTER TABLE execution_tags ALTER COLUMN id SET DATA TYPE serial" + return nil + }) }, Rollback: func(tx *gorm.DB) error { return tx.Migrator().DropTable("execution_tags") diff --git a/flyteadmin/pkg/repositories/gormimpl/common.go b/flyteadmin/pkg/repositories/gormimpl/common.go index 5b5885c212..1a94a20328 100644 --- a/flyteadmin/pkg/repositories/gormimpl/common.go +++ b/flyteadmin/pkg/repositories/gormimpl/common.go @@ -30,6 +30,7 @@ const workflowTableName = "workflows" const descriptionEntityTableName = "description_entities" const AdminTagsTableName = "admin_tags" const executionAdminTagsTableName = "execution_admin_tags" +const executionTagsTableName = "execution_tags" const limit = "limit" const filters = "filters" @@ -49,6 +50,7 @@ var entityToTableName = map[common.Entity]string{ common.Signal: "signals", common.AdminTag: "admin_tags", common.ExecutionAdminTag: "execution_admin_tags", + common.ExecutionTag: "execution_tags", } var innerJoinExecToNodeExec = fmt.Sprintf( diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go index 071dff1ee1..57aa579ddc 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go @@ -32,7 +32,7 @@ func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution, exec } } - tx := r.db.WithContext(ctx).Omit("id").Create(&input) + tx := r.db.WithContext(ctx).Create(&input) if tx.Error != nil { return r.errorTransformer.ToFlyteAdminError(tx.Error) } @@ -99,11 +99,9 @@ func (r *ExecutionRepo) List(ctx context.Context, input interfaces.ListResourceI taskTableName, executionTableName, taskTableName)) } - if ok := input.JoinTableEntities[common.AdminTag]; ok { + if ok := input.JoinTableEntities[common.ExecutionTag]; ok { tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.execution_name = %s.execution_name", - executionAdminTagsTableName, executionTableName, executionAdminTagsTableName)) - tx = tx.Joins(fmt.Sprintf("INNER JOIN %s ON %s.id = %s.admin_tag_id", - AdminTagsTableName, AdminTagsTableName, executionAdminTagsTableName)) + executionTagsTableName, executionTableName, executionTagsTableName)) } // Apply filters diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go index e3483af7fc..86ca657c55 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go @@ -25,18 +25,25 @@ var executionUpdatedAt = time.Date(2018, time.February, 17, 00, 01, 00, 00, time func TestCreateExecution(t *testing.T) { executionRepo := NewExecutionRepo(GetDbForTest(t), errors.NewTestErrorTransformer(), mockScope.NewTestScope()) + executionKey := models.ExecutionKey{ + Project: "project", + Domain: "domain", + Name: "1", + } err := executionRepo.Create(context.Background(), models.Execution{ - ExecutionKey: models.ExecutionKey{ - Project: "project", - Domain: "domain", - Name: "1", - }, + ExecutionKey: executionKey, LaunchPlanID: uint(2), Phase: core.WorkflowExecution_SUCCEEDED.String(), Closure: []byte{1, 2}, Spec: []byte{3, 4}, StartedAt: &executionStartedAt, ExecutionCreatedAt: &createdAt, + }, []*models.ExecutionTag{ + { + ExecutionKey: executionKey, + Key: "hello", + Value: "world", + }, }) assert.NoError(t, err) } @@ -305,6 +312,43 @@ func TestListExecutions_WithTags(t *testing.T) { assert.True(t, mockQuery.Triggered) } +func TestListExecutions_WithLabels(t *testing.T) { + executionRepo := NewExecutionRepo(GetDbForTest(t), errors.NewTestErrorTransformer(), mockScope.NewTestScope()) + + executions := make([]map[string]interface{}, 0) + GlobalMock := mocket.Catcher.Reset() + // Only match on queries that include ordering by name + mockQuery := GlobalMock.NewMock().WithQuery(`execution_name asc`) + mockQuery.WithReply(executions) + + sortParameter, err := common.NewSortParameter(&admin.Sort{ + Direction: admin.Sort_ASCENDING, + Key: "execution_name", + }, models.ExecutionColumns) + require.NoError(t, err) + + keys := []string{"rust", "tonic"} + values := []string{"foo", "bar"} + keyFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "execution_tag_name", keys) + assert.NoError(t, err) + valueFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "execution_tag_value", values) + assert.NoError(t, err) + + _, err = executionRepo.List(context.Background(), interfaces.ListResourceInput{ + SortParameter: sortParameter, + InlineFilters: []common.InlineFilter{ + getEqualityFilter(common.Task, "project", project), + getEqualityFilter(common.Task, "domain", domain), + getEqualityFilter(common.Task, "name", name), + keyFilter, + valueFilter, + }, + Limit: 20, + }) + assert.NoError(t, err) + assert.True(t, mockQuery.Triggered) +} + func TestListExecutions_MissingParameters(t *testing.T) { executionRepo := NewExecutionRepo(GetDbForTest(t), errors.NewTestErrorTransformer(), mockScope.NewTestScope()) _, err := executionRepo.List(context.Background(), interfaces.ListResourceInput{ diff --git a/flyteadmin/pkg/repositories/models/execution.go b/flyteadmin/pkg/repositories/models/execution.go index f20ad718a9..014311688c 100644 --- a/flyteadmin/pkg/repositories/models/execution.go +++ b/flyteadmin/pkg/repositories/models/execution.go @@ -78,7 +78,7 @@ type ExecutionTag struct { // The key of the tag. Key string `gorm:"primary_key" valid:"length(0|255)"` // The value of the tag. - Value string `gorm:"uniqueIndex" valid:"length(0|255)"` + Value string `gorm:"primary_key" valid:"length(0|255)"` } func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) { @@ -90,6 +90,7 @@ func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) { } var ( - ExecutionColumns = modelColumns(Execution{}) - AdminTagColumns = modelColumns(AdminTag{}) + ExecutionColumns = modelColumns(Execution{}) + AdminTagColumns = modelColumns(AdminTag{}) + ExecutionTagColumns = modelColumns(ExecutionTag{}) ) diff --git a/flyteadmin/pkg/repositories/transformers/execution.go b/flyteadmin/pkg/repositories/transformers/execution.go index 51fa90db20..59105c3140 100644 --- a/flyteadmin/pkg/repositories/transformers/execution.go +++ b/flyteadmin/pkg/repositories/transformers/execution.go @@ -161,6 +161,7 @@ func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.Executi Value: v, }) } + logger.Infof(context.Background(), "tttttttttags [%v]", input.RequestSpec.Labels.Values) return tags, nil } diff --git a/flyteadmin/tests/bootstrap.go b/flyteadmin/tests/bootstrap.go index aa1808282d..02fb86cefa 100644 --- a/flyteadmin/tests/bootstrap.go +++ b/flyteadmin/tests/bootstrap.go @@ -86,6 +86,7 @@ func truncateAllTablesForTestingOnly() { TruncateSchedulableEntitiesSnapshots := fmt.Sprintf("TRUNCATE TABLE schedule_entities_snapshots;") TruncateAdminTags := fmt.Sprintf("TRUNCATE TABLE admin_tags;") TruncateExecutionAdminTags := fmt.Sprintf("TRUNCATE TABLE execution_admin_tags;") + TruncateExecutionTags := fmt.Sprintf("TRUNCATE TABLE execution_tags;") ctx := context.Background() db, err := repositories.GetDB(ctx, getDbConfig(), getLoggerConfig()) if err != nil { @@ -116,6 +117,7 @@ func truncateAllTablesForTestingOnly() { db.Exec(TruncateSchedulableEntitiesSnapshots) db.Exec(TruncateAdminTags) db.Exec(TruncateExecutionAdminTags) + db.Exec(TruncateExecutionTags) } func populateWorkflowExecutionForTestingOnly(project, domain, name string) { diff --git a/flyteadmin/tests/execution_test.go b/flyteadmin/tests/execution_test.go index d0d373a1d5..c7ebd2941f 100644 --- a/flyteadmin/tests/execution_test.go +++ b/flyteadmin/tests/execution_test.go @@ -184,13 +184,11 @@ func populateWorkflowExecutionsForTestingOnly() { db.Exec(`INSERT INTO workflows ("id", "project", "domain", "name", "version", "remote_closure_identifier") ` + `VALUES (4, 'project2', 'domain2', 'name2', 'version1', 's3://foo')`) - // Insert dummy tags - db.Exec(`INSERT INTO admin_tags ("id", "name") ` + `VALUES (1, 'hello')`) - db.Exec(`INSERT INTO admin_tags ("id", "name") ` + `VALUES (2, 'flyte')`) - db.Exec(`INSERT INTO execution_admin_tags ("execution_project", "execution_domain", "execution_name", "admin_tag_id") ` + `VALUES ('project1', 'domain1', 'name1', 1)`) - db.Exec(`INSERT INTO execution_admin_tags ("execution_project", "execution_domain", "execution_name", "admin_tag_id") ` + `VALUES ('project1', 'domain1', 'name1', 2)`) - db.Exec(`INSERT INTO execution_admin_tags ("execution_project", "execution_domain", "execution_name", "admin_tag_id") ` + `VALUES ('project1', 'domain1', 'name3', 2)`) - db.Exec(`INSERT INTO execution_admin_tags ("execution_project", "execution_domain", "execution_name", "admin_tag_id") ` + `VALUES ('project1', 'domain1', 'name4', 1)`) + // Insert dummy labels + db.Exec(`INSERT INTO execution_tags ("execution_project", "execution_domain", "execution_name", "key", "value") ` + `VALUES ('project1', 'domain1', 'name1', 'key1', 'value1')`) + db.Exec(`INSERT INTO execution_tags ("execution_project", "execution_domain", "execution_name", "key", "value") ` + `VALUES ('project1', 'domain1', 'name1', 'key1', 'value2')`) + db.Exec(`INSERT INTO execution_tags ("execution_project", "execution_domain", "execution_name", "key", "value") ` + `VALUES ('project1', 'domain1', 'name1', 'key2', 'value2')`) + db.Exec(`INSERT INTO execution_tags ("execution_project", "execution_domain", "execution_name", "key", "value") ` + `VALUES ('project1', 'domain1', 'name1', 'key3', 'value3')`) for _, statement := range insertExecutionStatements { db.Exec(statement) @@ -216,7 +214,7 @@ func TestListWorkflowExecutions(t *testing.T) { assert.Equal(t, len(resp.Executions), 4) } -func TestListWorkflowExecutionsWithTags(t *testing.T) { +func TestListWorkflowExecutionsWithLabels(t *testing.T) { truncateAllTablesForTestingOnly() populateWorkflowExecutionsForTestingOnly() @@ -230,7 +228,7 @@ func TestListWorkflowExecutionsWithTags(t *testing.T) { Domain: "domain1", }, Limit: 5, - Filters: "value_in(admin_tag.name, hello)", + Filters: "value_in(execution_tag.name, key1)", }) assert.Nil(t, err) assert.Equal(t, len(resp.Executions), 2) From 870807f6c5a051ab511aa34fc7cfd87ec1a7eeea Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 14:45:11 -0700 Subject: [PATCH 07/15] update test Signed-off-by: Kevin Su --- flyteadmin/tests/execution_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/flyteadmin/tests/execution_test.go b/flyteadmin/tests/execution_test.go index c7ebd2941f..a3d226562b 100644 --- a/flyteadmin/tests/execution_test.go +++ b/flyteadmin/tests/execution_test.go @@ -228,7 +228,18 @@ func TestListWorkflowExecutionsWithLabels(t *testing.T) { Domain: "domain1", }, Limit: 5, - Filters: "value_in(execution_tag.name, key1)", + Filters: "value_in(execution_tag.key, key1)", + }) + assert.Nil(t, err) + assert.Equal(t, len(resp.Executions), 2) + + resp, err = client.ListExecutions(ctx, &admin.ResourceListRequest{ + Id: &admin.NamedEntityIdentifier{ + Project: "project1", + Domain: "domain1", + }, + Limit: 5, + Filters: "value_in(execution_tag.value, value2)", }) assert.Nil(t, err) assert.Equal(t, len(resp.Executions), 2) From a762ed526e97743cefb5ba93edd677ca91de046a Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 15:19:01 -0700 Subject: [PATCH 08/15] custom field Signed-off-by: Kevin Su --- flyteadmin/pkg/common/filters.go | 12 +++++++++++- .../pkg/repositories/gormimpl/execution_repo_test.go | 8 ++++---- .../pkg/repositories/transformers/execution.go | 12 ++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/flyteadmin/pkg/common/filters.go b/flyteadmin/pkg/common/filters.go index a5974fb286..cf7987bdf5 100644 --- a/flyteadmin/pkg/common/filters.go +++ b/flyteadmin/pkg/common/filters.go @@ -256,6 +256,10 @@ func customizeField(field string, entity Entity) string { if entity == Execution && executionIdentifierFields[field] { return fmt.Sprintf("execution_%s", field) } + // admin_tag table has been migrated to an execution_tag table, so we need to customize the field name. + if entity == AdminTag && field == "name" { + return "key" + } return field } @@ -265,6 +269,10 @@ func customizeEntity(field string, entity Entity) Entity { if entity == NamedEntity && entityMetadataFields[field] { return NamedEntityMetadata } + // admin_tag table has been migrated to an execution_tag table. + if entity == AdminTag { + return ExecutionTag + } return entity } @@ -289,8 +297,10 @@ func NewRepeatedValueFilter(entity Entity, function FilterExpression, field stri return nil, GetInvalidRepeatedValueFilterErr(function) } customizedField := customizeField(field, entity) + customizedEntity := customizeEntity(field, entity) + return &inlineFilterImpl{ - entity: entity, + entity: customizedEntity, function: function, field: customizedField, repeatedValue: repeatedValue, diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go index 86ca657c55..b11dbcbbdd 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go @@ -329,9 +329,9 @@ func TestListExecutions_WithLabels(t *testing.T) { keys := []string{"rust", "tonic"} values := []string{"foo", "bar"} - keyFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "execution_tag_name", keys) + keyFilter, err := common.NewRepeatedValueFilter(common.ExecutionTag, common.ValueIn, "key", keys) assert.NoError(t, err) - valueFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "execution_tag_value", values) + valueFilter, err := common.NewRepeatedValueFilter(common.ExecutionTag, common.ValueIn, "value", values) assert.NoError(t, err) _, err = executionRepo.List(context.Background(), interfaces.ListResourceInput{ @@ -392,9 +392,9 @@ func TestListExecutionsForWorkflow(t *testing.T) { GlobalMock := mocket.Catcher.Reset() GlobalMock.Logging = true // Only match on queries that append expected filters - GlobalMock.NewMock().WithQuery(`SELECT "executions"."id","executions"."created_at","executions"."updated_at","executions"."deleted_at","executions"."execution_project","executions"."execution_domain","executions"."execution_name","executions"."launch_plan_id","executions"."workflow_id","executions"."task_id","executions"."phase","executions"."closure","executions"."spec","executions"."started_at","executions"."execution_created_at","executions"."execution_updated_at","executions"."duration","executions"."abort_cause","executions"."mode","executions"."source_execution_id","executions"."parent_node_execution_id","executions"."cluster","executions"."inputs_uri","executions"."user_inputs_uri","executions"."error_kind","executions"."error_code","executions"."user","executions"."state","executions"."launch_entity" FROM "executions" INNER JOIN workflows ON executions.workflow_id = workflows.id INNER JOIN tasks ON executions.task_id = tasks.id WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND workflows.name = $4 AND tasks.name = $5 AND execution_admin_tags.execution_tag_name in ($6,$7) LIMIT 20`).WithReply(executions) + GlobalMock.NewMock().WithQuery(`SELECT "executions"."id","executions"."created_at","executions"."updated_at","executions"."deleted_at","executions"."execution_project","executions"."execution_domain","executions"."execution_name","executions"."launch_plan_id","executions"."workflow_id","executions"."task_id","executions"."phase","executions"."closure","executions"."spec","executions"."started_at","executions"."execution_created_at","executions"."execution_updated_at","executions"."duration","executions"."abort_cause","executions"."mode","executions"."source_execution_id","executions"."parent_node_execution_id","executions"."cluster","executions"."inputs_uri","executions"."user_inputs_uri","executions"."error_kind","executions"."error_code","executions"."user","executions"."state","executions"."launch_entity" FROM "executions" INNER JOIN workflows ON executions.workflow_id = workflows.id INNER JOIN tasks ON executions.task_id = tasks.id WHERE executions.execution_project = $1 AND executions.execution_domain = $2 AND executions.execution_name = $3 AND workflows.name = $4 AND tasks.name = $5 AND execution_tags.key in ($6,$7) LIMIT 20`).WithReply(executions) vals := []string{"tag1", "tag2"} - tagFilter, err := common.NewRepeatedValueFilter(common.ExecutionAdminTag, common.ValueIn, "execution_tag_name", vals) + tagFilter, err := common.NewRepeatedValueFilter(common.AdminTag, common.ValueIn, "name", vals) assert.NoError(t, err) collection, err := executionRepo.List(context.Background(), interfaces.ListResourceInput{ InlineFilters: []common.InlineFilter{ diff --git a/flyteadmin/pkg/repositories/transformers/execution.go b/flyteadmin/pkg/repositories/transformers/execution.go index 59105c3140..b1005f6512 100644 --- a/flyteadmin/pkg/repositories/transformers/execution.go +++ b/flyteadmin/pkg/repositories/transformers/execution.go @@ -161,6 +161,18 @@ func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.Executi Value: v, }) } + for _, v := range input.RequestSpec.Tags { + tags = append(tags, &models.ExecutionTag{ + ExecutionKey: models.ExecutionKey{ + Project: input.WorkflowExecutionID.Project, + Domain: input.WorkflowExecutionID.Domain, + Name: input.WorkflowExecutionID.Name, + }, + Key: v, + Value: "", + }) + } + logger.Infof(context.Background(), "tttttttttags [%v]", input.RequestSpec.Labels.Values) return tags, nil From 0e31c37183736ff5cc4bc3007163cd19b3839be4 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 15:20:55 -0700 Subject: [PATCH 09/15] deprecate tag Signed-off-by: Kevin Su --- .../gen/pb-es/flyteidl/admin/execution_pb.ts | 3 +- .../gen/pb-go/flyteidl/admin/execution.pb.go | 194 +++++++++--------- .../pb_python/flyteidl/admin/execution_pb2.py | 46 +++-- flyteidl/gen/pb_rust/flyteidl.admin.rs | 1 + .../protos/flyteidl/admin/execution.proto | 2 +- 5 files changed, 127 insertions(+), 119 deletions(-) diff --git a/flyteidl/gen/pb-es/flyteidl/admin/execution_pb.ts b/flyteidl/gen/pb-es/flyteidl/admin/execution_pb.ts index 88a9a1865f..5ba9f62ca6 100644 --- a/flyteidl/gen/pb-es/flyteidl/admin/execution_pb.ts +++ b/flyteidl/gen/pb-es/flyteidl/admin/execution_pb.ts @@ -1113,7 +1113,8 @@ export class ExecutionSpec extends Message { /** * Tags to be set for the execution. * - * @generated from field: repeated string tags = 24; + * @generated from field: repeated string tags = 24 [deprecated = true]; + * @deprecated */ tags: string[] = []; diff --git a/flyteidl/gen/pb-go/flyteidl/admin/execution.pb.go b/flyteidl/gen/pb-go/flyteidl/admin/execution.pb.go index b026cbf07a..1b878ceeb6 100644 --- a/flyteidl/gen/pb-go/flyteidl/admin/execution.pb.go +++ b/flyteidl/gen/pb-go/flyteidl/admin/execution.pb.go @@ -1266,6 +1266,8 @@ type ExecutionSpec struct { // Environment variables to be set for the execution. Envs *Envs `protobuf:"bytes,23,opt,name=envs,proto3" json:"envs,omitempty"` // Tags to be set for the execution. + // + // Deprecated: Marked as deprecated in flyteidl/admin/execution.proto. Tags []string `protobuf:"bytes,24,rep,name=tags,proto3" json:"tags,omitempty"` // Execution cluster label to be set for the execution. ExecutionClusterLabel *ExecutionClusterLabel `protobuf:"bytes,25,opt,name=execution_cluster_label,json=executionClusterLabel,proto3" json:"execution_cluster_label,omitempty"` @@ -1426,6 +1428,7 @@ func (x *ExecutionSpec) GetEnvs() *Envs { return nil } +// Deprecated: Marked as deprecated in flyteidl/admin/execution.proto. func (x *ExecutionSpec) GetTags() []string { if x != nil { return x.Tags @@ -2185,7 +2188,7 @@ var file_flyteidl_admin_execution_proto_rawDesc = []byte{ 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x0d, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd2, + 0x0d, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0xd6, 0x09, 0x0a, 0x0d, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x70, 0x65, 0x63, 0x12, 0x3a, 0x0a, 0x0b, 0x6c, 0x61, 0x75, 0x6e, 0x63, 0x68, 0x5f, 0x70, 0x6c, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, @@ -2247,104 +2250,105 @@ var file_flyteidl_admin_execution_proto_rawDesc = []byte{ 0x01, 0x28, 0x08, 0x52, 0x0e, 0x6f, 0x76, 0x65, 0x72, 0x77, 0x72, 0x69, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x65, 0x6e, 0x76, 0x73, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x2e, 0x45, 0x6e, 0x76, 0x73, 0x52, 0x04, 0x65, 0x6e, 0x76, 0x73, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x18, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, - 0x73, 0x12, 0x5d, 0x0a, 0x17, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, - 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x18, 0x19, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, - 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x75, - 0x73, 0x74, 0x65, 0x72, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x15, 0x65, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, 0x61, 0x62, 0x65, 0x6c, - 0x12, 0x61, 0x0a, 0x19, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, - 0x76, 0x5f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x1a, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, - 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x76, - 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x17, 0x65, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x76, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x42, 0x18, 0x0a, 0x16, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x73, 0x4a, 0x04, 0x08, - 0x04, 0x10, 0x05, 0x22, 0x6d, 0x0a, 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x66, - 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, - 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x61, 0x75, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x61, 0x75, - 0x73, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x54, - 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x5d, 0x0a, 0x1f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, - 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, - 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x88, 0x02, 0x0a, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, - 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x42, 0x6c, 0x6f, 0x62, 0x42, 0x02, - 0x18, 0x01, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x06, 0x69, - 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x66, 0x6c, - 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x55, 0x72, 0x6c, - 0x42, 0x6c, 0x6f, 0x62, 0x42, 0x02, 0x18, 0x01, 0x52, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, - 0x12, 0x3a, 0x0a, 0x0b, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, - 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4d, 0x61, 0x70, - 0x52, 0x0a, 0x66, 0x75, 0x6c, 0x6c, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x12, 0x3c, 0x0a, 0x0c, - 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, - 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4d, 0x61, 0x70, 0x52, 0x0b, 0x66, - 0x75, 0x6c, 0x6c, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x16, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, - 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, - 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, - 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0xae, 0x01, 0x0a, 0x1b, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, + 0x69, 0x6e, 0x2e, 0x45, 0x6e, 0x76, 0x73, 0x52, 0x04, 0x65, 0x6e, 0x76, 0x73, 0x12, 0x16, 0x0a, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x18, 0x20, 0x03, 0x28, 0x09, 0x42, 0x02, 0x18, 0x01, 0x52, + 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x5d, 0x0a, 0x17, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6c, 0x61, 0x62, 0x65, 0x6c, + 0x18, 0x19, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, - 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a, - 0x0b, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, - 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, - 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, - 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x22, 0x19, 0x0a, 0x17, 0x45, 0x78, 0x65, 0x63, - 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x76, 0x0a, 0x22, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x6e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x52, 0x15, 0x65, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x4c, + 0x61, 0x62, 0x65, 0x6c, 0x12, 0x61, 0x0a, 0x19, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x65, 0x6e, 0x76, 0x5f, 0x61, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x18, 0x1a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, + 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x45, 0x6e, 0x76, 0x41, 0x73, 0x73, 0x69, 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x17, + 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x76, 0x41, 0x73, 0x73, 0x69, + 0x67, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x18, 0x0a, 0x16, 0x6e, 0x6f, 0x74, 0x69, 0x66, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, + 0x73, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x22, 0x6d, 0x0a, 0x19, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, + 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x63, 0x61, 0x75, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x63, 0x61, 0x75, 0x73, 0x65, 0x22, 0x1c, 0x0a, 0x1a, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x69, 0x6f, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x69, 0x6e, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x5d, 0x0a, 0x1f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, + 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, + 0x02, 0x69, 0x64, 0x22, 0x88, 0x02, 0x0a, 0x20, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x07, 0x6f, 0x75, 0x74, 0x70, + 0x75, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x66, 0x6c, 0x79, 0x74, + 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x55, 0x72, 0x6c, 0x42, 0x6c, + 0x6f, 0x62, 0x42, 0x02, 0x18, 0x01, 0x52, 0x07, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x12, + 0x33, 0x0a, 0x06, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, + 0x2e, 0x55, 0x72, 0x6c, 0x42, 0x6c, 0x6f, 0x62, 0x42, 0x02, 0x18, 0x01, 0x52, 0x06, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x73, 0x12, 0x3a, 0x0a, 0x0b, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, + 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, + 0x6c, 0x4d, 0x61, 0x70, 0x52, 0x0a, 0x66, 0x75, 0x6c, 0x6c, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x73, + 0x12, 0x3c, 0x0a, 0x0c, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, + 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x4c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x6c, 0x4d, 0x61, + 0x70, 0x52, 0x0b, 0x66, 0x75, 0x6c, 0x6c, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x73, 0x22, 0x8a, + 0x01, 0x0a, 0x16, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, - 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x22, 0x4e, 0x0a, 0x23, 0x57, - 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, - 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x13, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, - 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x2a, 0x3e, 0x0a, 0x0e, 0x45, - 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, - 0x10, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x43, 0x54, 0x49, 0x56, - 0x45, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x49, 0x4f, 0x4e, - 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, 0x44, 0x10, 0x01, 0x42, 0xba, 0x01, 0x0a, 0x12, - 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, - 0x69, 0x6e, 0x42, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, - 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x2f, - 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x62, 0x2d, - 0x67, 0x6f, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, - 0x64, 0x6c, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, 0x6c, 0x79, 0x74, 0x65, - 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, 0x46, 0x6c, 0x79, 0x74, - 0x65, 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, - 0x6c, 0x3a, 0x3a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x34, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x22, 0xae, 0x01, 0x0a, 0x1b, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, + 0x61, 0x6e, 0x67, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x34, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x79, + 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x3b, 0x0a, 0x0b, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x0a, 0x6f, 0x63, 0x63, 0x75, 0x72, 0x72, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, + 0x0a, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x22, 0x19, 0x0a, 0x17, + 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x76, 0x0a, 0x22, 0x57, 0x6f, 0x72, 0x6b, 0x66, + 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x4d, + 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3a, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x66, 0x6c, 0x79, 0x74, + 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, + 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x66, 0x69, 0x65, 0x72, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65, 0x70, + 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x22, + 0x4e, 0x0a, 0x23, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x45, 0x78, 0x65, 0x63, 0x75, + 0x74, 0x69, 0x6f, 0x6e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, + 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x04, 0x73, 0x70, 0x61, 0x6e, 0x2a, + 0x3e, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x14, 0x0a, 0x10, 0x45, 0x58, 0x45, 0x43, 0x55, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, + 0x43, 0x54, 0x49, 0x56, 0x45, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x58, 0x45, 0x43, 0x55, + 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, 0x44, 0x10, 0x01, 0x42, + 0xba, 0x01, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x2e, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, + 0x2e, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, + 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x6f, 0x72, 0x67, 0x2f, 0x66, 0x6c, + 0x79, 0x74, 0x65, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, 0x67, 0x65, 0x6e, + 0x2f, 0x70, 0x62, 0x2d, 0x67, 0x6f, 0x2f, 0x66, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2f, + 0x61, 0x64, 0x6d, 0x69, 0x6e, 0xa2, 0x02, 0x03, 0x46, 0x41, 0x58, 0xaa, 0x02, 0x0e, 0x46, 0x6c, + 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x2e, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xca, 0x02, 0x0e, 0x46, + 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xe2, 0x02, 0x1a, + 0x46, 0x6c, 0x79, 0x74, 0x65, 0x69, 0x64, 0x6c, 0x5c, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x5c, 0x47, + 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x46, 0x6c, 0x79, + 0x74, 0x65, 0x69, 0x64, 0x6c, 0x3a, 0x3a, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/flyteidl/gen/pb_python/flyteidl/admin/execution_pb2.py b/flyteidl/gen/pb_python/flyteidl/admin/execution_pb2.py index a89ed51e3f..ff650d4c55 100644 --- a/flyteidl/gen/pb_python/flyteidl/admin/execution_pb2.py +++ b/flyteidl/gen/pb_python/flyteidl/admin/execution_pb2.py @@ -26,7 +26,7 @@ from flyteidl.admin import matchable_resource_pb2 as flyteidl_dot_admin_dot_matchable__resource__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x66lyteidl/admin/execution.proto\x12\x0e\x66lyteidl.admin\x1a\'flyteidl/admin/cluster_assignment.proto\x1a\x1b\x66lyteidl/admin/common.proto\x1a\x1c\x66lyteidl/core/literals.proto\x1a\x1d\x66lyteidl/core/execution.proto\x1a\"flyteidl/core/execution_envs.proto\x1a\x1f\x66lyteidl/core/artifact_id.proto\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x1b\x66lyteidl/core/metrics.proto\x1a\x1c\x66lyteidl/core/security.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\'flyteidl/admin/matchable_resource.proto\"\xd6\x01\n\x16\x45xecutionCreateRequest\x12\x18\n\x07project\x18\x01 \x01(\tR\x07project\x12\x16\n\x06\x64omain\x18\x02 \x01(\tR\x06\x64omain\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x31\n\x04spec\x18\x04 \x01(\x0b\x32\x1d.flyteidl.admin.ExecutionSpecR\x04spec\x12\x31\n\x06inputs\x18\x05 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\x06inputs\x12\x10\n\x03org\x18\x06 \x01(\tR\x03org\"\x99\x01\n\x18\x45xecutionRelaunchRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\'\n\x0foverwrite_cache\x18\x04 \x01(\x08R\x0eoverwriteCacheJ\x04\x08\x02\x10\x03\"\xa8\x01\n\x17\x45xecutionRecoverRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32!.flyteidl.admin.ExecutionMetadataR\x08metadata\"U\n\x17\x45xecutionCreateResponse\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"Y\n\x1bWorkflowExecutionGetRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"\xb6\x01\n\tExecution\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x31\n\x04spec\x18\x02 \x01(\x0b\x32\x1d.flyteidl.admin.ExecutionSpecR\x04spec\x12:\n\x07\x63losure\x18\x03 \x01(\x0b\x32 .flyteidl.admin.ExecutionClosureR\x07\x63losure\"`\n\rExecutionList\x12\x39\n\nexecutions\x18\x01 \x03(\x0b\x32\x19.flyteidl.admin.ExecutionR\nexecutions\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"e\n\x0eLiteralMapBlob\x12\x37\n\x06values\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01H\x00R\x06values\x12\x12\n\x03uri\x18\x02 \x01(\tH\x00R\x03uriB\x06\n\x04\x64\x61ta\"C\n\rAbortMetadata\x12\x14\n\x05\x63\x61use\x18\x01 \x01(\tR\x05\x63\x61use\x12\x1c\n\tprincipal\x18\x02 \x01(\tR\tprincipal\"\x98\x07\n\x10\x45xecutionClosure\x12>\n\x07outputs\x18\x01 \x01(\x0b\x32\x1e.flyteidl.admin.LiteralMapBlobB\x02\x18\x01H\x00R\x07outputs\x12\x35\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.flyteidl.core.ExecutionErrorH\x00R\x05\x65rror\x12%\n\x0b\x61\x62ort_cause\x18\n \x01(\tB\x02\x18\x01H\x00R\nabortCause\x12\x46\n\x0e\x61\x62ort_metadata\x18\x0c \x01(\x0b\x32\x1d.flyteidl.admin.AbortMetadataH\x00R\rabortMetadata\x12@\n\x0boutput_data\x18\r \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01H\x00R\noutputData\x12\x46\n\x0f\x63omputed_inputs\x18\x03 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01R\x0e\x63omputedInputs\x12<\n\x05phase\x18\x04 \x01(\x0e\x32&.flyteidl.core.WorkflowExecution.PhaseR\x05phase\x12\x39\n\nstarted_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tstartedAt\x12\x35\n\x08\x64uration\x18\x06 \x01(\x0b\x32\x19.google.protobuf.DurationR\x08\x64uration\x12\x39\n\ncreated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\x12\x42\n\rnotifications\x18\t \x03(\x0b\x32\x1c.flyteidl.admin.NotificationR\rnotifications\x12:\n\x0bworkflow_id\x18\x0b \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\nworkflowId\x12]\n\x14state_change_details\x18\x0e \x01(\x0b\x32+.flyteidl.admin.ExecutionStateChangeDetailsR\x12stateChangeDetailsB\x0f\n\routput_result\"[\n\x0eSystemMetadata\x12+\n\x11\x65xecution_cluster\x18\x01 \x01(\tR\x10\x65xecutionCluster\x12\x1c\n\tnamespace\x18\x02 \x01(\tR\tnamespace\"\x85\x05\n\x11\x45xecutionMetadata\x12\x43\n\x04mode\x18\x01 \x01(\x0e\x32/.flyteidl.admin.ExecutionMetadata.ExecutionModeR\x04mode\x12\x1c\n\tprincipal\x18\x02 \x01(\tR\tprincipal\x12\x18\n\x07nesting\x18\x03 \x01(\rR\x07nesting\x12=\n\x0cscheduled_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0bscheduledAt\x12Z\n\x15parent_node_execution\x18\x05 \x01(\x0b\x32&.flyteidl.core.NodeExecutionIdentifierR\x13parentNodeExecution\x12[\n\x13reference_execution\x18\x10 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x12referenceExecution\x12G\n\x0fsystem_metadata\x18\x11 \x01(\x0b\x32\x1e.flyteidl.admin.SystemMetadataR\x0esystemMetadata\x12<\n\x0c\x61rtifact_ids\x18\x12 \x03(\x0b\x32\x19.flyteidl.core.ArtifactIDR\x0b\x61rtifactIds\"t\n\rExecutionMode\x12\n\n\x06MANUAL\x10\x00\x12\r\n\tSCHEDULED\x10\x01\x12\n\n\x06SYSTEM\x10\x02\x12\x0c\n\x08RELAUNCH\x10\x03\x12\x12\n\x0e\x43HILD_WORKFLOW\x10\x04\x12\r\n\tRECOVERED\x10\x05\x12\x0b\n\x07TRIGGER\x10\x06\"V\n\x10NotificationList\x12\x42\n\rnotifications\x18\x01 \x03(\x0b\x32\x1c.flyteidl.admin.NotificationR\rnotifications\"\xd2\t\n\rExecutionSpec\x12:\n\x0blaunch_plan\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\nlaunchPlan\x12\x35\n\x06inputs\x18\x02 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01R\x06inputs\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32!.flyteidl.admin.ExecutionMetadataR\x08metadata\x12H\n\rnotifications\x18\x05 \x01(\x0b\x32 .flyteidl.admin.NotificationListH\x00R\rnotifications\x12!\n\x0b\x64isable_all\x18\x06 \x01(\x08H\x00R\ndisableAll\x12.\n\x06labels\x18\x07 \x01(\x0b\x32\x16.flyteidl.admin.LabelsR\x06labels\x12=\n\x0b\x61nnotations\x18\x08 \x01(\x0b\x32\x1b.flyteidl.admin.AnnotationsR\x0b\x61nnotations\x12I\n\x10security_context\x18\n \x01(\x0b\x32\x1e.flyteidl.core.SecurityContextR\x0fsecurityContext\x12\x39\n\tauth_role\x18\x10 \x01(\x0b\x32\x18.flyteidl.admin.AuthRoleB\x02\x18\x01R\x08\x61uthRole\x12M\n\x12quality_of_service\x18\x11 \x01(\x0b\x32\x1f.flyteidl.core.QualityOfServiceR\x10qualityOfService\x12\'\n\x0fmax_parallelism\x18\x12 \x01(\x05R\x0emaxParallelism\x12X\n\x16raw_output_data_config\x18\x13 \x01(\x0b\x32#.flyteidl.admin.RawOutputDataConfigR\x13rawOutputDataConfig\x12P\n\x12\x63luster_assignment\x18\x14 \x01(\x0b\x32!.flyteidl.admin.ClusterAssignmentR\x11\x63lusterAssignment\x12@\n\rinterruptible\x18\x15 \x01(\x0b\x32\x1a.google.protobuf.BoolValueR\rinterruptible\x12\'\n\x0foverwrite_cache\x18\x16 \x01(\x08R\x0eoverwriteCache\x12(\n\x04\x65nvs\x18\x17 \x01(\x0b\x32\x14.flyteidl.admin.EnvsR\x04\x65nvs\x12\x12\n\x04tags\x18\x18 \x03(\tR\x04tags\x12]\n\x17\x65xecution_cluster_label\x18\x19 \x01(\x0b\x32%.flyteidl.admin.ExecutionClusterLabelR\x15\x65xecutionClusterLabel\x12\x61\n\x19\x65xecution_env_assignments\x18\x1a \x03(\x0b\x32%.flyteidl.core.ExecutionEnvAssignmentR\x17\x65xecutionEnvAssignmentsB\x18\n\x16notification_overridesJ\x04\x08\x04\x10\x05\"m\n\x19\x45xecutionTerminateRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x14\n\x05\x63\x61use\x18\x02 \x01(\tR\x05\x63\x61use\"\x1c\n\x1a\x45xecutionTerminateResponse\"]\n\x1fWorkflowExecutionGetDataRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"\x88\x02\n WorkflowExecutionGetDataResponse\x12\x35\n\x07outputs\x18\x01 \x01(\x0b\x32\x17.flyteidl.admin.UrlBlobB\x02\x18\x01R\x07outputs\x12\x33\n\x06inputs\x18\x02 \x01(\x0b\x32\x17.flyteidl.admin.UrlBlobB\x02\x18\x01R\x06inputs\x12:\n\x0b\x66ull_inputs\x18\x03 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\nfullInputs\x12<\n\x0c\x66ull_outputs\x18\x04 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\x0b\x66ullOutputs\"\x8a\x01\n\x16\x45xecutionUpdateRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x34\n\x05state\x18\x02 \x01(\x0e\x32\x1e.flyteidl.admin.ExecutionStateR\x05state\"\xae\x01\n\x1b\x45xecutionStateChangeDetails\x12\x34\n\x05state\x18\x01 \x01(\x0e\x32\x1e.flyteidl.admin.ExecutionStateR\x05state\x12;\n\x0boccurred_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\noccurredAt\x12\x1c\n\tprincipal\x18\x03 \x01(\tR\tprincipal\"\x19\n\x17\x45xecutionUpdateResponse\"v\n\"WorkflowExecutionGetMetricsRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x05R\x05\x64\x65pth\"N\n#WorkflowExecutionGetMetricsResponse\x12\'\n\x04span\x18\x01 \x01(\x0b\x32\x13.flyteidl.core.SpanR\x04span*>\n\x0e\x45xecutionState\x12\x14\n\x10\x45XECUTION_ACTIVE\x10\x00\x12\x16\n\x12\x45XECUTION_ARCHIVED\x10\x01\x42\xba\x01\n\x12\x63om.flyteidl.adminB\x0e\x45xecutionProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1e\x66lyteidl/admin/execution.proto\x12\x0e\x66lyteidl.admin\x1a\'flyteidl/admin/cluster_assignment.proto\x1a\x1b\x66lyteidl/admin/common.proto\x1a\x1c\x66lyteidl/core/literals.proto\x1a\x1d\x66lyteidl/core/execution.proto\x1a\"flyteidl/core/execution_envs.proto\x1a\x1f\x66lyteidl/core/artifact_id.proto\x1a\x1e\x66lyteidl/core/identifier.proto\x1a\x1b\x66lyteidl/core/metrics.proto\x1a\x1c\x66lyteidl/core/security.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/wrappers.proto\x1a\'flyteidl/admin/matchable_resource.proto\"\xd6\x01\n\x16\x45xecutionCreateRequest\x12\x18\n\x07project\x18\x01 \x01(\tR\x07project\x12\x16\n\x06\x64omain\x18\x02 \x01(\tR\x06\x64omain\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\x31\n\x04spec\x18\x04 \x01(\x0b\x32\x1d.flyteidl.admin.ExecutionSpecR\x04spec\x12\x31\n\x06inputs\x18\x05 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\x06inputs\x12\x10\n\x03org\x18\x06 \x01(\tR\x03org\"\x99\x01\n\x18\x45xecutionRelaunchRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12\'\n\x0foverwrite_cache\x18\x04 \x01(\x08R\x0eoverwriteCacheJ\x04\x08\x02\x10\x03\"\xa8\x01\n\x17\x45xecutionRecoverRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32!.flyteidl.admin.ExecutionMetadataR\x08metadata\"U\n\x17\x45xecutionCreateResponse\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"Y\n\x1bWorkflowExecutionGetRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"\xb6\x01\n\tExecution\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x31\n\x04spec\x18\x02 \x01(\x0b\x32\x1d.flyteidl.admin.ExecutionSpecR\x04spec\x12:\n\x07\x63losure\x18\x03 \x01(\x0b\x32 .flyteidl.admin.ExecutionClosureR\x07\x63losure\"`\n\rExecutionList\x12\x39\n\nexecutions\x18\x01 \x03(\x0b\x32\x19.flyteidl.admin.ExecutionR\nexecutions\x12\x14\n\x05token\x18\x02 \x01(\tR\x05token\"e\n\x0eLiteralMapBlob\x12\x37\n\x06values\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01H\x00R\x06values\x12\x12\n\x03uri\x18\x02 \x01(\tH\x00R\x03uriB\x06\n\x04\x64\x61ta\"C\n\rAbortMetadata\x12\x14\n\x05\x63\x61use\x18\x01 \x01(\tR\x05\x63\x61use\x12\x1c\n\tprincipal\x18\x02 \x01(\tR\tprincipal\"\x98\x07\n\x10\x45xecutionClosure\x12>\n\x07outputs\x18\x01 \x01(\x0b\x32\x1e.flyteidl.admin.LiteralMapBlobB\x02\x18\x01H\x00R\x07outputs\x12\x35\n\x05\x65rror\x18\x02 \x01(\x0b\x32\x1d.flyteidl.core.ExecutionErrorH\x00R\x05\x65rror\x12%\n\x0b\x61\x62ort_cause\x18\n \x01(\tB\x02\x18\x01H\x00R\nabortCause\x12\x46\n\x0e\x61\x62ort_metadata\x18\x0c \x01(\x0b\x32\x1d.flyteidl.admin.AbortMetadataH\x00R\rabortMetadata\x12@\n\x0boutput_data\x18\r \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01H\x00R\noutputData\x12\x46\n\x0f\x63omputed_inputs\x18\x03 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01R\x0e\x63omputedInputs\x12<\n\x05phase\x18\x04 \x01(\x0e\x32&.flyteidl.core.WorkflowExecution.PhaseR\x05phase\x12\x39\n\nstarted_at\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tstartedAt\x12\x35\n\x08\x64uration\x18\x06 \x01(\x0b\x32\x19.google.protobuf.DurationR\x08\x64uration\x12\x39\n\ncreated_at\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tcreatedAt\x12\x39\n\nupdated_at\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\tupdatedAt\x12\x42\n\rnotifications\x18\t \x03(\x0b\x32\x1c.flyteidl.admin.NotificationR\rnotifications\x12:\n\x0bworkflow_id\x18\x0b \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\nworkflowId\x12]\n\x14state_change_details\x18\x0e \x01(\x0b\x32+.flyteidl.admin.ExecutionStateChangeDetailsR\x12stateChangeDetailsB\x0f\n\routput_result\"[\n\x0eSystemMetadata\x12+\n\x11\x65xecution_cluster\x18\x01 \x01(\tR\x10\x65xecutionCluster\x12\x1c\n\tnamespace\x18\x02 \x01(\tR\tnamespace\"\x85\x05\n\x11\x45xecutionMetadata\x12\x43\n\x04mode\x18\x01 \x01(\x0e\x32/.flyteidl.admin.ExecutionMetadata.ExecutionModeR\x04mode\x12\x1c\n\tprincipal\x18\x02 \x01(\tR\tprincipal\x12\x18\n\x07nesting\x18\x03 \x01(\rR\x07nesting\x12=\n\x0cscheduled_at\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\x0bscheduledAt\x12Z\n\x15parent_node_execution\x18\x05 \x01(\x0b\x32&.flyteidl.core.NodeExecutionIdentifierR\x13parentNodeExecution\x12[\n\x13reference_execution\x18\x10 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x12referenceExecution\x12G\n\x0fsystem_metadata\x18\x11 \x01(\x0b\x32\x1e.flyteidl.admin.SystemMetadataR\x0esystemMetadata\x12<\n\x0c\x61rtifact_ids\x18\x12 \x03(\x0b\x32\x19.flyteidl.core.ArtifactIDR\x0b\x61rtifactIds\"t\n\rExecutionMode\x12\n\n\x06MANUAL\x10\x00\x12\r\n\tSCHEDULED\x10\x01\x12\n\n\x06SYSTEM\x10\x02\x12\x0c\n\x08RELAUNCH\x10\x03\x12\x12\n\x0e\x43HILD_WORKFLOW\x10\x04\x12\r\n\tRECOVERED\x10\x05\x12\x0b\n\x07TRIGGER\x10\x06\"V\n\x10NotificationList\x12\x42\n\rnotifications\x18\x01 \x03(\x0b\x32\x1c.flyteidl.admin.NotificationR\rnotifications\"\xd6\t\n\rExecutionSpec\x12:\n\x0blaunch_plan\x18\x01 \x01(\x0b\x32\x19.flyteidl.core.IdentifierR\nlaunchPlan\x12\x35\n\x06inputs\x18\x02 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapB\x02\x18\x01R\x06inputs\x12=\n\x08metadata\x18\x03 \x01(\x0b\x32!.flyteidl.admin.ExecutionMetadataR\x08metadata\x12H\n\rnotifications\x18\x05 \x01(\x0b\x32 .flyteidl.admin.NotificationListH\x00R\rnotifications\x12!\n\x0b\x64isable_all\x18\x06 \x01(\x08H\x00R\ndisableAll\x12.\n\x06labels\x18\x07 \x01(\x0b\x32\x16.flyteidl.admin.LabelsR\x06labels\x12=\n\x0b\x61nnotations\x18\x08 \x01(\x0b\x32\x1b.flyteidl.admin.AnnotationsR\x0b\x61nnotations\x12I\n\x10security_context\x18\n \x01(\x0b\x32\x1e.flyteidl.core.SecurityContextR\x0fsecurityContext\x12\x39\n\tauth_role\x18\x10 \x01(\x0b\x32\x18.flyteidl.admin.AuthRoleB\x02\x18\x01R\x08\x61uthRole\x12M\n\x12quality_of_service\x18\x11 \x01(\x0b\x32\x1f.flyteidl.core.QualityOfServiceR\x10qualityOfService\x12\'\n\x0fmax_parallelism\x18\x12 \x01(\x05R\x0emaxParallelism\x12X\n\x16raw_output_data_config\x18\x13 \x01(\x0b\x32#.flyteidl.admin.RawOutputDataConfigR\x13rawOutputDataConfig\x12P\n\x12\x63luster_assignment\x18\x14 \x01(\x0b\x32!.flyteidl.admin.ClusterAssignmentR\x11\x63lusterAssignment\x12@\n\rinterruptible\x18\x15 \x01(\x0b\x32\x1a.google.protobuf.BoolValueR\rinterruptible\x12\'\n\x0foverwrite_cache\x18\x16 \x01(\x08R\x0eoverwriteCache\x12(\n\x04\x65nvs\x18\x17 \x01(\x0b\x32\x14.flyteidl.admin.EnvsR\x04\x65nvs\x12\x16\n\x04tags\x18\x18 \x03(\tB\x02\x18\x01R\x04tags\x12]\n\x17\x65xecution_cluster_label\x18\x19 \x01(\x0b\x32%.flyteidl.admin.ExecutionClusterLabelR\x15\x65xecutionClusterLabel\x12\x61\n\x19\x65xecution_env_assignments\x18\x1a \x03(\x0b\x32%.flyteidl.core.ExecutionEnvAssignmentR\x17\x65xecutionEnvAssignmentsB\x18\n\x16notification_overridesJ\x04\x08\x04\x10\x05\"m\n\x19\x45xecutionTerminateRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x14\n\x05\x63\x61use\x18\x02 \x01(\tR\x05\x63\x61use\"\x1c\n\x1a\x45xecutionTerminateResponse\"]\n\x1fWorkflowExecutionGetDataRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\"\x88\x02\n WorkflowExecutionGetDataResponse\x12\x35\n\x07outputs\x18\x01 \x01(\x0b\x32\x17.flyteidl.admin.UrlBlobB\x02\x18\x01R\x07outputs\x12\x33\n\x06inputs\x18\x02 \x01(\x0b\x32\x17.flyteidl.admin.UrlBlobB\x02\x18\x01R\x06inputs\x12:\n\x0b\x66ull_inputs\x18\x03 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\nfullInputs\x12<\n\x0c\x66ull_outputs\x18\x04 \x01(\x0b\x32\x19.flyteidl.core.LiteralMapR\x0b\x66ullOutputs\"\x8a\x01\n\x16\x45xecutionUpdateRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x34\n\x05state\x18\x02 \x01(\x0e\x32\x1e.flyteidl.admin.ExecutionStateR\x05state\"\xae\x01\n\x1b\x45xecutionStateChangeDetails\x12\x34\n\x05state\x18\x01 \x01(\x0e\x32\x1e.flyteidl.admin.ExecutionStateR\x05state\x12;\n\x0boccurred_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampR\noccurredAt\x12\x1c\n\tprincipal\x18\x03 \x01(\tR\tprincipal\"\x19\n\x17\x45xecutionUpdateResponse\"v\n\"WorkflowExecutionGetMetricsRequest\x12:\n\x02id\x18\x01 \x01(\x0b\x32*.flyteidl.core.WorkflowExecutionIdentifierR\x02id\x12\x14\n\x05\x64\x65pth\x18\x02 \x01(\x05R\x05\x64\x65pth\"N\n#WorkflowExecutionGetMetricsResponse\x12\'\n\x04span\x18\x01 \x01(\x0b\x32\x13.flyteidl.core.SpanR\x04span*>\n\x0e\x45xecutionState\x12\x14\n\x10\x45XECUTION_ACTIVE\x10\x00\x12\x16\n\x12\x45XECUTION_ARCHIVED\x10\x01\x42\xba\x01\n\x12\x63om.flyteidl.adminB\x0e\x45xecutionProtoP\x01Z;github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin\xa2\x02\x03\x46\x41X\xaa\x02\x0e\x46lyteidl.Admin\xca\x02\x0e\x46lyteidl\\Admin\xe2\x02\x1a\x46lyteidl\\Admin\\GPBMetadata\xea\x02\x0f\x46lyteidl::Adminb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -49,12 +49,14 @@ _EXECUTIONSPEC.fields_by_name['inputs']._serialized_options = b'\030\001' _EXECUTIONSPEC.fields_by_name['auth_role']._options = None _EXECUTIONSPEC.fields_by_name['auth_role']._serialized_options = b'\030\001' + _EXECUTIONSPEC.fields_by_name['tags']._options = None + _EXECUTIONSPEC.fields_by_name['tags']._serialized_options = b'\030\001' _WORKFLOWEXECUTIONGETDATARESPONSE.fields_by_name['outputs']._options = None _WORKFLOWEXECUTIONGETDATARESPONSE.fields_by_name['outputs']._serialized_options = b'\030\001' _WORKFLOWEXECUTIONGETDATARESPONSE.fields_by_name['inputs']._options = None _WORKFLOWEXECUTIONGETDATARESPONSE.fields_by_name['inputs']._serialized_options = b'\030\001' - _globals['_EXECUTIONSTATE']._serialized_start=5693 - _globals['_EXECUTIONSTATE']._serialized_end=5755 + _globals['_EXECUTIONSTATE']._serialized_start=5697 + _globals['_EXECUTIONSTATE']._serialized_end=5759 _globals['_EXECUTIONCREATEREQUEST']._serialized_start=480 _globals['_EXECUTIONCREATEREQUEST']._serialized_end=694 _globals['_EXECUTIONRELAUNCHREQUEST']._serialized_start=697 @@ -84,23 +86,23 @@ _globals['_NOTIFICATIONLIST']._serialized_start=3320 _globals['_NOTIFICATIONLIST']._serialized_end=3406 _globals['_EXECUTIONSPEC']._serialized_start=3409 - _globals['_EXECUTIONSPEC']._serialized_end=4643 - _globals['_EXECUTIONTERMINATEREQUEST']._serialized_start=4645 - _globals['_EXECUTIONTERMINATEREQUEST']._serialized_end=4754 - _globals['_EXECUTIONTERMINATERESPONSE']._serialized_start=4756 - _globals['_EXECUTIONTERMINATERESPONSE']._serialized_end=4784 - _globals['_WORKFLOWEXECUTIONGETDATAREQUEST']._serialized_start=4786 - _globals['_WORKFLOWEXECUTIONGETDATAREQUEST']._serialized_end=4879 - _globals['_WORKFLOWEXECUTIONGETDATARESPONSE']._serialized_start=4882 - _globals['_WORKFLOWEXECUTIONGETDATARESPONSE']._serialized_end=5146 - _globals['_EXECUTIONUPDATEREQUEST']._serialized_start=5149 - _globals['_EXECUTIONUPDATEREQUEST']._serialized_end=5287 - _globals['_EXECUTIONSTATECHANGEDETAILS']._serialized_start=5290 - _globals['_EXECUTIONSTATECHANGEDETAILS']._serialized_end=5464 - _globals['_EXECUTIONUPDATERESPONSE']._serialized_start=5466 - _globals['_EXECUTIONUPDATERESPONSE']._serialized_end=5491 - _globals['_WORKFLOWEXECUTIONGETMETRICSREQUEST']._serialized_start=5493 - _globals['_WORKFLOWEXECUTIONGETMETRICSREQUEST']._serialized_end=5611 - _globals['_WORKFLOWEXECUTIONGETMETRICSRESPONSE']._serialized_start=5613 - _globals['_WORKFLOWEXECUTIONGETMETRICSRESPONSE']._serialized_end=5691 + _globals['_EXECUTIONSPEC']._serialized_end=4647 + _globals['_EXECUTIONTERMINATEREQUEST']._serialized_start=4649 + _globals['_EXECUTIONTERMINATEREQUEST']._serialized_end=4758 + _globals['_EXECUTIONTERMINATERESPONSE']._serialized_start=4760 + _globals['_EXECUTIONTERMINATERESPONSE']._serialized_end=4788 + _globals['_WORKFLOWEXECUTIONGETDATAREQUEST']._serialized_start=4790 + _globals['_WORKFLOWEXECUTIONGETDATAREQUEST']._serialized_end=4883 + _globals['_WORKFLOWEXECUTIONGETDATARESPONSE']._serialized_start=4886 + _globals['_WORKFLOWEXECUTIONGETDATARESPONSE']._serialized_end=5150 + _globals['_EXECUTIONUPDATEREQUEST']._serialized_start=5153 + _globals['_EXECUTIONUPDATEREQUEST']._serialized_end=5291 + _globals['_EXECUTIONSTATECHANGEDETAILS']._serialized_start=5294 + _globals['_EXECUTIONSTATECHANGEDETAILS']._serialized_end=5468 + _globals['_EXECUTIONUPDATERESPONSE']._serialized_start=5470 + _globals['_EXECUTIONUPDATERESPONSE']._serialized_end=5495 + _globals['_WORKFLOWEXECUTIONGETMETRICSREQUEST']._serialized_start=5497 + _globals['_WORKFLOWEXECUTIONGETMETRICSREQUEST']._serialized_end=5615 + _globals['_WORKFLOWEXECUTIONGETMETRICSRESPONSE']._serialized_start=5617 + _globals['_WORKFLOWEXECUTIONGETMETRICSRESPONSE']._serialized_end=5695 # @@protoc_insertion_point(module_scope) diff --git a/flyteidl/gen/pb_rust/flyteidl.admin.rs b/flyteidl/gen/pb_rust/flyteidl.admin.rs index 5f515581cc..91ad8d56f9 100644 --- a/flyteidl/gen/pb_rust/flyteidl.admin.rs +++ b/flyteidl/gen/pb_rust/flyteidl.admin.rs @@ -1673,6 +1673,7 @@ pub struct ExecutionSpec { #[prost(message, optional, tag="23")] pub envs: ::core::option::Option, /// Tags to be set for the execution. + #[deprecated] #[prost(string, repeated, tag="24")] pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// Execution cluster label to be set for the execution. diff --git a/flyteidl/protos/flyteidl/admin/execution.proto b/flyteidl/protos/flyteidl/admin/execution.proto index 676c5a5d6e..6197576bd9 100644 --- a/flyteidl/protos/flyteidl/admin/execution.proto +++ b/flyteidl/protos/flyteidl/admin/execution.proto @@ -331,7 +331,7 @@ message ExecutionSpec { Envs envs = 23; // Tags to be set for the execution. - repeated string tags = 24; + repeated string tags = 24 [deprecated = true]; // Execution cluster label to be set for the execution. ExecutionClusterLabel execution_cluster_label = 25; From 8181049e41f8c5ae17c3d65fea926c2e6b7f703f Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 15:30:59 -0700 Subject: [PATCH 10/15] update migration Signed-off-by: Kevin Su --- .../pkg/repositories/config/migrations.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index 6715812ed0..5760dedb64 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1184,14 +1184,14 @@ var NoopMigrations = []*gormigrate.Migration{ }, { - ID: "2024-5-24-execution-tags", + ID: "2024-06-06-execution-tags", Migrate: func(tx *gorm.DB) error { return tx.Transaction(func(_ *gorm.DB) error { // Create an execution_tags Table if err := tx.AutoMigrate(&models.ExecutionTag{}); err != nil { return err } - // Deprecate execution_admin_tags and admin_tags tables, and create a new table execution_tags + // Drop execution_admin_tags and admin_tags tables, and create a new table execution_tags // to store tags associated with executions. sql := "INSERT INTO execution_tags (execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, key, value)" + " SELECT execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, name as key, null as value" + @@ -1200,7 +1200,6 @@ var NoopMigrations = []*gormigrate.Migration{ if err := tx.Exec(sql).Error; err != nil { return err } - sql = "ALTER TABLE execution_tags ALTER COLUMN id SET DATA TYPE serial" return nil }) }, @@ -1208,6 +1207,20 @@ var NoopMigrations = []*gormigrate.Migration{ return tx.Migrator().DropTable("execution_tags") }, }, + + { + ID: "2024-06-06-drop-execution_admin-tags", + Migrate: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("execution_admin_tags") + }, + }, + + { + ID: "2024-06-06-drop-admin-tags", + Migrate: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("execution_tags") + }, + }, } // ContinuedMigrations - Above are a series of migrations labeled as no-op migrations. These are migrations that we From 9eb5a331a5fdda7157069d4586d64e4d884f0b91 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 15:53:27 -0700 Subject: [PATCH 11/15] update migration Signed-off-by: Kevin Su --- flyteadmin/pkg/repositories/config/migrations.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index 5760dedb64..f9ad19ac93 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1218,7 +1218,7 @@ var NoopMigrations = []*gormigrate.Migration{ { ID: "2024-06-06-drop-admin-tags", Migrate: func(tx *gorm.DB) error { - return tx.Migrator().DropTable("execution_tags") + return tx.Migrator().DropTable("admin_tags") }, }, } From a40ea0d84bc7b7d4fcf60b40eecf8cc9f4afa9c8 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 18:54:17 -0700 Subject: [PATCH 12/15] lint Signed-off-by: Kevin Su --- .../repositories/gormimpl/execution_repo.go | 2 +- .../gormimpl/execution_repo_test.go | 5 ++++ .../repositories/transformers/execution.go | 28 ++++++++++--------- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go index 57aa579ddc..69345fc06d 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo.go @@ -25,7 +25,7 @@ type ExecutionRepo struct { func (r *ExecutionRepo) Create(ctx context.Context, input models.Execution, executionTagModel []*models.ExecutionTag) error { timer := r.metrics.CreateDuration.Start() err := r.db.WithContext(ctx).Transaction(func(_ *gorm.DB) error { - if executionTagModel != nil && len(executionTagModel) > 0 { + if len(executionTagModel) > 0 { tx := r.db.WithContext(ctx).Create(executionTagModel) if tx.Error != nil { return r.errorTransformer.ToFlyteAdminError(tx.Error) diff --git a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go index b11dbcbbdd..1b4068d4f1 100644 --- a/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go +++ b/flyteadmin/pkg/repositories/gormimpl/execution_repo_test.go @@ -44,6 +44,11 @@ func TestCreateExecution(t *testing.T) { Key: "hello", Value: "world", }, + { + ExecutionKey: executionKey, + Key: "rust", + Value: "", + }, }) assert.NoError(t, err) } diff --git a/flyteadmin/pkg/repositories/transformers/execution.go b/flyteadmin/pkg/repositories/transformers/execution.go index b1005f6512..1d4e317ad8 100644 --- a/flyteadmin/pkg/repositories/transformers/execution.go +++ b/flyteadmin/pkg/repositories/transformers/execution.go @@ -149,18 +149,22 @@ func CreateExecutionModel(input CreateExecutionModelInput) (*models.Execution, e // CreateExecutionTagModel transforms a CreateExecutionModelInput to a ExecutionTag model func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.ExecutionTag, error) { - tags := make([]*models.ExecutionTag, 0, len(input.RequestSpec.Labels.Values)) - for k, v := range input.RequestSpec.Labels.Values { - tags = append(tags, &models.ExecutionTag{ - ExecutionKey: models.ExecutionKey{ - Project: input.WorkflowExecutionID.Project, - Domain: input.WorkflowExecutionID.Domain, - Name: input.WorkflowExecutionID.Name, - }, - Key: k, - Value: v, - }) + tags := make([]*models.ExecutionTag, 0) + + if input.RequestSpec.Labels != nil { + for k, v := range input.RequestSpec.Labels.Values { + tags = append(tags, &models.ExecutionTag{ + ExecutionKey: models.ExecutionKey{ + Project: input.WorkflowExecutionID.Project, + Domain: input.WorkflowExecutionID.Domain, + Name: input.WorkflowExecutionID.Name, + }, + Key: k, + Value: v, + }) + } } + for _, v := range input.RequestSpec.Tags { tags = append(tags, &models.ExecutionTag{ ExecutionKey: models.ExecutionKey{ @@ -173,8 +177,6 @@ func CreateExecutionTagModel(input CreateExecutionModelInput) ([]*models.Executi }) } - logger.Infof(context.Background(), "tttttttttags [%v]", input.RequestSpec.Labels.Values) - return tags, nil } From 3a0c426f3bb10ba7f1b3dfbe9c9dc23bba21ee07 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 6 Jun 2024 19:15:23 -0700 Subject: [PATCH 13/15] lint Signed-off-by: Kevin Su --- flyteadmin/pkg/repositories/gormimpl/common.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/flyteadmin/pkg/repositories/gormimpl/common.go b/flyteadmin/pkg/repositories/gormimpl/common.go index 1a94a20328..40a54f8878 100644 --- a/flyteadmin/pkg/repositories/gormimpl/common.go +++ b/flyteadmin/pkg/repositories/gormimpl/common.go @@ -28,8 +28,6 @@ const taskExecutionTableName = "task_executions" const taskTableName = "tasks" const workflowTableName = "workflows" const descriptionEntityTableName = "description_entities" -const AdminTagsTableName = "admin_tags" -const executionAdminTagsTableName = "execution_admin_tags" const executionTagsTableName = "execution_tags" const limit = "limit" From 3b2e9a6ba5ddc1fd566f8ce3023b0e4385c580d3 Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Fri, 7 Jun 2024 14:13:19 -0700 Subject: [PATCH 14/15] address commet Signed-off-by: Kevin Su --- .../pkg/repositories/config/migrations.go | 94 +++++++++++-------- .../pkg/repositories/models/execution.go | 4 +- 2 files changed, 57 insertions(+), 41 deletions(-) diff --git a/flyteadmin/pkg/repositories/config/migrations.go b/flyteadmin/pkg/repositories/config/migrations.go index f9ad19ac93..a2b39000d2 100644 --- a/flyteadmin/pkg/repositories/config/migrations.go +++ b/flyteadmin/pkg/repositories/config/migrations.go @@ -1182,45 +1182,6 @@ var NoopMigrations = []*gormigrate.Migration{ return tx.AutoMigrate(&Execution{}) }, }, - - { - ID: "2024-06-06-execution-tags", - Migrate: func(tx *gorm.DB) error { - return tx.Transaction(func(_ *gorm.DB) error { - // Create an execution_tags Table - if err := tx.AutoMigrate(&models.ExecutionTag{}); err != nil { - return err - } - // Drop execution_admin_tags and admin_tags tables, and create a new table execution_tags - // to store tags associated with executions. - sql := "INSERT INTO execution_tags (execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, key, value)" + - " SELECT execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, name as key, null as value" + - " FROM execution_admin_tags" + - " INNER JOIN admin_tags a on execution_admin_tags.admin_tag_id = a.id;" - if err := tx.Exec(sql).Error; err != nil { - return err - } - return nil - }) - }, - Rollback: func(tx *gorm.DB) error { - return tx.Migrator().DropTable("execution_tags") - }, - }, - - { - ID: "2024-06-06-drop-execution_admin-tags", - Migrate: func(tx *gorm.DB) error { - return tx.Migrator().DropTable("execution_admin_tags") - }, - }, - - { - ID: "2024-06-06-drop-admin-tags", - Migrate: func(tx *gorm.DB) error { - return tx.Migrator().DropTable("admin_tags") - }, - }, } // ContinuedMigrations - Above are a series of migrations labeled as no-op migrations. These are migrations that we @@ -1261,6 +1222,61 @@ var ContinuedMigrations = []*gormigrate.Migration{ return tx.Table("launch_plans").Migrator().DropColumn(&models.LaunchPlan{}, "launch_condition_type") }, }, + + { + ID: "2024-06-06-execution-tags", + Migrate: func(tx *gorm.DB) error { + type ExecutionKey struct { + Project string `gorm:"primary_key;column:execution_project;size:255"` + Domain string `gorm:"primary_key;column:execution_domain;size:255"` + Name string `gorm:"primary_key;column:execution_name;size:255"` + } + + type ExecutionTag struct { + ID uint `gorm:"index;autoIncrement;not null"` + CreatedAt time.Time `gorm:"type:time"` + UpdatedAt time.Time `gorm:"type:time"` + DeletedAt *time.Time `gorm:"index"` + ExecutionKey + Key string `gorm:"primary_key;index:tag_key;size:255"` + Value string `gorm:"primary_key;index:tag_value;size:255"` + } + + return tx.Transaction(func(_ *gorm.DB) error { + // Create an execution_tags Table + if err := tx.AutoMigrate(&ExecutionTag{}); err != nil { + return err + } + // Drop execution_admin_tags and admin_tags tables, and create a new table execution_tags + // to store tags associated with executions. + sql := "INSERT INTO execution_tags (execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, key, value)" + + " SELECT execution_project, execution_domain, execution_name, created_at, updated_at, deleted_at, name as key, null as value" + + " FROM execution_admin_tags" + + " INNER JOIN admin_tags a on execution_admin_tags.admin_tag_id = a.id;" + if err := tx.Exec(sql).Error; err != nil { + return err + } + return nil + }) + }, + Rollback: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("execution_tags") + }, + }, + + { + ID: "2024-06-06-drop-execution_admin-tags", + Migrate: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("execution_admin_tags") + }, + }, + + { + ID: "2024-06-06-drop-admin-tags", + Migrate: func(tx *gorm.DB) error { + return tx.Migrator().DropTable("admin_tags") + }, + }, } var m = append(LegacyMigrations, NoopMigrations...) diff --git a/flyteadmin/pkg/repositories/models/execution.go b/flyteadmin/pkg/repositories/models/execution.go index 014311688c..a5f2a0b8ab 100644 --- a/flyteadmin/pkg/repositories/models/execution.go +++ b/flyteadmin/pkg/repositories/models/execution.go @@ -76,9 +76,9 @@ type ExecutionTag struct { BaseModel ExecutionKey // The key of the tag. - Key string `gorm:"primary_key" valid:"length(0|255)"` + Key string `gorm:"primary_key;size:255"` // The value of the tag. - Value string `gorm:"primary_key" valid:"length(0|255)"` + Value string `gorm:"primary_key;size:255"` } func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) { From 5684388de1593ede9c60df76669287210213b8cf Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Fri, 7 Jun 2024 14:17:59 -0700 Subject: [PATCH 15/15] nit Signed-off-by: Kevin Su --- flyteadmin/pkg/repositories/models/execution.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flyteadmin/pkg/repositories/models/execution.go b/flyteadmin/pkg/repositories/models/execution.go index a5f2a0b8ab..f148c95faf 100644 --- a/flyteadmin/pkg/repositories/models/execution.go +++ b/flyteadmin/pkg/repositories/models/execution.go @@ -76,9 +76,9 @@ type ExecutionTag struct { BaseModel ExecutionKey // The key of the tag. - Key string `gorm:"primary_key;size:255"` + Key string `gorm:"primary_key;index:tag_key;size:255"` // The value of the tag. - Value string `gorm:"primary_key;size:255"` + Value string `gorm:"primary_key;index:tag_key;size:255"` } func (b *AdminTag) BeforeCreate(tx *gorm.DB) (err error) {