-
Notifications
You must be signed in to change notification settings - Fork 297
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
Core/enable deck #2314
Core/enable deck #2314
Conversation
I do not prefer default decks. There are security and performance implications. Can we enable these decks all using the same flag If enable_deck is true then all, else you can pass a deck selection object to it |
Sure. Additionally, could you provide a brief example of a deck selection object? I'm unsure if it implies a list of DeckFields members or something else. Thanks. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2314 +/- ##
===========================================
- Coverage 77.65% 51.19% -26.47%
===========================================
Files 236 186 -50
Lines 20789 18855 -1934
Branches 3661 3690 +29
===========================================
- Hits 16144 9652 -6492
- Misses 4017 8713 +4696
+ Partials 628 490 -138 ☔ View full report in Codecov by Sentry. |
cc @thomasjpfan |
flytekit/core/base_task.py
Outdated
@@ -477,6 +478,8 @@ def __init__( | |||
execution of the task. Supplied as a dictionary of key/value pairs | |||
disable_deck (bool): (deprecated) If true, this task will not output deck html file | |||
enable_deck (bool): If true, this task will output deck html file | |||
additional_decks (Optional[List[str]]): List of additional decks besides [timeline and source code] to be |
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.
Should we define it as a List[DeckFields] instead?
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.
I am +0 on using enums if we reimport it in flytekit.deck
. Specifically:
from flytekit.deck import PrebuiltDeck
@task(decks=[PrebuiltDeck.SourceCode, PrebuiltDeck.Inputs], enable_deck=True)
Enums is nice from a programming point of view, but they can make the feature harder to discover. For example, using strings means no additional imports:
@task(decks=["source_code", "inputs"], enable_deck=True)
@novahow From a user point of view, do you have a preference?
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.
@thomasjpfan Yeah I think using strings is fine.
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.
I prefer enum. how do users know what other decks we have? Using string is also error-prone. what if people use sourceCode
or Input
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.
We list the strings out in the docstring and remember to add new ones to the list. If someone uses sourceCode
or Input
, then we raise an error.
In the PyData world, most APIs are strings instead of enums. For example, SciPy's minimize)
function uses strings for method
. The newly release torch.comple uses strings for backend
and mode
.
Personally, I prefer enums too, but I think most users in the Python data space are more familiar with strings.
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.
Sure. Additionally, could you provide a brief example of a deck selection object? I'm unsure if it implies a list of DeckFields members or something else. Thanks.
I think the intention is to have all the decks be explicit. For example, this will only show the "source code" deck and not the input and output:
@task(decks=("source_code",), enable_deck=True)
If one wants to show the inputs and outputs, then they need to be explicit:
@task(decks=("source_code", "inputs", "outputs"), enable_deck=True)
In the examples above the TimelineDeck is not shown because it was not explicitly shown.
The other question is what the default should be. Personally, I want the default decks
to be ("source_code",)
, because I think seeing the source code is generally useful. (The default is a tuple, so it is not mutable.) With this proposal, if enable_deck
is false, then decks
is ignored.
flytekit/core/base_task.py
Outdated
@@ -477,6 +478,8 @@ def __init__( | |||
execution of the task. Supplied as a dictionary of key/value pairs | |||
disable_deck (bool): (deprecated) If true, this task will not output deck html file | |||
enable_deck (bool): If true, this task will output deck html file | |||
additional_decks (Optional[List[str]]): List of additional decks besides [timeline and source code] to be |
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.
I am +0 on using enums if we reimport it in flytekit.deck
. Specifically:
from flytekit.deck import PrebuiltDeck
@task(decks=[PrebuiltDeck.SourceCode, PrebuiltDeck.Inputs], enable_deck=True)
Enums is nice from a programming point of view, but they can make the feature harder to discover. For example, using strings means no additional imports:
@task(decks=["source_code", "inputs"], enable_deck=True)
@novahow From a user point of view, do you have a preference?
@thomasjpfan. Thanks for the comment.
Are these the expected behavior? Thanks |
I want the default
In these cases, I prefer not to not to show any decks. I like having an explicit |
Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/python_function_task.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/core/test_flyte_file.py
Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py
Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/context_manager.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py
Signed-off-by: novahow <b08902047@ntu.edu.tw>
b902194
to
d929795
Compare
Signed-off-by: novahow <b08902047@ntu.edu.tw>
Signed-off-by: novahow <b08902047@ntu.edu.tw>
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.
Thanks for the updates! Overall, I like the approach.
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.
The CI errors look related.
Signed-off-by: novahow <b08902047@ntu.edu.tw>
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.
Thanks for the update!
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.
Last bit about the enum API, otherwise this looks good to go!
Signed-off-by: novahow <b08902047@ntu.edu.tw>
Signed-off-by: novahow <b08902047@ntu.edu.tw>
Signed-off-by: novahow <b08902047@ntu.edu.tw>
Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
* add additional_decks support Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/python_function_task.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/core/test_flyte_file.py * add tests and remove confusing fields Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * add deckselector Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/context_manager.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * make deck_selector to tuple Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix remote deck bug Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck and remove rendered_deck param Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix UI Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck test multiple time_info Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit with enum Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit deck_fields Signed-off-by: novahow <b08902047@ntu.edu.tw> * enable all decks, remove plotly dep Signed-off-by: novahow <b08902047@ntu.edu.tw> * kevin's update Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * remove chart Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: novahow <b08902047@ntu.edu.tw> Signed-off-by: Kevin Su <pingsutw@apache.org> Co-authored-by: Kevin Su <pingsutw@apache.org> Signed-off-by: bugra.gedik <bugra.gedik@predera.ai>
* add additional_decks support Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/python_function_task.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/core/test_flyte_file.py * add tests and remove confusing fields Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * add deckselector Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/context_manager.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * make deck_selector to tuple Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix remote deck bug Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck and remove rendered_deck param Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix UI Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck test multiple time_info Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit with enum Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit deck_fields Signed-off-by: novahow <b08902047@ntu.edu.tw> * enable all decks, remove plotly dep Signed-off-by: novahow <b08902047@ntu.edu.tw> * kevin's update Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * remove chart Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: novahow <b08902047@ntu.edu.tw> Signed-off-by: Kevin Su <pingsutw@apache.org> Co-authored-by: Kevin Su <pingsutw@apache.org> Signed-off-by: Jan Fiedler <jan@union.ai>
* add additional_decks support Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/python_function_task.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/core/test_flyte_file.py * add tests and remove confusing fields Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * add deckselector Signed-off-by: novahow <b08902047@ntu.edu.tw> modified: flytekit/core/base_task.py modified: flytekit/core/context_manager.py modified: flytekit/core/task.py modified: flytekit/deck/deck.py modified: tests/flytekit/unit/deck/test_deck.py * make deck_selector to tuple Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix remote deck bug Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck and remove rendered_deck param Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix UI Signed-off-by: novahow <b08902047@ntu.edu.tw> * fix timelinedeck test multiple time_info Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit with enum Signed-off-by: novahow <b08902047@ntu.edu.tw> * nit deck_fields Signed-off-by: novahow <b08902047@ntu.edu.tw> * enable all decks, remove plotly dep Signed-off-by: novahow <b08902047@ntu.edu.tw> * kevin's update Signed-off-by: Kevin Su <pingsutw@apache.org> * nit Signed-off-by: Kevin Su <pingsutw@apache.org> * remove chart Signed-off-by: Kevin Su <pingsutw@apache.org> --------- Signed-off-by: novahow <b08902047@ntu.edu.tw> Signed-off-by: Kevin Su <pingsutw@apache.org> Co-authored-by: Kevin Su <pingsutw@apache.org> Signed-off-by: mao3267 <chenvincent610@gmail.com>
Tracking issue
flyteorg/flyte#5095
closes #5095
Why are the changes needed?
Make the ui display deck by default, while some users don't want to render large input/output such as dataframeslet users customize displayed decks.
What changes were proposed in this pull request?
decks
, which takes a tuple of str and elements should be one of ["input", "output", "dependencies", "source_code", "Timeline"]disable_deck
params3. Currently by default, the flyteconsole will displayTimeline
andSource Code
deck.ExecutionParameters
builder pattern to inject expected decks indispatch_execute
output_metadata_prefix
param to builder ofExecutionParameters
, not sure why it wasn't there initially.How was this patch tested?
unit tests
Setup process
Screenshots
code snippet:
enable_deck is None, decks ignored
enable_deck=True
, specified decks+custom image deckenable_deck=False
disable_deck=False
, displaying default decks(source_code, dependencies)Check all the applicable boxes
Related PRs
Docs link