Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): support yaml with platform-specific specs #8983

Merged
merged 7 commits into from
Mar 15, 2023

Conversation

Linchin
Copy link
Contributor

@Linchin Linchin commented Mar 13, 2023

Description of your changes:

  • Backend reads the additional YAML documents with platform specific specs
  • Added tests to verify that backend reads the yaml correctly
  • Moved pipeline string for template testing into a file

Fixes #8758
Checklist:

go.mod Outdated Show resolved Hide resolved
Copy link
Member

@gkcalat gkcalat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Linchin!

I left a few comments (some of them may be important)

@chensun chensun changed the title (feat)backend: support yaml with platform-specific specs feat(backend): support yaml with platform-specific specs Mar 14, 2023
@google-oss-prow google-oss-prow bot added size/XL and removed size/L labels Mar 14, 2023
@Linchin
Copy link
Contributor Author

Linchin commented Mar 14, 2023

/test kubeflow-pipeline-backend-test

@Linchin Linchin requested a review from gkcalat March 14, 2023 23:55
@gkcalat
Copy link
Member

gkcalat commented Mar 15, 2023

/lgtm

Thank you, @Linchin!

@google-oss-prow google-oss-prow bot added the lgtm label Mar 15, 2023
assert.Equal(t, expectedTemplate, templateV2Spec)
}

func TestNewTemplate_WithExecutorConfig(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: WithPlatformSpec? Cause IR contains executor config, also the message is called PlatformSpec:

message PlatformSpec {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I will rename the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

return nil, util.NewInvalidInputErrorWithDetails(ErrorInvalidPipelineSpec, "invalid v2 pipeline spec: root component is empty")
}
v2Spec.spec = &spec
} else if isKubernetesExecutorConfig(valueBytes) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again on the naming, maybe PlatformSpec instead of ExecutorConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I just updated it.

@@ -217,3 +271,16 @@ func (t *V2Spec) RunWorkflow(modelRun *model.Run, options RunWorkflowOptions) (u
executionSpec.SetPodMetadataLabels(util.LabelKeyWorkflowRunId, options.RunId)
return executionSpec, nil
}

func isKubernetesExecutorConfig(template []byte) bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should check for key == kubernetes, there could be other platform specs in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of making sure the kubernetes exists? As we allow pipeline spec without platform spec here, we can probably let it pass with a non-kubernetes platform spec. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to make sure kubernetes exists, but we do need to prevent mis-recognize other platform specs as kubernetes spec. The current change in the PR would treat any platform spec as kubernetes spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question that may be unrelated: should we keep all platforms' configs in memory, or only pick out the k8s related one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a check for the key "Kubernetes".

@google-oss-prow google-oss-prow bot removed the lgtm label Mar 15, 2023
@Linchin
Copy link
Contributor Author

Linchin commented Mar 15, 2023

/test kubeflow-pipeline-backend-test

@Linchin Linchin requested a review from chensun March 15, 2023 18:31
if err != nil {
return false
}
_, ok := platformSpec.Platforms["kubernetes"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name should match what it checks, per this line of code, only kubernetes platform spec should return True, if that's the intention, the function name should reflect kubernetes as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I just updated the function name.

Copy link
Member

@chensun chensun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

Thanks!

@google-oss-prow google-oss-prow bot added the lgtm label Mar 15, 2023
@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chensun

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit a9ead5a into kubeflow:master Mar 15, 2023
rd-pong pushed a commit to rd-pong/pipelines that referenced this pull request Apr 26, 2023
* support yaml with platform-specific info

* run go mod tidy and fix comments

* license, test and small fixes

* fix integration test and add test

* address comments

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(backend): Accept pipeline YAML that contains platform-specific sections
3 participants