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

Deprecated Agent State to Agent Phase #4738

Merged

Conversation

Future-Outlier
Copy link
Member

@Future-Outlier Future-Outlier commented Jan 18, 2024

Tracking issue

Fixes #3936

Why are the changes needed?

We want to deprecate State in webapi and use core.TaskExecution.Phase instead to make users less confused.

What changes were proposed in this pull request?

  • add core.TaskExecution.Phase phase in agent.proto
  • add DEPRECATED annotation in State in agent.proto
  • add switch case statements to route the phase in agent/plugin.go
  • add tests for above

Note:
The reason why we need to:

  1. check the phase
  2. check the state

is because the default value of phase is UNDEFINED, and the default value of state is RETRYABLE FAILURE.
We can check the state when the phase is UNDEFINED.

How was this patch tested?

  • single binary and flytekit here
  • unit test

Setup process

  1. start agent server by flytekit
  2. start flyte components with --dev
  3. compile and start the flyte cluster
  4. run a remote task with sensor agent
pyflyte serve agent
flytectl demo start --dev
cd flyte
make compile;
flyte start --config ../flyte-single-binary-local-dev.yaml
pyflyte run --remote sensor_example.py wf
tasks:
  task-plugins:
    enabled-plugins:
      - agent-service

plugins:
  agent-service:
    supportedTaskTypes:
      - sensor
    defaultAgent:
      endpoint: "dns:///localhost:8000"
      insecure: true
      timeouts:
        GetTask: 100s
      defaultTimeout: 100s
from flytekit.sensor.file_sensor import FileSensor
from flytekit import ImageSpec, task, workflow
sensor = FileSensor(name="test_sensor")

@task()
def t1():
    return

@workflow()
def wf():
    sensor(path="/tmp") >> t1()

if __name__ == "__main__":
    wf()

Screenshots

image

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

flyteorg/flytekit#2123

Signed-off-by: Future-Outlier <eric901201@gmai.com>
@Future-Outlier Future-Outlier marked this pull request as draft January 18, 2024 06:25
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Jan 18, 2024
Copy link

codecov bot commented Jan 18, 2024

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (6f5c471) 58.18% compared to head (a8ab04e) 58.18%.
Report is 9 commits behind head on master.

Files Patch % Lines
...yteplugins/go/tasks/plugins/webapi/agent/plugin.go 61.53% 9 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4738   +/-   ##
=======================================
  Coverage   58.18%   58.18%           
=======================================
  Files         626      626           
  Lines       53833    53858   +25     
=======================================
+ Hits        31322    31337   +15     
- Misses      20003    20012    +9     
- Partials     2508     2509    +1     
Flag Coverage Δ
unittests 58.18% <61.53%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Future-Outlier and others added 3 commits January 19, 2024 16:39
Signed-off-by: Future-Outlier <eric901201@gmai.com>
… deprecated-agent-state-agent-phase

Signed-off-by: Future-Outlier <eric901201@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
@Future-Outlier Future-Outlier marked this pull request as ready for review January 21, 2024 05:38
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 21, 2024
@Future-Outlier Future-Outlier marked this pull request as draft January 21, 2024 05:39
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
Signed-off-by: Future-Outlier <eric901201@gmail.com>
@Future-Outlier Future-Outlier marked this pull request as ready for review January 21, 2024 07:14
@dosubot dosubot bot added the documentation Improvements or additions to documentation label Jan 21, 2024
@Future-Outlier Future-Outlier changed the title Deprecated Agent State to Agent Phase in WebAPI Plugin Deprecated Agent State to Agent Phase Jan 21, 2024
…ion logic

Signed-off-by: Future-Outlier <eric901201@gmail.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 24, 2024
@pingsutw pingsutw merged commit 0538efb into flyteorg:master Jan 24, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core feature] Flyte Agent Ecosystem
3 participants