Skip to content

Commit

Permalink
Set auto-added artifacts optional in recurring run (job) (kubeflow#3041)
Browse files Browse the repository at this point in the history
* Set auto-added artifacts optional in recurring run (job)

* Remove out-of-date TODOs.
  • Loading branch information
jingzhang36 authored and Jeffwan committed Dec 9, 2020
1 parent 90c0f06 commit 5add08e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5add08e

Please sign in to comment.