Exemple #1
0
def my_pipeline(loop_parameter: list = [
    {
        "p_a": [{
            "q_a": 1
        }, {
            "q_a": 2
        }],
        "p_b": "hello",
    },
    {
        "p_a": [{
            "q_a": 11
        }, {
            "q_a": 22
        }],
        "p_b": "halo",
    },
]):
    # Nested loop with withParams loop args
    with dsl.ParallelFor(loop_parameter) as item:
        with dsl.ParallelFor(item.p_a) as item_p_a:
            print_op(item_p_a.q_a)

    # Nested loop with withItems loop args
    with dsl.ParallelFor([1, 2]) as outter_item:
        print_op(outter_item)
        with dsl.ParallelFor([100, 200, 300]) as inner_item:
            print_op(outter_item, inner_item)
def my_pipeline(loop_parameter: list = [
    {
        "p_a": [{
            "q_a": '1'
        }, {
            "q_a": '2'
        }],
        "p_b": "hello",
    },
    {
        "p_a": [{
            "q_a": '11'
        }, {
            "q_a": '22'
        }],
        "p_b": "halo",
    },
]):
    # Nested loop with withParams loop args
    with dsl.ParallelFor(loop_parameter) as item:
        with dsl.ParallelFor(item.p_a) as item_p_a:
            print_op(msg=item_p_a.q_a)

    # Nested loop with withItems loop args
    with dsl.ParallelFor(['1', '2']) as outter_item:
        print_op(msg=outter_item)
        with dsl.ParallelFor(['100', '200', '300']) as inner_item:
            print_op(msg=outter_item, msg2=inner_item)
Exemple #3
0
def my_pipeline(name: str = 'KFP'):
    print_task = print_op('Hello {}'.format(name))
    print_op('{}, again.'.format(print_task.output))

    new_value = f' and {name}.'
    with dsl.ParallelFor([1, 2]) as item:
        print_op2(item, new_value)
Exemple #4
0
def my_pipeline(name: str = 'KFP'):
    print_task = print_op(text='Hello {}'.format(name))
    print_op(text='{}, again.'.format(print_task.output))

    new_value = f' and {name}.'
    with dsl.ParallelFor(['1', '2']) as item:
        print_op2(text1=item, text2=new_value)
def my_pipeline(
    msg: str = 'hello',
    loop_parameter: list = [
        {
            'A_a': 'heads',
            'B_b': ['A', 'B'],
        },
        {
            'A_a': 'tails',
            'B_b': ['X', 'Y', 'Z'],
        },
    ],
):

    flip = flip_coin_op()
    outter_args_generator = args_generator_op()

    with dsl.Condition(flip.output != 'no-such-result'):  # always true

        inner_arg_generator = args_generator_op()

        with dsl.ParallelFor(outter_args_generator.output) as item:

            print_op(msg)

            with dsl.Condition(item.A_a == 'heads'):
                print_op(item.B_b)

            with dsl.Condition(flip.output == 'heads'):
                print_op(item.B_b)

            with dsl.Condition(item.A_a == 'tails'):
                with dsl.ParallelFor([{'a': '-1'}, {'a': '-2'}]) as inner_item:
                    print_op(inner_item)

            with dsl.ParallelFor(item.B_b) as item_b:
                print_op(item_b)

            with dsl.ParallelFor(loop_parameter) as pipeline_item:
                print_op(pipeline_item)

                with dsl.ParallelFor(inner_arg_generator.output) as inner_item:
                    print_op(pipeline_item, inner_item.A_a)

            with dsl.ParallelFor(['1', '2']) as static_item:
                print_op(static_item)

                with dsl.Condition(static_item == '1'):
                    print_op('1')

    # Reference loop item from grand child
    with dsl.ParallelFor(loop_parameter) as item:
        with dsl.Condition(item.A_a == 'heads'):
            with dsl.ParallelFor(item.B_b) as item_b:
                print_op(item_b)
Exemple #6
0
def my_pipeline(
        greeting: str = 'this is a test for looping through parameters'):
    print_task = print_op(text=greeting)

    generate_task = generate_op()
    with dsl.ParallelFor(generate_task.output) as item:
        concat_task = concat_op(a=item.a, b=item.b)
        concat_task.after(print_task)
        print_task_2 = print_op(text=concat_task.output)
def my_pipeline(
    static_loop_arguments: List[dict] = _DEFAULT_LOOP_ARGUMENTS,
    greeting: str = 'this is a test for looping through parameters',
):
    print_task = print_op(text=greeting)

    with dsl.ParallelFor(static_loop_arguments) as item:
        concat_task = concat_op(a=item.a, b=item.b)
        concat_task.after(print_task)
        print_task_2 = print_op(text=concat_task.output)
Exemple #8
0
def my_pipeline(loop_parameter: List[str]):

    # Loop argument is from a pipeline input
    with dsl.ParallelFor(loop_parameter) as item:
        print_op(item)

    # Loop argument is from a component output
    args_generator = args_generator_op()
    with dsl.ParallelFor(args_generator.output) as item:
        print_op(item)
        print_op(item.A_a)
        print_op(item.B_b)

    # Loop argument is a static value known at compile time
    loop_args = [{'A_a': '1', 'B_b': '2'}, {'A_a': '10', 'B_b': '20'}]
    with dsl.ParallelFor(loop_args) as item:
        print_op(item)
        print_op(item.A_a)
        print_op(item.B_b)
Exemple #9
0
def my_pipeline():

  args_generator = args_generator_op()
  with dsl.ParallelFor(args_generator.output) as item:
    print_op(item)
 def my_pipeline():
     loop_args = [{'A_a': 1, 'B_b': 2}, {'A_a': 10, 'B_b': 20}]
     with dsl.ParallelFor(loop_args, parallelism=10) as item:
         print_op(item)
         print_op(item.A_a)
         print_op(item.B_b)
def my_pipeline(loop_arguments: List[float] = [1.1, 2.2, 3.3]):

    with dsl.ParallelFor(loop_arguments) as item:
        print_op(item)
Exemple #12
0
        def my_pipeline(text: bool):
            with dsl.ParallelFor(['a, b']):
                producer_task = producer_op()

            dummy_op(msg=producer_task.output)
def my_pipeline():
    output_metrics()

    with dsl.ParallelFor([1, 2]) as item:
        output_metrics()