Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to create pipeline step as draft task #1226

Merged
merged 1 commit into from Mar 10, 2024

Conversation

CharlesFrankum
Copy link
Contributor

Patch Description

Added an option to allow the end user to create a pipeline step as a draft instead of it being automatically enqueued. This enables us to create pipelines where the parameters can be edited by a user before execution i.e. selecting the models to run in a testing step which can only be known once the training step has completed.

Testing Instructions

from clearml import PipelineController


def func(user_input):
    print('This step has been executed!')
    return user_input


if __name__ == '__main__':
    pipe = PipelineController(
        name='development',
        project='testing',
        version='0.1',
    )
    pipe.add_function_step(
        name='run_immediately',
        function=func,
        function_kwargs={'user_input': 'Hello World!'},
        function_return=['user_input'],
    )
    pipe.add_function_step(
        name='draft',
        function=func,
        function_kwargs={'user_input': 'Hello World!'},
        function_return=['user_input'],
        parents=['run_immediately'],
        draft=True,
    )
    pipe.add_function_step(
        name='wait_for_draft',
        function=func,
        function_kwargs={'user_input': 'Hello World!'},
        function_return=['user_input'],
        parents=['draft'],
    )
    pipe.start()
from clearml import PipelineDecorator


@PipelineDecorator.component(
    name='run_immediately',
    return_values=['user_input'],
)
def step_1(user_input='Hello World!'):
    print('This step has been executed!')
    return user_input

@PipelineDecorator.component(
    name='draft',
    return_values=['user_input'],
    draft=True,
    parents=['run_immediately'],
)
def step_2(user_input='Hello World!'):
    print('This step has been executed!')
    return user_input

@PipelineDecorator.component(
    name='wait_for_draft',
    return_values=['user_input'],
    parents=['draft'],
)
def step_3(user_input='Hello World!'):
    print('This step has been executed!')
    return user_input

@PipelineDecorator.pipeline(
    name='development',
    project='testing',
    version='0.1',
)
def main():
    step_1()
    step_2()
    step_3()

if __name__ == '__main__':
    main()

@jkhenning jkhenning merged commit 2ac637b into allegroai:master Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants