Repository: incubator-beam Updated Branches: refs/heads/python-sdk 66f324b35 -> 6ac6e420f
Add IP configuration to Python SDK Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/af6f4e90 Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/af6f4e90 Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/af6f4e90 Branch: refs/heads/python-sdk Commit: af6f4e90a239dbf1a2ad6f0cd8974602dfa9e9b4 Parents: 66f324b Author: Sam McVeety <s...@google.com> Authored: Fri Nov 11 19:56:34 2016 -0800 Committer: Robert Bradshaw <rober...@gmail.com> Committed: Tue Nov 15 08:50:31 2016 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/internal/apiclient.py | 9 +++++++++ sdks/python/apache_beam/utils/options.py | 4 ++++ 2 files changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/af6f4e90/sdks/python/apache_beam/internal/apiclient.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/internal/apiclient.py b/sdks/python/apache_beam/internal/apiclient.py index 8c7cc29..5ac9d6e 100644 --- a/sdks/python/apache_beam/internal/apiclient.py +++ b/sdks/python/apache_beam/internal/apiclient.py @@ -210,6 +210,15 @@ class Environment(object): pool.teardownPolicy = ( dataflow.WorkerPool .TeardownPolicyValueValuesEnum.TEARDOWN_ON_SUCCESS) + if self.worker_options.use_public_ips is not None: + if self.worker_options.use_public_ips: + pool.ipConfiguration = ( + dataflow.WorkerPool + .IpConfigurationValueValuesEnum.WORKER_IP_PUBLIC) + else: + pool.ipConfiguration = ( + dataflow.WorkerPool + .IpConfigurationValueValuesEnum.WORKER_IP_PRIVATE) if self.standard_options.streaming: # Use separate data disk for streaming. http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/af6f4e90/sdks/python/apache_beam/utils/options.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/utils/options.py b/sdks/python/apache_beam/utils/options.py index ecc85ba..f68335b 100644 --- a/sdks/python/apache_beam/utils/options.py +++ b/sdks/python/apache_beam/utils/options.py @@ -348,6 +348,10 @@ class WorkerOptions(PipelineOptions): help= ('The teardown policy for the VMs. By default this is left unset and ' 'the service sets the default policy.')) + parser.add_argument( + '--use_public_ips', + default=None, + help='Whether to assign public IP addresses to the worker machines.') def validate(self, validator): errors = []