Add decorator to component decorator in KFP v2 in Vertex AI

235 views Asked by At

Usually, KFP v2 supports adding a component decorator like this:

@component
def test():
  print("hello world")

I would like to add an additional decorator to add new functionality like this:

@component
@added_functionality
def test():
  print("hello world")

Where added_functionality is imported and looks like this:

from functools import wraps

def added_functionality(func):
  print("starting added functionality")

  @wraps(func)
  def wrapper(*args, **kwargs):
    print("starting wrapper")
    return func(*args, **kwargs)

  return wrapper

The issue is that when I compile the pipeline, I see 'starting added functionality' printed to the console, but "starting wrapper" doesn't show up in the log in Vertex AI. Am I doing something wrong?

1

There are 1 answers

0
John R On

You aren't. This is a disappointing limitation of Kubeflow currently.