-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-7761] Add transform_name_mapping pipeline option for python sdk #9072
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,8 @@ | |
| import re | ||
| from builtins import object | ||
|
|
||
| from past.builtins import unicode | ||
|
|
||
| from apache_beam.internal import pickler | ||
| from apache_beam.options.pipeline_options import DebugOptions | ||
| from apache_beam.options.pipeline_options import GoogleCloudOptions | ||
|
|
@@ -75,6 +77,9 @@ class PipelineOptionsValidator(object): | |
| ERR_INVALID_TEST_MATCHER_UNPICKLABLE = ( | ||
| 'Invalid value (%s) for option: %s. Please make sure the test matcher ' | ||
| 'is unpicklable.') | ||
| ERR_INVALID_TRANSFORM_NAME_MAPPING = ( | ||
| 'Invalid transform name mapping format. Please make sure the mapping is ' | ||
| 'string key-value pairs. Invalid pair: (%s:%s)') | ||
|
|
||
| # GCS path specific patterns. | ||
| GCS_URI = '(?P<SCHEME>[^:]+)://(?P<BUCKET>[^/]+)(/(?P<OBJECT>.*))?' | ||
|
|
@@ -174,6 +179,16 @@ def validate_cloud_options(self, view): | |
| if not view.job_name: | ||
| errors.extend(self._validate_error( | ||
| 'Existing job name must be provided when updating a pipeline.')) | ||
| if view.transform_name_mapping: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also confirm in here that the job is streaming and update.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added streaming option validation below. |
||
| if not view.update or not self.options.view_as(StandardOptions).streaming: | ||
| errors.append('Transform name mapping option is only useful when ' | ||
| '--update and --streaming is specified') | ||
| for _, (key, value) in enumerate(view.transform_name_mapping.items()): | ||
| if not isinstance(key, (str, unicode)) \ | ||
| or not isinstance(value, (str, unicode)): | ||
| errors.extend(self._validate_error( | ||
| self.ERR_INVALID_TRANSFORM_NAME_MAPPING, key, value)) | ||
| break | ||
| return errors | ||
|
|
||
| def validate_optional_argument_positive(self, view, arg_name): | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 far as I can tell python does not have a place for streaming specific options. Is it worth making it and moving this there?
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.
This option is probably more update related, which is currently only support with dataflow runner I guess?
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.
That is correct. Update is only supported by Dataflow.