clearml icon indicating copy to clipboard operation
clearml copied to clipboard

clearml pipeline demo missing execution queue, no default queue defined and no specific node queue defined

Open mullerhai opened this issue 2 years ago • 2 comments

HI

 when I  want to run the  demo  apply by our web doc  office ,
from clearml.automation.controller import PipelineDecorator,CreateFromFunction,PipelineController
from clearml import TaskTypes


@PipelineDecorator.component(return_values=['data_frame'], cache=True, task_type=TaskTypes.data_processing)
def step_one(pickle_data_url: str, extra: int = 43):
    import sklearn  # noqa
    import pickle
    import pandas as pd
    from clearml import StorageManager
    local_iris_pkl = StorageManager.get_local_copy(remote_url=pickle_data_url)
    with open(local_iris_pkl, 'rb') as f:
        iris = pickle.load(f)
    data_frame = pd.DataFrame(iris['data'], columns=iris['feature_names'])
    data_frame.columns += ['target']
    data_frame['target'] = iris['target']
    return data_frame

@PipelineDecorator.component(
  return_values=['X_train, X_test, y_train, y_test'], cache=True, task_type=TaskTypes.data_processing)
def step_two(data_frame, test_size=0.21, random_state=421):
    import pandas as pd  # noqa
    from sklearn.model_selection import train_test_split
    y = data_frame['target']
    X = data_frame[(c for c in data_frame.columns if c != 'target')]
    X_train, X_test, y_train, y_test = train_test_split(
        X, y, test_size=test_size, random_state=random_state)
    return X_train, X_test, y_train, y_test

@PipelineDecorator.component(return_values=['model'], cache=True, task_type=TaskTypes.training)
def step_three(X_train, y_train):
    print('step_three')
    # make sure we have pandas for this step, we need it to use the data_frame
    import pandas as pd  # noqa
    from sklearn.linear_model import LogisticRegression
    model = LogisticRegression(solver='liblinear', multi_class='auto')
    model.fit(X_train, y_train)
    return model

@PipelineDecorator.component(return_values=['accuracy'], cache=True, task_type=TaskTypes.qc)
def step_four(model, X_data, Y_data):
    from sklearn.linear_model import LogisticRegression  # noqa
    from sklearn.metrics import accuracy_score
    Y_pred = model.predict(X_data)
    return accuracy_score(Y_data, Y_pred, normalize=True)

@PipelineDecorator.pipeline(name='pipeline', project='examples', version='0.1')
def main(pickle_url, mock_parameter='mock'):
    data_frame = step_one(pickle_url)
    X_train, X_test, y_train, y_test = step_two(data_frame)
    model = step_three(X_train, y_train)
    accuracy = 100 * step_four(model, X_data=X_test, Y_data=y_test)
    print(f"Accuracy={accuracy}%")

meet the error

ValueError: Node 'step_one' missing execution queue, no default queue defined and no specific node queue defined I dont know where to define the execution queue?

mullerhai avatar Mar 11 '22 03:03 mullerhai

I've reproduced the issue. And It can be solved by using this method PipelineDecorator.set_default_execution_queue('default'), here's the doc link for the method's usecase. You can also check out this example pipeline_from_decorator.py

Rizwan-Hasan avatar Mar 20 '22 17:03 Rizwan-Hasan

I've reproduced the issue. And It can be solved by using this method PipelineDecorator.set_default_execution_queue('default'), here's he doc link for the method's usecase. You can also check out this example pipeline_from_decorator.py

thank you,I will try again

mullerhai avatar Mar 21 '22 08:03 mullerhai