def _get_gcs_cache_dir(self, pipeline, cache_dir): cache_dir_path = PurePath(cache_dir) if len(cache_dir_path.parts) < 2: _LOGGER.error('GCS bucket cache path is too short to be valid.') raise ValueError('cache_root GCS bucket path is invalid.') bucket_name = cache_dir_path.parts[1] assert_bucket_exists(bucket_name) return 'gs://{}/{}'.format('/'.join(cache_dir_path.parts[1:]), id(pipeline))
def test_assert_bucket_exists_found(self, mock_response, mock_client): utils.assert_bucket_exists('')
def test_assert_bucket_exists_not_verified(self, mock_response, mock_client): from apache_beam.runners.interactive.utils import _LOGGER with self.assertLogs(_LOGGER, level='WARNING'): utils.assert_bucket_exists('')
def test_assert_bucket_exists_not_found(self, mock_response, mock_client): with self.assertRaises(ValueError): utils.assert_bucket_exists('')