Skip to content

Commit

Permalink
Added section on overriding lp config in loop (#5223)
Browse files Browse the repository at this point in the history
* Added section on overriding lp config in loop

Signed-off-by: pryce-turner <[email protected]>

* Update docs/user_guide/advanced_composition/nested_parallelization.md

Co-authored-by: Nikki Everett <[email protected]>
Signed-off-by: pryce-turner <[email protected]>

---------

Signed-off-by: pryce-turner <[email protected]>
Signed-off-by: pryce-turner <[email protected]>
Co-authored-by: Nikki Everett <[email protected]>
  • Loading branch information
pryce-turner and neverett authored Apr 15, 2024
1 parent 3004af4 commit d0ed6c4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/user_guide/advanced_composition/nested_parallelization.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ def multi_wf(l: typing.List[int], chunk: int) -> typing.List[int]:
return level1(l=l, chunk=chunk)
```

Overrides let you add additional arguments to the launch plan you are looping over in the dynamic. Here we add caching:

```python
@task
def increment(num: int) -> int:
return num + 1

@workflow
def child(num: int) -> int:
return increment(num=num)

child_lp = LaunchPlan.get_or_create(child)

@dynamic
def spawn(n: int) -> List[int]:
l = []
for i in [1,2,3,4,5]:
l.append(child_lp(num=i).with_overrides(cache=True, cache_version="1.0.0"))
# you can also pass l to another task if you want
return l
```

### Flyte console

Expand Down

0 comments on commit d0ed6c4

Please sign in to comment.