[
https://issues.apache.org/jira/browse/BEAM-13799?focusedWorklogId=720550&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-720550
]
ASF GitHub Bot logged work on BEAM-13799:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Feb/22 00:22
Start Date: 04/Feb/22 00:22
Worklog Time Spent: 10m
Work Description: VictorPlusC commented on a change in pull request
#16691:
URL: https://github.com/apache/beam/pull/16691#discussion_r799074610
##########
File path:
sdks/python/apache_beam/runners/interactive/dataproc/dataproc_cluster_manager.py
##########
@@ -0,0 +1,154 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# pytype: skip-file
+
+import logging
+
+try:
+ from google.cloud import dataproc_v1
+except ImportError:
+ raise ImportError(
+ 'Google Cloud Dataproc not supported for this execution environment.')
+
+_LOGGER = logging.getLogger(__name__)
+
+
+class DataprocClusterManager:
+ """The DataprocClusterManager object simplifies the operations
+ required for creating and deleting Dataproc clusters for use
+ under Interactive Beam.
+ """
+ DEFAULT_NAME = 'interactive-beam-cluster'
+
+ def __init__(self, project_id=None, region=None, cluster_name=None):
+ """Initializes the DataprocClusterManager with properties required
+ to interface with the Dataproc ClusterControllerClient.
+ """
+
+ self.project_id = project_id
+ if region == 'global':
+ # The global region is unsupported as it will be eventually deprecated.
+ raise ValueError('Clusters in the global region are not supported.')
+ elif region:
+ self.region = region
+ else:
+ _LOGGER.warning(
+ 'No region information was detected, defaulting Dataproc cluster '
+ 'region to: us-central1.')
+ self.region = 'us-central1'
+
+ if cluster_name:
+ _LOGGER.warning(
+ 'A user-specified cluster_name has been detected. '
+ 'Please note that you will have to manually delete the Dataproc '
+ 'cluster that will be created under the name: %s',
+ cluster_name)
+ self.cluster_name = cluster_name
+ else:
+ self.cluster_name = self.DEFAULT_NAME
+
+ self.cluster_client = dataproc_v1.ClusterControllerClient(
+ client_options={
+ 'api_endpoint': f'{self.region}-dataproc.googleapis.com:443'
+ })
+
+ def _create_cluster(self, cluster):
Review comment:
Got it. Thanks!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 720550)
Time Spent: 3h 20m (was: 3h 10m)
> Create an Interactive Beam Dataproc package for users to manage clusters with
> -----------------------------------------------------------------------------
>
> Key: BEAM-13799
> URL: https://issues.apache.org/jira/browse/BEAM-13799
> Project: Beam
> Issue Type: New Feature
> Components: runner-py-interactive
> Reporter: Victor Chen
> Assignee: Victor Chen
> Priority: P2
> Time Spent: 3h 20m
> Remaining Estimate: 0h
>
> * Adds a package to support the creation of Dataproc clusters that have been
> configured with a Flink session
> * By default, a created Dataproc cluster will be called
> 'interactive-beam-cluster'
> * Users additionally will have the ability to:
> ** specify a name of their choosing for the created cluster, a warning is
> raised to notify the user that they will have to delete the cluster on their
> own
> ** delete the cluster with the default name, 'interactive-beam-cluster'
--
This message was sent by Atlassian Jira
(v8.20.1#820001)