You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "damccorm (via GitHub)" <gi...@apache.org> on 2023/08/08 17:46:15 UTC
[GitHub] [beam] damccorm commented on a diff in pull request #27884: Also use config pattern for yaml providers.
damccorm commented on code in PR #27884:
URL: https://github.com/apache/beam/pull/27884#discussion_r1287460765
##########
sdks/python/apache_beam/yaml/yaml_provider.py:
##########
@@ -141,38 +141,23 @@ def create_external_transform(self, urn, args):
def provider_from_spec(spec):
urns = spec['transforms']
type = spec['type']
- if spec.get('version', None) == 'BEAM_VERSION':
- spec['version'] = beam_version
+ config = spec.get('config', {})
+ if config.get('version', None) == 'BEAM_VERSION':
+ config['version'] = beam_version
if type == 'javaJar':
- return ExternalJavaProvider(urns, lambda: spec['jar'])
+ return ExternalJavaProvider(urns, **config)
elif type == 'mavenJar':
return ExternalJavaProvider(
urns,
- lambda: subprocess_server.JavaJarServer.path_to_maven_jar(
- **{
- key: value
- for (key, value) in spec.items() if key in [
- 'artifact_id',
- 'group_id',
- 'version',
- 'repository',
- 'classifier',
- 'appendix'
- ]
- }))
+ lambda: subprocess_server.JavaJarServer.path_to_maven_jar(**config))
Review Comment:
Should we have some validation here or elsewhere to make sure that we're passing in a valid value (one of
```
'artifact_id',
'group_id',
'version',
'repository',
'classifier',
'appendix'
```
)? I'm a little worried that the error we return here if passing in a bad config would be hard for users to understand
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org