flytekit
flytekit copied to clipboard
Real time deck support
TL;DR
This PR adds real-time deck support.
After this PR, User can use flytekit.Deck.persist()
to generate the html based on current collected metrics/information. So that user can see the real time deck even the task is running or has already failed. See the below example:
import flytekit
from flytekit import Resources, task, workflow
from flytekit.core.utils import timeit
@task(
disable_deck=False,
limits=Resources(mem="4Gi", cpu="1"),
)
def t1():
import time
for i in range(2):
# timeit measure the time used in the block and shown in time line deck. See https://github.com/flyteorg/flytekit/pull/1581.
# Or you can add information to your own deck. See https://docs.flyte.org/projects/cookbook/en/latest/auto/core/flyte_basics/deck.html.
with timeit(f"iteration {i}"):
time.sleep(50)
flytekit.Deck.persist()
@workflow
def wf():
t1()
if __name__ == "__main__":
wf()
real time deck support includes:
- flytekit: https://github.com/flyteorg/flytekit/pull/1704
- flyteadmin: https://github.com/flyteorg/flyteadmin/pull/579
- flytepropeller: https://github.com/flyteorg/flytepropeller/pull/579
- flyteconsole: https://github.com/flyteorg/flyteconsole/pull/781
Type
- [ ] Bug Fix
- [x] Feature
- [ ] Plugin
Are all requirements met?
- [ ] Code completed
- [ ] Smoke tested
- [ ] Unit tests added
- [ ] Code documentation added
- [ ] Any pending items have an associated Issue
Just realizing we could use this feature to solve this problem: provide the ability to display links to e.g. wandb runs which are generated at runtime before the task ends 🎉
This also solves the problem with eager mode, i.e. we can re-render the Flyte deck of subtasks being kicked-off by the eager workflow in real-time.
How does this effort here relate to the discussion in https://github.com/flyteorg/flyte/discussions/3838 btw? (cc @hamersaw)
@fg91 yeah, this is one of the issues that is effectively blocked, I would rather merge this with a re-usable flytekit -> flytepropeller communication mechanism.