Closed grimmJ04 closed 1 year ago
Hi @grimmJ04 , thanks for the detailed description - we're trying to reproduce
Hi @grimmJ04 ! We were able to replicate this issue.
This happens because of internals. Notice the way you need decorate your steps: PipelineDecorator.component()
. component
is actually a function that does more than transform your function into a task, it also adds various information to the controller. That information is mostly relevant when running remotely.
Because you import your steps here (in the controller, after the controller is created):
@PipelineDecorator.pipeline(name='pipeline demo', project='examples', version='0.1.5', **env_config)
def executing_pipeline(seed=42, random_state=42, test_size=0.2):
print('pipeline args:', dict(seed=seed, random_state=random_state, test_size=test_size))
print('launch step one')
from pipelines.components._demo.comp import step_one
that information is lost :(.
Anyway, the point is: try importing your steps as the first import in the file, such that component()
is called before pipeline()
:
# here
from pipelines.components._demo.comp import step_one, step_two, step_three
from clearml.automation.controller import PipelineDecorator
try:
from pipelines._config import ENV_CONFIG
except ImportError:
import sys
from pathlib import Path
# other stuff
Thank you! That really solved my problem. I'm closing this issue.
Describe the bug
Based on the online documentation for Pipelines from Decorators, one can have a minimalistic example like the one presented in pipeline_from_decorator.py.
However, if I try to place the functions decorated with @PipelineDecorator.component inside another python file in a different directory, I get the following error when trying to re-run the experiment from the web-ui, using the + NEW RUN button.
Note that, when run from console, or IDE, the pipeline runs just fine at first. One can wait for the pipeline execution to complete, clone it, make a draft, etc... However, I am not able to re-run this experiment using different, or even the same parameters, due to the error above.
My goal is for my pipeline components is to be reusable. However, this bug(?) prevents me from doing so.
To reproduce
Folder structure
_config.py
pipeline_demo.py
comp.py
Steps to reproduce:
Expected behaviour
I would expect the experiment to run the same way the second time, without errors. Note that, this is true, when the pipeline and its components are in the same file, but not when they are in separate files.
Environment