-
Notifications
You must be signed in to change notification settings - Fork 301
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
Show version and execute by version #2124
base: master
Are you sure you want to change the base?
Conversation
There is one problem with this @task
def do(show_versions: bool):
... which might be ok. But to counter this, I suggested add a subcommand of type
Note the missing cc @wild-endeavor what should we do? If you create a subcommand, like how we do for remote-entities. the table also does not need to be created! |
else: | ||
raise ValueError(f"Unknown entity type {type(entity)}") | ||
formatter = click.HelpFormatter() | ||
task_table = [] |
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.
please use rich table - https://rich.readthedocs.io/en/stable/tables.html
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2124 +/- ##
============================================
+ Coverage 71.79% 100.00% +28.20%
============================================
Files 182 5 -177
Lines 18561 122 -18439
Branches 3654 0 -3654
============================================
- Hits 13326 122 -13204
+ Misses 4592 0 -4592
+ Partials 643 0 -643 ☔ View full report in Codecov by Sentry. |
can we make |
Thanks for the advice, this sounds more feasible for me, I've modified my PR to implement this behavior. |
I can't get this to run locally actually. running the new command I'm getting
related, why is |
@wild-endeavor Hi, sorry for the confusion. |
5556d00
to
a8a6ede
Compare
a8a6ede
to
68884bd
Compare
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]>
Signed-off-by: novahow <[email protected]> modified: flytekit/clis/sdk_in_container/run.py modified: flytekit/clis/sdk_in_container/versions.py new file: tests/flytekit/unit/cli/pyflyte/test_versions.py
68884bd
to
9214dbe
Compare
Signed-off-by: novahow <[email protected]>
Can we please also test with reference task, reference workflow, and reference launchplan? |
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.
flytekit/models/admin/workflow.py
Outdated
@@ -1,4 +1,6 @@ | |||
import typing | |||
from datetime import datetime as _datetime |
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.
can we not use the _library
pattern anymore. Let's make this just from datetime import datetime
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'll just hide that column completely, thanks for the suggestion. Since the version is a list and is shown when you add the task as a subcommand
flytekit/models/admin/workflow.py
Outdated
@@ -1,4 +1,6 @@ | |||
import typing | |||
from datetime import datetime as _datetime | |||
from datetime import timezone as _timezone |
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.
ditto
flytekit/models/admin/workflow.py
Outdated
@@ -124,16 +128,31 @@ def compiled_workflow(self): | |||
""" | |||
return self._compiled_workflow | |||
|
|||
@property | |||
def created_at(self): |
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.
move type hint to function signature and remove comment
flytekit/models/launch_plan.py
Outdated
@@ -1,4 +1,5 @@ | |||
import typing | |||
from datetime import timezone as _timezone |
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.
from datetime import timezone as _timezone | |
from datetime import timezone |
flytekit/models/launch_plan.py
Outdated
@@ -349,15 +352,25 @@ def expected_outputs(self): | |||
""" | |||
return self._expected_outputs | |||
|
|||
@property | |||
def created_at(self): | |||
""" |
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.
ditto
@jpvotta Hi, can you please elaborate more on how to cover that? Since I'm not really familiar with reference task, thanks |
Signed-off-by: novahow <[email protected]>
Apologies. I am going to defer to @eapolinario on whether or not this is necessary (guessing it shouldn't be relevant here). |
@novahow , sorry for the delay I was out in the last 2.5 weeks. Reference entities are a way of referring to pre-existing Flyte entities. Take a look at https://docs.flyte.org/en/latest/user_guide/productionizing/reference_tasks.html#reference-tasks, https://docs.flyte.org/en/latest/user_guide/productionizing/reference_launch_plans.html, and https://docs.flyte.org/en/latest/api/flytekit/generated/flytekit.reference_workflow.html#flytekit-reference-workflow. As for whether we should cover this in this change, I don't think it's necessary since we're already dealing with remote entities anyway (i.e. you need to know the names + versions before executing them). |
Tracking issue
fixes flyteorg/flyte#4707
Why are the changes needed?
Show versions and creation time of remote-task/launchplan/workflow
What changes were proposed in this pull request?
This PR contains 2 parts.
For the show-versions part, I created a new top-level command
VersionCommand
which inherits theRunCommand
class since they function similarly. Also,RemoteEntityVersionGroup
inheritsRemoteEntityGroup
,andDynamicEntityVersionCommand
inherits bothclick.RichGroup
andDynamicEntityLaunchCommand
. It inheritsclick.RichGroup
because we want to display versions and creation time with click automatically.We also extract parts of
RunLevelParams
to create a base param classRunBaseParams
, so thatVersionLevelParams
which inheritsRunBaseParams
can display only the options that will be used is show-version command.To fetch the creation time of the task, the
created_at
attribute is added in closures. This ensures that both versions and created_time can be retrieved fromlist_tasks_paginated
method.For the execute with version part, I simply split the entity name with
":"
, and iteratively loop through possible combinations of entity_name and version with the_looped_fetch_entity
method.How was this patch tested?
By running
pyflyte show-versions remote-[launchplan|workflow|task] {name}
, the versions will be displayedCode snippet:
Example:
pyflyte show-versions remote-task flyteTest.example.mean
One can then run
pyflyte run remote-task flyteTest.example.mean:{version} --inputs ...
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link