VictorPlusC commented on a change in pull request #16741:
URL: https://github.com/apache/beam/pull/16741#discussion_r808480487
##########
File path:
sdks/python/apache_beam/runners/interactive/dataproc/dataproc_cluster_manager.py
##########
@@ -135,30 +163,38 @@ def cleanup(self) -> None:
try:
self._cluster_client.delete_cluster(
request={
- 'project_id': self._project_id,
- 'region': self._region,
- 'cluster_name': self._cluster_name,
+ 'project_id': self.cluster_metadata.project_id,
+ 'region': self.cluster_metadata.region,
+ 'cluster_name': self.cluster_metadata.cluster_name,
})
except Exception as e:
if e.code == 403:
_LOGGER.error(
'Due to insufficient project permissions, '
'unable to clean up the default cluster: %s',
- self._cluster_name)
+ self.cluster_metadata.cluster_name)
raise ValueError(
'You cannot delete a cluster in project: {}'.format(
- self._project_id))
+ self.cluster_metadata.project_id))
elif e.code == 404:
- _LOGGER.error('Cluster does not exist: %s', self._cluster_name)
- raise ValueError('Cluster was not found:
{}'.format(self._cluster_name))
+ _LOGGER.error('Cluster does not exist: %s',
self.cluster_metadata.cluster_name)
+ raise ValueError('Cluster was not found:
{}'.format(self.cluster_metadata.cluster_name))
else:
- _LOGGER.error('Failed to delete cluster: %s', self._cluster_name)
+ _LOGGER.error('Failed to delete cluster: %s',
self.cluster_metadata.cluster_name)
raise e
- def cleanup_if_default(self) -> None:
- """Checks if the cluster_name initialized with the
- DataprocClusterManager instance is the default
- cluster_name. If it is, then the cleanup() method
- is invoked."""
- if self._cluster_name == self.DEFAULT_NAME:
- self.cleanup()
+ def describe(self) -> None:
+ """Returns a dictionary describing the cluster."""
+ return {
+ 'cluster_metadata': self.cluster_metadata,
+ 'master_url': self.master_url
+ }
+
+ def get_master_url(self, identifier, existing=True) -> None:
Review comment:
Makes sense. I've changed it and I made it now only call it in the
instance where we know for certain the cluster exists.
--
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]