Skip to content

Commit

Permalink
Allow adding pipeline with name and description. (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
neuromage authored and k8s-ci-robot committed Apr 13, 2019
1 parent af9d48a commit 7043862
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sdk/python/kfp/dsl/_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def my_pipeline(a: PipelineParam, b: PipelineParam):
def _pipeline(func):
func._pipeline_name = name
func._pipeline_description = description
Pipeline.add_pipeline(func)
Pipeline._add_pipeline_to_global_list(func)
return func

return _pipeline
Expand Down Expand Up @@ -97,10 +97,17 @@ def get_pipeline_functions():
return Pipeline._pipeline_functions

@staticmethod
def add_pipeline(func):
def _add_pipeline_to_global_list(func):
"""Add a pipeline function (decorated with @pipeline)."""
Pipeline._pipeline_functions.append(func)

@staticmethod
def add_pipeline(name, description, func):
"""Add a pipeline function with the specified name and description."""
# Applying the @pipeline decorator to the pipeline function
func = pipeline(name=name, description=description)(func)
Pipeline._add_pipeline_to_global_list(pipeline_meta, func)

def __init__(self, name: str):
"""Create a new instance of Pipeline.
Expand All @@ -124,7 +131,7 @@ def __enter__(self):

def __exit__(self, *args):
Pipeline._default_pipeline = None

def add_op(self, op: _container_op.ContainerOp, define_only: bool):
"""Add a new operator.
Expand Down

0 comments on commit 7043862

Please sign in to comment.