From 714badb821b7acfb9801a69dd0aff08bc84f6b4f Mon Sep 17 00:00:00 2001 From: Yi Hu Date: Tue, 31 Oct 2023 00:13:09 -0400 Subject: [PATCH] Better naming and logging to investigate leaking bigtable resources (#29203) --- sdks/python/apache_beam/io/gcp/bigtableio_it_test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py b/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py index f61e346cff9f..6cdd0bbeecf6 100644 --- a/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py +++ b/sdks/python/apache_beam/io/gcp/bigtableio_it_test.py @@ -96,7 +96,7 @@ def tearDown(self): self.table.delete() self.instance.delete() except HttpError: - _LOGGER.debug( + _LOGGER.warning( "Failed to clean up table [%s] and instance [%s]", self.table.table_id, self.instance.instance_id) @@ -160,8 +160,8 @@ def setUpClass(cls): cls.args = cls.test_pipeline.get_full_options_as_args() cls.expansion_service = ('localhost:%s' % os.environ.get('EXPANSION_PORT')) - instance_id = '%s-%s-%s' % ( - cls.INSTANCE, str(int(time.time())), secrets.token_hex(3)) + timestr = "".join(filter(str.isdigit, str(datetime.datetime.utcnow()))) + instance_id = '%s-%s-%s' % (cls.INSTANCE, timestr, secrets.token_hex(3)) cls.client = client.Client(admin=True, project=cls.project) # create cluster and instance @@ -190,7 +190,7 @@ def tearDown(self): _LOGGER.info("Deleting table [%s]", self.table.table_id) self.table.delete() except HttpError: - _LOGGER.debug("Failed to clean up table [%s]", self.table.table_id) + _LOGGER.warning("Failed to clean up table [%s]", self.table.table_id) @classmethod def tearDownClass(cls): @@ -198,7 +198,7 @@ def tearDownClass(cls): _LOGGER.info("Deleting instance [%s]", cls.instance.instance_id) cls.instance.delete() except HttpError: - _LOGGER.debug( + _LOGGER.warning( "Failed to clean up instance [%s]", cls.instance.instance_id) def run_pipeline(self, rows):