def pipeline(my_pipe_param: list = [100, 200], my_pipe_param3: list = [1, 2]): loop_args = [{'a': 1, 'b': 2}, {'a': 10, 'b': 20}] with Loop(loop_args).enumerate() as (i, item): # 2 iterations in total op1_template = components.load_component_from_text(op1_yaml) op1 = op1_template(index=i, item=item.a) with dsl.ParallelFor(my_pipe_param) as inner_item: # 4 iterations in total op11_template = components.load_component_from_text(op11_yaml) op11 = op11_template(item.a, inner_item) my_pipe_param2: List[int] = [4, 5] with Loop(my_pipe_param2).enumerate() as (j, inner_item): # 8 iterations in total op12_template = components.load_component_from_text(op12_yaml) op12 = op12_template(outter_index=i, index=j, item=item.b, inner_item=inner_item) with dsl.ParallelFor(my_pipe_param3) as inner_item: # 16 iterations in total op13_template = components.load_component_from_text( op13_yaml) op13 = op13_template(item.b, inner_item) op2_template = components.load_component_from_text(op2_yaml) op2 = op2_template(item.b)
def pipeline(my_pipe_param: int = 10, start: int = 1, end: int = 2): start_2 = 1 end_2 = 2 with Loop.range(start=start, end=end) as item: op1_template = components.load_component_from_text(op1_yaml) op1_template(item, my_pipe_param) with Loop.range(start=start_2, end=end_2) as item2: op1_template(item2, my_pipe_param)
def pipeline(my_pipe_param: int = 10): loop_args = '1,2' with Loop.from_string(loop_args, separator=',') as item: op1_template = components.load_component_from_text(op1_yaml) op1_template(item, my_pipe_param)
def pipeline(): source_task = produce_op() with Loop(source_task.outputs['data_list']).enumerate() as (i, item): consume_op(iter=i, data=item)
def loop_empty(start: int = 0, end: int = 5): with Loop.range(start, end): pass
def separator_from_task(): text = PrintOp("text", "a,b,c").output separator = PrintOp("separator", ",").output with Loop.from_string(text, separator): PrintOp("print")
def separator_from_param(text: str = 'a,b,c', separator: str = ','): with Loop.from_string(text, separator): PrintOp("print")