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.