-
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
feat(sdk.v2): Parse pipeline param in argument values #5183
feat(sdk.v2): Parse pipeline param in argument values #5183
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chensun The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…arse-pipeline-param-in-arguments
1d6dfdf
to
04955fe
Compare
04955fe
to
fe7f409
Compare
# argument_value contains PipelineParam placeholders which needs to be | ||
# replaced. And the input needs to be added to the task spec. | ||
for param in pipeline_params: | ||
additional_input_name = '{}-{}'.format(input_name, param.full_name) |
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 this format for parameter name by convention? Should this be a shared method instead?
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 naming here is only for one special scenario -- compiler injects an input parameter, which so far only happens in this specific code location. i.e. if it's extracted into a shared method, that method will only be called here. So probably not necessarily to make a method for this?
That said, there're two requirements for the naming conversion:
- The name needs to be unique among all injected inputs for the current component. (This is guaranteed because
param.full_name
is unique) - The name also shouldn't collide with any existing user defined input for the current component.
I added some comments in the code, and changed to use double dashes to form the name, so hopefully it should rarely collide with user defined inputs. I also added a check, in case name collision happens, we at least throw an error here.
Of course, we can have some logic to iterate through all the existing input names, and always generate a unique name. But I feel it's a bit overkill, with the double dash and collision check, it should be good for most cases. WDYT?
/lgtm |
Description of your changes:
To support string concatenation in pipeline params, for instance:
Checklist:
Do you want this pull request (PR) cherry-picked into the current release branch?
Learn more about cherry-picking updates into the release branch.