From 5add08ea0590be244f5d76ff06808228cc1bd9af Mon Sep 17 00:00:00 2001 From: jingzhang36 Date: Wed, 12 Feb 2020 15:30:59 +0800 Subject: [PATCH] Set auto-added artifacts optional in recurring run (job) (#3041) * Set auto-added artifacts optional in recurring run (job) * Remove out-of-date TODOs. --- backend/src/apiserver/resource/resource_manager.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/src/apiserver/resource/resource_manager.go b/backend/src/apiserver/resource/resource_manager.go index 22dc2b666756..7f9e5893c7d0 100644 --- a/backend/src/apiserver/resource/resource_manager.go +++ b/backend/src/apiserver/resource/resource_manager.go @@ -295,7 +295,6 @@ func (r *ResourceManager) CreateRun(apiRun *api.Run) (*model.RunDetail, error) { // Marking auto-added artifacts as optional. Otherwise most older workflows will start failing after upgrade to Argo 2.3. // TODO: Fix the components to explicitly declare the artifacts they really output. - // TODO: Change the compiler to stop auto-adding those two atrifacts to all tasks. for templateIdx, template := range workflow.Workflow.Spec.Templates { for artIdx, artifact := range template.Outputs.Artifacts { if artifact.Name == "mlpipeline-ui-metadata" || artifact.Name == "mlpipeline-metrics" { @@ -535,6 +534,17 @@ func (r *ResourceManager) CreateJob(apiJob *api.Job) (*model.Job, error) { }, }, } + + // Marking auto-added artifacts as optional. Otherwise most older workflows will start failing after upgrade to Argo 2.3. + // TODO: Fix the components to explicitly declare the artifacts they really output. + for templateIdx, template := range scheduledWorkflow.Spec.Workflow.Spec.Templates { + for artIdx, artifact := range template.Outputs.Artifacts { + if artifact.Name == "mlpipeline-ui-metadata" || artifact.Name == "mlpipeline-metrics" { + scheduledWorkflow.Spec.Workflow.Spec.Templates[templateIdx].Outputs.Artifacts[artIdx].Optional = true + } + } + } + newScheduledWorkflow, err := r.scheduledWorkflowClient.Create(scheduledWorkflow) if err != nil { return nil, util.NewInternalServerError(err, "Failed to create a scheduled workflow for (%s)", scheduledWorkflow.Name)