-
Notifications
You must be signed in to change notification settings - Fork 297
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
[Feature] Support positional arguments #2522
[Feature] Support positional arguments #2522
Conversation
a247817
to
ccccaea
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2522 +/- ##
===========================================
+ Coverage 71.79% 91.19% +19.39%
===========================================
Files 182 75 -107
Lines 18561 3849 -14712
Branches 3654 0 -3654
===========================================
- Hits 13326 3510 -9816
+ Misses 4592 339 -4253
+ Partials 643 0 -643 ☔ View full report in Codecov by Sentry. |
be4c921
to
0e46066
Compare
flytekit/core/base_sql_task.py
Outdated
@@ -24,9 +25,9 @@ def __init__( | |||
query_template: str, | |||
task_config: Optional[T] = None, | |||
task_type="sql_task", | |||
inputs: Optional[Dict[str, Tuple[Type, Any]]] = 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.
Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.
https://docs.python.org/3.7/library/stdtypes.html#dict
flytekit only supports 3.8+, do we still need to use OrderedDict here?
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 know that the dictionary after Python 3.7 is ordered. I use OrderedDict
because I found somewhere in the codebase still uses OrderedDict
. After some discussions in meetings, it seems that those are legacy codes. Therefore, I've rolled back the changes of OrderedDict
.
Could you also test it on serverless? Thanks! |
@MortalHappiness for changes that only touch flytekit, and to give all reviewers peace of mind, could you please sign up for serverless, use this commit to build the image, and run some tests? (incidentally, this also helps us test serverless 😄). Could you link it in the pr description as well please? |
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 always, thanks! this has been bugging us for a while.
|
||
@workflow | ||
def wf_pure_positional_args() -> int: | ||
return t1(arg1, arg2) |
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.
could you also write a test (and run on serverless) where a downstream task takes both positional and named arguments from both 1) workflow inputs and 2) outputs of upstream tasks?
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.
Done. Please see if these tests are what you want. Thanks. Also, I'll run them on the serverless later.
Resolves: flyteorg/flyte#5320 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
Resolves: flyteorg/flyte#5320 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
0e46066
to
3fd412a
Compare
- Change the `inputs` and `outputs` attributes in the `Interface` class to `OrderedDict` to preserve the order. - Write values in positional arguments to `kwargs`. Resolves: flyteorg/flyte#5320 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com> Signed-off-by: bugra.gedik <bugra.gedik@predera.ai>
- Change the `inputs` and `outputs` attributes in the `Interface` class to `OrderedDict` to preserve the order. - Write values in positional arguments to `kwargs`. Resolves: flyteorg/flyte#5320 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com> Signed-off-by: Jan Fiedler <jan@union.ai>
- Change the `inputs` and `outputs` attributes in the `Interface` class to `OrderedDict` to preserve the order. - Write values in positional arguments to `kwargs`. Resolves: flyteorg/flyte#5320 Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com> Signed-off-by: mao3267 <chenvincent610@gmail.com>
Tracking issue
Resolves: flyteorg/flyte#5320
Why are the changes needed?
The the issue description for details.
What changes were proposed in this pull request?
inputs
andoutputs
attributes in theInterface
class toOrderedDict
to preserve the order.kwargs
.How was this patch tested?
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Docs link