-
Notifications
You must be signed in to change notification settings - Fork 300
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
Streamline __call__ pattern between Tasks and Workflows #588
Conversation
Signed-off-by: wild-endeavor <[email protected]>
Signed-off-by: wild-endeavor <[email protected]>
Signed-off-by: wild-endeavor <[email protected]>
Signed-off-by: wild-endeavor <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #588 +/- ##
==========================================
+ Coverage 85.57% 85.61% +0.04%
==========================================
Files 379 379
Lines 29685 29677 -8
Branches 2376 2368 -8
==========================================
+ Hits 25403 25409 +6
+ Misses 3640 3632 -8
+ Partials 642 636 -6
Continue to review full report at Codecov.
|
flytekit/core/base_task.py
Outdated
) as child_ctx: | ||
result = self._local_execute(child_ctx, **kwargs) | ||
|
||
expected_outputs = len(self.python_interface.outputs) |
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.
is the expected outputs check new?
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.
it is - copied from the workflow __call__
function - just making things as similar as possible.
@wild-endeavor I think we probably should make the common
We should maybe just make it a standalone method that does the dataconversion and invocation. That way the logic is pretty nicely isolated and yet shared? |
And if I did not mention - I think this makes a ton of sense - this makes all flyte transformations always required which is perfect |
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
@jeevb thoughts? |
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
|
||
|
||
def executable_artifact_call_handler(entity: Union[SupportsNodeCreation, LocallyExecutable], *args, **kwargs): | ||
""" |
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.
the logic is the same for workflows and tasks, but we did not want to create base class, hence a separate method
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Signed-off-by: wild-endeavor [email protected]
TL;DR
Please read through the description in the issue as it's pretty succinct.
Note that this PR only touches local execution. Production runs on a real Flyte backend is not touched.
Description
This PR basically further streamlines the logic in the
__call__
function of tasks and workflows. At this point the logic is pretty much identical. (But premature OOP inheritance pattern has bitten us in the past so we'll refrain from creating a base class out of it for now.)Unit Test Changes
We had to make some changes to the unit test to get this new paradigm to work. You likely will need to make similar changes to your tests.
FlyteSchema
type in the past, since the Type Engine wasn't triggered, you just got the raw pandas dataframe. Now you'll get theFlyteSchema
object, so you'll need to change how you read that. (See the change intests/flytekit/unit/core/test_type_hints.py
)train
andvalidation
arguments.Type
Are all requirements met?
Tracking Issue
flyteorg/flyte#1032