-
Notifications
You must be signed in to change notification settings - Fork 299
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 Echo task #2654
Add Echo task #2654
Conversation
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2654 +/- ##
==========================================
+ Coverage 78.77% 88.66% +9.88%
==========================================
Files 187 34 -153
Lines 19149 1747 -17402
Branches 3993 0 -3993
==========================================
- Hits 15085 1549 -13536
+ Misses 3374 198 -3176
+ Partials 690 0 -690 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
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.
When I run pyflyte run --remote
:
import typing
from flytekit import ImageSpec, conditional, task, workflow
from flytekit.core.task import Echo
new_flytekit = "git+https://github.com/flyteorg/flytekit.git@68c6cf91891923c4cc898b2a493d42927035ce32"
custom_image = ImageSpec(
registry="localhost:30000",
packages=[new_flytekit],
apt_packages=["git"],
)
echo1 = Echo(name="echo", inputs={"a": float})
@task(container_image=custom_image)
def t1(radius: float) -> typing.Optional[float]:
return 2 * 3.14 * radius
@workflow
def wf1(radius: float) -> typing.Optional[float]:
return (
conditional("shape_properties_with_multiple_branches")
.if_((radius >= 0.1) & (radius < 1.0))
.then(t1(radius=radius))
.else_()
.then(echo1(a=radius))
)
I am getting this error:
Request rejected by the API, due to Invalid input.
RPC Failed, with Status: StatusCode.INVALID_ARGUMENT
details: failed to compile workflow for [resource_type:WORKFLOW project:"flytesnacks" domain:"development" name:"tjpf_noop.wf1" version:"bonkFHVywVrbD1ngx7SsDQ"] with err failed to compile workflow with err Collected Errors: 5
Error 0: Code: MismatchingTypes, Node Id: n0-n1, Description: Variable [o0] (type [union_type:{variants:{simple:FLOAT structure:{tag:"float"}} variants:{simple:NONE structure:{tag:"none"}}}]) doesn't match expected type [simple:FLOAT].
Error 1: Code: ParameterNotBound, Node Id: end-node, Description: Parameter not bound [o0].
Error 2: Code: UnreachableNodes, Node Id: start-node, Description: The Workflow contain unreachable nodes [n0].
Error 3: Code: ValueRequired, Node Id: n0, Description: Value required [.radius].
Error 4: Code: VariableNameNotFound, Node Id: n0, Description: Variable [o0] not found on node [n0].
sorry, my bad. echo1 = Echo(name="echo", inputs={"a": float}) it should be echo1 = Echo(name="echo", inputs={"a": typing.Optional[float]}) |
Signed-off-by: Kevin Su <[email protected]>
Signed-off-by: Kevin Su <[email protected]>
When I run: import typing
from flytekit import ImageSpec, conditional, task, workflow
from flytekit.core.task import Echo
new_flytekit = "git+https://github.com/flyteorg/flytekit.git@2349ceeaf74fe6449b66eee54be5667aec0b45ab"
custom_image = ImageSpec(
registry="localhost:30000",
packages=[new_flytekit],
apt_packages=["git"],
builder="default",
)
echo1 = Echo(name="echo", inputs={"a": typing.Optional[float]})
@task(container_image=custom_image)
def t1(radius: float) -> typing.Optional[float]:
return 2 * 3.14 * radius
@workflow
def wf1(radius: float) -> typing.Optional[float]:
return (
conditional("shape_properties_with_multiple_branches")
.if_((radius >= 0.1) & (radius < 1.0))
.then(t1(radius=radius))
.else_()
.then(echo1(a=radius))
) I get this error:
|
It's not enabled by default in the backend. Need to update the config. just updated the PR description, sorry. tasks:
task-plugins:
enabled-plugins:
- container
- sidecar
- K8S-ARRAY
- agent-service
- echo
default-for-task-types:
- container: container
- container_array: K8S-ARRAY |
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 tested this with the plugin and it works!
Two questions:
- Where can we document that
echo
needs to be a part of thetask-plugin
? From the user side, it's hard to tell that this does not work out of the box and they need to ask their platform engineer to add a new plugin. - Should we add
echo
to the list of default plugins in theflyte
repo?
A task that simply echoes the inputs back to the user. | ||
The task's inputs and outputs interface are the same. | ||
FlytePropeller won't create a pod for this task, it will simply pass the inputs to the outputs. | ||
https://github.com/flyteorg/flyte/blob/master/flyteplugins/go/tasks/plugins/testing/echo.go |
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.
As a follow up, I think this should link out to a docs around "How to enable echo tasks". This way a user can look at the docstring and know to contact their platform engineer to enable the feature.
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.
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.
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 just updated the docstring in this PR too
Signed-off-by: Kevin Su <[email protected]>
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.
In the future we can improve on this a tiny bit (though hard to justify I think), but we can create a hardcoded no-op marker object, and whenever the conditional sees a no-op marker, it just automatically creates this echo task for the user.
Tracking issue
flyteorg/flyte#3533
Why are the changes needed?
Currently, the conditional in Flyte does not support skipping one of the branch without any task execution. This means that we will need to use a noop task to skip the branch. This will lead to a waste of time during execution.
What changes were proposed in this pull request?
Add an echo task inside flytekit, and propeller will use echo plugin to run it without launching a pod.
echo
task just simply copy the inputs to outputs and return to the usersHow was this patch tested?
Setup process
Enable the
echo
plugin in the flytepropeller.Screenshots
Check all the applicable boxes
Related PRs
NA
Docs link
NA