flytekit
flytekit copied to clipboard
Add update_execution func in remote
TL;DR
As Title
Type
- [ ] Bug Fix
- [x] Feature
- [ ] Plugin
Are all requirements met?
- [x] Code completed
- [ ] Smoke tested
- [ ] Unit tests added
- [ ] Code documentation added
- [ ] Any pending items have an associated Issue
Thank you for opening this pull request! 🙌
These tips will help get your PR across the finish line:
- Most of the repos have a PR template; if not, fill it out to the best of your knowledge.
- Sign off your commits (Reference: DCO Guide).
Codecov Report
Attention: 5 lines
in your changes are missing coverage. Please review.
Comparison is base (
67b2169
) 55.01% compared to head (9f8b555
) 55.04%. Report is 6 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #1860 +/- ##
==========================================
+ Coverage 55.01% 55.04% +0.02%
==========================================
Files 296 296
Lines 22216 22250 +34
Branches 2172 3358 +1186
==========================================
+ Hits 12223 12247 +24
+ Misses 9844 9840 -4
- Partials 149 163 +14
Files | Coverage Δ | |
---|---|---|
flytekit/clients/friendly.py | 49.65% <50.00%> (+<0.01%) |
:arrow_up: |
flytekit/clients/raw.py | 52.41% <50.00%> (-0.04%) |
:arrow_down: |
flytekit/remote/remote.py | 21.10% <25.00%> (+0.02%) |
:arrow_up: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Sure, in flyteidl the state is type of ExecutionState.
enum ExecutionState {
// By default, all executions are considered active.
EXECUTION_ACTIVE = 0;
// Archived executions are no longer visible in the UI.
EXECUTION_ARCHIVED = 1;
}
How about to use the int in remote.py and use ExecutionState in friendly.py
Oh no enums are nice, let's just use it in both places.
Use enum class make the usage not so straight-forward. User need to declare ExecutionState when update. But it is very clear.
from ... import ExecutionState
remote.update_execution(
..., state=ExecutionState.EXECUTION_ARCHIVED, tags=["..."])
On the other side, if we use typing.Literal. It is easy to use, but they need to look into the definition to see the meaning of value.
def update_execution(
self,
...
state: typing.Literal[0, 1] = None,
tags: typing.List[str] = None,
) -> FlyteWorkflowExecution:
"""Update a workflow execution entity from flyte admin.
...
:param state: state to be updated. 0 = Active, 1 = Archived.
:param tags: List of tags to be updated.
...
"""
remote.update_execution(..., state = 1, tags = ["..."])
I use Literal first to make it simple. Comment on it if the first one is better or any other concern.