-
Notifications
You must be signed in to change notification settings - Fork 123
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 #315
Comments
Issue Label Bot is not confident enough to auto-label this issue. |
So the class FullArgSpec(NamedTuple):
args: List[str]
varargs: Optional[str]
varkw: Optional[str]
defaults: Optional[Tuple[Any, ...]]
kwonlyargs: List[str]
kwonlydefaults: Optional[Dict[str, Any]]
annotations: Dict[str, Any] But is that really a useful thing to do? Why would you define a |
I see Kubeflow changed this code 4 month ago: kubeflow/pipelines@374b3b0 I will create a PR to make that change for the |
Issue-Label Bot is automatically applying the labels:
Please mark this comment with 👍 or 👎 to give our bot feedback! |
Fails as well with
from kfp import dsl
def echo_op(text):
return dsl.ContainerOp(name='echo', image='library/bash:4.4.23',
command=['sh', '-c'], arguments=['echo "text: $0"', text])
@dsl.pipeline(
name='kwonlyargs',
description='Issue #315'
)
def kwonlyargs_pipeline(*, keyword_only_argument: str):
echo_task = echo_op(keyword_only_argument) $ dsl-compile --py keyword_only_pipeline.py --output keyword_only_pipeline.yaml
So, I go back to my first comment :-)
|
Issue-Label Bot is automatically applying the labels:
Please mark this comment with 👍 or 👎 to give our bot feedback! |
Default values for arguments are only allowed for keyword-only arguments or last N positional-or-keyword arguments. Keyword-only arguments make it easier to specify default values for arguments.
Yes, I opened the same issue (in progress) to the original kubeflow-pipelines too. Both the solutions and code in kubeflow-pipelines and kfp-tekton were different though, so a change in kubeflow-pipelines wouldn't fix it in kfp-tekton, that's why I opened this issue here. |
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. |
/kind bug
What steps did you take and what happened:
Pass a pipeline function that has keyword-only arguments, e.g.
def pipeline(*, keyword_only_argument: str)
.Compiler rises:
What did you expect to happen:
Pipeline working just fine, just like for non-keyword-only arguments, e.g.
def pipeline(casual_argument: str)
.Additional information:
Origins in
compiler.py
due to usingFullArgsSpec.args
, which doesn't contain keyword-only arguments:Environment:
Irrelevant.
The text was updated successfully, but these errors were encountered: