VictorPlusC commented on a change in pull request #16601:
URL: https://github.com/apache/beam/pull/16601#discussion_r793016733
##########
File path:
sdks/python/apache_beam/runners/interactive/interactive_environment.py
##########
@@ -675,3 +683,25 @@ def get_sql_chain(self, pipeline, set_user_pipeline=False):
pipeline)
chain.user_pipeline = pipeline
return chain
+
+ def check_bucket_exists(self, bucket_name):
+ try:
+ from apitools.base.py.exceptions import HttpError
+ except:
+ raise ImportError('Could not import HttpError from apitools.')
+
+ try:
+ storage_client = storage.StorageV1(
+ credentials=auth.get_service_credentials(),
+ get_credentials=False,
+ http=get_new_http(),
+ response_encoding='utf8')
+ request = storage.StorageBucketsGetRequest(bucket=bucket_name)
+ storage_client.buckets.Get(request)
+ except HttpError as e:
+ if e.status_code == 404:
+ _LOGGER.error("{} bucket does not exist!".format(bucket_name))
+ else:
+ _LOGGER.warning(
+ "HttpError - unable to verify whether bucket {} exists.\
+ ".format(bucket_name))
Review comment:
Noted, this should be resolved. 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]