-
Notifications
You must be signed in to change notification settings - Fork 333
Add support cache for dynamic spec #3209
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Signed-off-by: Alex Wu <[email protected]>
Thank you for opening this pull request! 🙌 These tips will help get your PR across the finish line:
|
Code Review Agent Run #0d112dActionable Suggestions - 4
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
[True, False], | ||
["A", "B"], | ||
[()], | ||
[PythonFunctionTask.ExecutionBehavior.DEFAULT] |
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 product function is now including execution_mode
as a parameter, but the corresponding list in the product call is missing a comma at the end of line 142. This could lead to syntax errors or unexpected behavior when the code is executed.
Code suggestion
Check the AI-generated fix before applying
[PythonFunctionTask.ExecutionBehavior.DEFAULT] | |
[PythonFunctionTask.ExecutionBehavior.DEFAULT], |
Code Review Run #0d112d
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
flytekit/core/base_task.py
Outdated
pod_template_name: Optional[str] = None | ||
generates_deck: bool = False | ||
is_eager: bool = False | ||
execution_mode: "PythonFunctionTask.ExecutionBehavior" = None |
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's an undefined name PythonFunctionTask
in the TaskMetadata
class. This class is likely imported from another module but the import is missing. Consider adding the appropriate import or using a string literal for the type annotation.
Code suggestion
Check the AI-generated fix before applying
execution_mode: "PythonFunctionTask.ExecutionBehavior" = None | |
execution_mode: "PythonFunctionTask.ExecutionBehavior" = None |
Code Review Run #0d112d
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
return { | ||
tasks_pb2.TaskMetadata.ExecutionMode.DEFAULT: cls.DEFAULT, | ||
tasks_pb2.TaskMetadata.ExecutionMode.DYNAMIC: cls.DYNAMIC, | ||
}[execution_mode] |
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 from_flyte_idl
method doesn't handle potential new execution modes that might be added to the protobuf definition in the future. If a new mode is added to tasks_pb2.TaskMetadata.ExecutionMode
but not handled here, it would result in a KeyError
.
Code suggestion
Check the AI-generated fix before applying
}[execution_mode] | |
}.get(execution_mode, cls.DEFAULT) # Default to DEFAULT mode for unknown enum values |
Code Review Run #0d112d
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
if self.execution_mode is None: | ||
from flytekit.core.python_function_task import PythonFunctionTask | ||
|
||
self.execution_mode = PythonFunctionTask.ExecutionBehavior.DEFAULT |
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 __post_init__
method is setting a default value for execution_mode
if it's None
, but there's no corresponding property getter/setter for execution_mode
. This means that self.execution_mode
in line 228 will raise an AttributeError
since it's trying to access a property that doesn't exist (the actual attribute is _execution_mode
). Consider adding a property getter/setter for execution_mode
or directly accessing self._execution_mode
.
Code suggestion
Check the AI-generated fix before applying
if self.execution_mode is None: | |
from flytekit.core.python_function_task import PythonFunctionTask | |
self.execution_mode = PythonFunctionTask.ExecutionBehavior.DEFAULT | |
if self._execution_mode is None: | |
from flytekit.core.python_function_task import PythonFunctionTask | |
self._execution_mode = PythonFunctionTask.ExecutionBehavior.DEFAULT |
Code Review Run #0d112d
Should Bito avoid suggestions like this for future reviews? (Manage Rules)
- Yes, avoid them
Signed-off-by: Alex Wu <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3209 +/- ##
===========================================
- Coverage 81.71% 35.66% -46.06%
===========================================
Files 335 214 -121
Lines 27415 22368 -5047
Branches 2920 2922 +2
===========================================
- Hits 22403 7978 -14425
- Misses 4177 14271 +10094
+ Partials 835 119 -716 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Code Review Agent Run #032d6aActionable Suggestions - 0Review Details
|
Tracking issue
Related to #5543
Why are the changes needed?
We need to pass execution mode into TaskTemplate Metadata for Flyte Propeller to tell whether the node is a Dynamic node.
What changes were proposed in this pull request?
Pass execution mode into TaskTemplate Metadata while registering workflows.
Check all the applicable boxes
Related PRs
#6372
Summary by Bito
This PR adds execution_mode support to determine task behavior in dynamic caching scenarios, implementing critical improvements for caching in dynamic specifications. It enhances core modules with properties and conversion functions, ensures default values when execution_mode is not provided, and refines type logic to manage circular dependencies while aligning production code with tests for consolidated dynamic workflow support.Unit tests added: True
Estimated effort to review (1-5, lower is better): 2