-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Keyword-only arguments in pipeline function signature break the compilation #4543
Comments
Thank you for researching this issue and finding the solution. Just out of curiosity, what scenarios call for pipeline functions with keyword-only parameters? |
Keyword-only arguments can have default arguments without reordering them (as they have no order, by definition). It's very useful for generated functions. Of course one could reorder the arguments so that it will be "legal" for them to have default values, but that's very misleading when calling them: # illegal generated signature:
def foo(a: str, b: Optional[str] = None, c: str): ...
# legal generated signature
def foo(*, a: str, b: Optional[str] = None, c: str): ...
# also legal...
def foo(a: str, c: str, b: Optional[str] = None): ...
# ...but misleading:
foo("A", "B", "C") # a="A", c="B", b="C"; probably not what was intended Sorry for late reply. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. Please comment "/reopen" to reopen it. |
/reopen |
@ra312: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hello everyone, |
I researched into it, and google.cloud.aiplatform project allows to pass pipeline_params as a dictionary. So I am closing the issue. |
However, when I try to declare my_custom_pipeline with **kwargs, it breaks the compilation, this seems due to how the compiler expects *args in the pipeline declaration in kfp.v2.compiler._create_pipeline_v2 lines 1192-1206 |
What steps did you take:
compile
.What happened:
Compilation fails with exception:
What did you expect to happen:
Should compile just fine, just like it does for non-keyword-only arguments:
Environment:
KFP SDK version: 1.0.0
Anything else you would like to add:
Looks like it's due to passing all arguments as
args
incompiler.py
(for current master's HEAD, d8e82602b0):signature.parameters
beingMapping[str, inspect.Parameter]
, it could be used to retrieve parameter's data. One of its fields,kind
, holds information on what kind of parameter it is, including if it is keyword-only (Parameter.KEYWORD_ONLY
).Suggested solution:
It seems enough to test the object and pass keyword-only parameters as kwargs:
/kind bug
/area backend
The text was updated successfully, but these errors were encountered: