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

[SDK-compiler] Refactor Compiler to expose an API to write out yaml spec of pipeline. #2146

Merged

Conversation

numerology
Copy link

@numerology numerology commented Sep 17, 2019

This change will unblock customize file extension issue in tfx.


This change is Reviewable

def compile(self, pipeline_func, package_path, type_check=True):
"""Compile the given pipeline function into workflow yaml.
@staticmethod
def write_workflow(workflow: Dict[Text, Any], package_path: Text = None):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this method should be public.

Copy link
Author

Choose a reason for hiding this comment

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

I think here we have two options:

  1. We can expose this API so that TFX side can use it to dump workflow spec to arbitrary format, or;
  2. we can duplicate this part of logic to TFX's code base, which should not be a very serious problem because this is not very KFP-specific function. It's just a yaml dump utility.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that the Compiler user should not see or handle the compiled pipeline code dictionary. If this is the case, then the user never has anything they can pass to the write_workflow method. Thus, I think, it should be private.
What are the cases where TFX code might want to run write_workflow, but not compile? Can they call private function/method?

Copy link
Author

Choose a reason for hiding this comment

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

I think that the Compiler user should not see or handle the compiled pipeline code dictionary. If this is the case, then the user never has anything they can pass to the write_workflow method. Thus, I think, it should be private.
What are the cases where TFX code might want to run write_workflow, but not compile? Can they call private function/method?

See here. Currently TFX is calling create_workflow in order to plug in PipelineParam dynamically. I think they can call private function if bypass the lint check.

Copy link
Contributor

Choose a reason for hiding this comment

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

Currently TFX is calling create_workflow

Maybe create_workflow should write the pipeline package the same way the compile does?

Copy link
Author

Choose a reason for hiding this comment

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

That's a good suggestion. Will let you know once I'm done. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, I'm in favor of extracting the _write_workflow function. I just think that it should be private.

@Ark-kun
Copy link
Contributor

Ark-kun commented Oct 1, 2019

Some thoughts about possible solution to the create_workflow and write_wiorkflow:

  1. Add private _write_workflow
  2. Move the implementation of create_workflow to private _create_workflow while keeping the create_workflow facade.
  3. Add _create_and_write_workflow which calls _create_workflow + _write_workflow. Add comment pointing to TFX use site
  4. Switch TFX to _create_and_write_workflow
  5. Deprecate create_workflow
  6. After several releases, remove create_workflow

@k8s-ci-robot k8s-ci-robot added size/L and removed size/M labels Oct 3, 2019
numerology added 3 commits October 2, 2019 22:04
…xtract-api-to-writeout-workflow-spec

� Conflicts:
�	sdk/python/kfp/compiler/compiler.py
@Ark-kun
Copy link
Contributor

Ark-kun commented Oct 3, 2019

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Ark-kun

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

@k8s-ci-robot k8s-ci-robot merged commit 9a9bd90 into kubeflow:master Oct 3, 2019
@numerology numerology deleted the extract-api-to-writeout-workflow-spec branch October 4, 2019 22:18
magdalenakuhn17 pushed a commit to magdalenakuhn17/pipelines that referenced this pull request Oct 22, 2023
Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>
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.

6 participants