-
Notifications
You must be signed in to change notification settings - Fork 333
[flyte deck] Streaming Decks #2779
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
Changes from 18 commits
01182b4
9616fc3
98ae7c7
4e92bb0
4df18b5
ebb4d4e
99522d9
c19d67d
67cd829
06da3df
6d99d69
b805cd7
4c97758
7b3574a
9b60564
18c994f
39f39d1
aabcbbb
9ca43f3
ed56352
b559fc9
fc5578f
7139468
e0aee9e
3727588
ce3ee15
d066231
f9387ce
f14c3fa
c33a909
8666c60
93580d6
bcaaabd
a321700
6464fae
884943c
d4b5b96
406227c
1e77f54
d70a2d5
7fc6393
6980140
c87a342
f609760
473ae11
008fe52
f0b9028
d48efa9
6b55930
b5912fb
a681ccd
048fdff
7bcf15e
b6c41c3
be02f9f
cf83e06
e137328
a59a56e
b8383be
dc6d203
41d8760
b71cc19
b5976fe
0c1a5a3
d082456
4a8c68f
b58527b
2764ed4
90372db
d8c408c
5cacf11
c447793
c5cc967
1d6417a
b0cd1ae
974b882
ea8b6e0
a642c9d
e9aef35
04775d7
34a4146
f30382b
b649f8f
0565282
c0fd23a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,40 @@ | |
|
||
OUTPUT_DIR_JUPYTER_PREFIX = "jupyter" | ||
DECK_FILE_NAME = "deck.html" | ||
DUMMY_DECK_HTML = """ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<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): | ||
|
@@ -86,6 +120,27 @@ def name(self) -> str: | |
def html(self) -> str: | ||
return self._html | ||
|
||
@classmethod | ||
|
||
def publish(cls): | ||
|
||
task_name = FlyteContextManager.current_context().user_space_params.task_id.name | ||
new_user_params = FlyteContextManager.current_context().user_space_params | ||
_output_deck(task_name, new_user_params) | ||
|
||
|
||
class DummyDeck(Deck): | ||
""" | ||
The DummyDeck class is designed | ||
""" | ||
|
||
def __init__(self): | ||
name = "dummy_deck" | ||
html = DUMMY_DECK_HTML | ||
super().__init__(name, html) | ||
|
||
@property | ||
def html(self) -> str: | ||
return self._html | ||
|
||
|
||
class TimeLineDeck(Deck): | ||
""" | ||
|
@@ -154,7 +209,13 @@ def _get_deck( | |
Get flyte deck html string | ||
If ignore_jupyter is set to True, then it will return a str even in a jupyter environment. | ||
""" | ||
deck_map = {deck.name: deck.html for deck in new_user_params.decks} | ||
|
||
deck_map = {deck.name: deck.html for deck in new_user_params.decks if deck.name != "dummy_deck"} | ||
|
||
# If deck_map is empty after filtering, add DummyDeck | ||
if not deck_map: | ||
deck_map = {"dummy_deck": DUMMY_DECK_HTML} | ||
|
||
nav_htmls = [] | ||
body_htmls = [] | ||
|
||
|
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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