allegroai / clearml

ClearML - Auto-Magical CI/CD to streamline your AI workload. Experiment Management, Data Management, Pipeline, Orchestration, Scheduling & Serving in one MLOps/LLMOps solution

Home Page:https://clear.ml/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding a non-clearml decorated function to PipelineController with add_function_step fails

jmw52 opened this issue · comments

Describe the bug

When adding a decorated function, a custom decorator, to a PipelineController with add_function_step, the created code for the pipeline step is wrongly indented and hence the step fails.

To reproduce

from clearml import PipelineController


def my_decorator(func):
    def wrapped(*args, **kwargs):
        print("Before func")
        response = func(*args, **kwargs)
        print("After func")
        return response

    return wrapped


@my_decorator
def step_one():
    print("Step one")


if __name__ == "__main__":

    pipe = PipelineController(
        project="debug",
        name="debug-pipeline",
    )

    pipe.add_function_step(
        name="step_one",
        function=step_one,
    )

    pipe.start_locally(run_pipeline_steps_locally=True)

produces

  File "/tmp/tmp8cgv_os2.py", line 11
    def wrapped(*args, **kwargs):
IndentationError: unexpected indent

Expected behaviour

Properly formatted pipeline step code.

Thanks for reporting @jmw52,

We'll update when a fix becomes available.

Hey @jmw52! This issue has been resolved. v1.14.0 is now out supporting custom decorated pipeline steps.