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

[wip][Flyte Deck] Streaming Decks #2779

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
add dummy deck
Signed-off-by: Future-Outlier <eric901201@gmail.com>
  • Loading branch information
Future-Outlier committed Oct 2, 2024
commit 4e92bb0ad1cb55c9b6288533525359b0182d0e72
38 changes: 37 additions & 1 deletion flytekit/deck/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,40 @@

OUTPUT_DIR_JUPYTER_PREFIX = "jupyter"
DECK_FILE_NAME = "deck.html"

DUMMY_DECK = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will make it automatically refresh the page.. probably need that on the empty deck but not sure how to do the realtime behavior once it has content (you don't want to refresh while the user is browsing around or clicking through various tabs)

Suggested change
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="refresh" content="5" >

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COOL, will try it, thank you

<title>Flytekit Status</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f0f0f0;
}
.message {
background-color: #ffffff;
padding: 20px;
border: 1px solid #cccccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
</style>
</head>
<body>
<div class="message">
<p> Flyte decks have not been created yet. </p>
</div>
</body>
</html>
"""

class DeckField(str, enum.Enum):
"""
Expand Down Expand Up @@ -164,6 +197,9 @@ def _get_deck(
# The renderer must ensure that the HTML is safe.
body_htmls.append(f"<div>{value}</div>")

if len(nav_htmls) == 0 and len(body_htmls) == 0:
body_htmls.append(DUMMY_DECK)
body_htmls.append(DUMMY_DECK)
raw_html = get_deck_template().substitute(NAV_HTML="".join(nav_htmls), BODY_HTML="".join(body_htmls))
if not ignore_jupyter and ipython_check():
try:
Expand Down
Loading