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

Add update_execution func in remote #1860

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ericwudayi
Copy link
Contributor

@ericwudayi ericwudayi commented Sep 29, 2023

TL;DR

As Title

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

@welcome
Copy link

welcome bot commented Sep 29, 2023

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
Copy link

codecov bot commented Sep 29, 2023

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%) ⬆️
flytekit/clients/raw.py 52.41% <50.00%> (-0.04%) ⬇️
flytekit/remote/remote.py 21.10% <25.00%> (+0.02%) ⬆️

... and 26 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ericwudayi ericwudayi marked this pull request as ready for review October 5, 2023 15:08
Copy link
Contributor

@wild-endeavor wild-endeavor left a comment

Choose a reason for hiding this comment

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

can we add a type hint for state? Not sure if there's a model object or something that should be used. Can also use a more user-friendly state in remote.py and only use the idl object in friendly.py.

@ericwudayi
Copy link
Contributor Author

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

@wild-endeavor
Copy link
Contributor

Oh no enums are nice, let's just use it in both places.

@ericwudayi
Copy link
Contributor Author

ericwudayi commented Oct 6, 2023

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.

Signed-off-by: Da-Yi Wu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants