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(sdk): Implement Pipeline Configuration with TTL #11269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rimolive
Copy link
Member

@rimolive rimolive commented Oct 3, 2024

Description of your changes:
This PR introduces a new class PipelineConfig in KFP SDK to add pipeline-specific configurations with the first one: Pipeline TTL.

Testing instructions

SDK

  • Create a Python virtualenv and install the SDK and IR YAML API packages locally
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install wheel setuptools
$ pip install -r sdk/python/requirements-dev.txt
$ pip install -e api/v2alpha1/python
$ pip install -e sdk/python
$ kfp dsl compile --py main.py --output main.yaml
  • You should be able to compile and find the following snippet in the main.yaml file:
---
platforms:
  kubernetes:
    pipelineConfig:
      pipelineTtl: 60

Checklist:

pipeline_config_json = json_format.ParseDict(
{'pipelineConfig': {
'pipelineTtl': pipelineConfig.get_ttl(),
}}, platformSpec.platforms['kubernetes'])
Copy link
Contributor

Choose a reason for hiding this comment

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

@chensun the SDK code part of this PR correctly compiles and generates the Yaml IR as per the requirements we decided upon here.

Code: https://gist.github.com/rimolive/e0c31ccad1f6c963ec010c455b424afe
resulting IR yaml: https://gist.github.com/rimolive/fc900c8172e661a470a6890555159f97

Could you confirm that the hard coded specification of kubernetes platform here would work? Does the platform key in the IR always stay the same, i.e., kubernetes, or is it customized (to have it set as vertex, for example)? If yes, then we can look into having this key dynamically specified and inserted here.

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I fully understand the question. The key is hard coded for individual platforms, and the platform backend is expected to look after the key they recognize and ignore the ones they don't. For instance, the KFP backend extracts only kubernetes key:

// Pick out Kubernetes platform configs
var kubernetesSpec *pipelinespec.SinglePlatformSpec
if t.platformSpec != nil {
if _, ok := t.platformSpec.Platforms["kubernetes"]; ok {
kubernetesSpec = t.platformSpec.Platforms["kubernetes"]
}
}

The specific feature you're adding here, TTL, doesn't apply to Vertex. So what you have in the code and IR links look good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for clarifying @chensun !

Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign connor-mccarthy for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@github-actions github-actions bot added the ci-passed All CI tests on a pull request have passed label Nov 1, 2024
@rimolive rimolive changed the title WIP feat(backend + sdk): Implement Pipeline Configuration with TTL feat(sdk): Implement Pipeline Configuration with TTL Nov 4, 2024
@VaniHaripriya
Copy link
Contributor

Verified the changes and was able to generate main.yaml with the below fields:

---
platforms:
  kubernetes:
    pipelineConfig:
      pipelineTtl: 60

@rimolive
Copy link
Member Author

rimolive commented Nov 6, 2024

Hold this PR until we get full implementation.

/hold

@github-actions github-actions bot added ci-passed All CI tests on a pull request have passed and removed ci-passed All CI tests on a pull request have passed labels Nov 6, 2024
@@ -17,7 +17,9 @@
class PipelineConfig:
"""PipelineConfig contains pipeline-level config options."""

def __init__(self):
pass
def __init__(self, ttl=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

would suggest adding a test to ensure compiled IR yaml has ttl fields as expected. Could use this test as a reference.

@hbelmiro
Copy link
Contributor

@rimolive is it still a WIP?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-passed All CI tests on a pull request have passed do-not-merge/hold size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants