Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: reduce the number of labels added to query jobs #1245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion 7 bigframes/core/log_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
from typing import List

_lock = threading.Lock()
MAX_LABELS_COUNT = 64

# The limit is 64 (https://cloud.google.com/bigquery/docs/labels-intro#requirements),
# but leave a few spare for internal labels to be added.
# See internal issue 386825477.
MAX_LABELS_COUNT = 64 - 8

_api_methods: List = []
_excluded_methods = ["__setattr__", "__getattr__"]

Expand Down
16 changes: 12 additions & 4 deletions 16 bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,18 @@ def close(self):
"""Delete resources that were created with this session's session_id.
This includes BigQuery tables, remote functions and cloud functions
serving the remote functions."""
self._temp_storage_manager.clean_up_tables()
self._remote_function_session.clean_up(
self.bqclient, self.cloudfunctionsclient, self.session_id
)

# Protect against failure when the Session is a fake for testing or
# failed to initialize.
temp_storage_manager = getattr(self, "_temp_storage_manager", None)
if temp_storage_manager:
self._temp_storage_manager.clean_up_tables()

remote_function_session = getattr(self, "_remote_function_session", None)
if remote_function_session:
self._remote_function_session.clean_up(
self.bqclient, self.cloudfunctionsclient, self.session_id
)

def read_gbq(
self,
Expand Down
5 changes: 4 additions & 1 deletion 5 tests/unit/core/test_log_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

from bigframes.core import log_adapter

MAX_LABELS_COUNT = 64
# The limit is 64 (https://cloud.google.com/bigquery/docs/labels-intro#requirements),
# but leave a few spare for internal labels to be added.
# See internal issue 386825477.
MAX_LABELS_COUNT = 56


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion 2 tests/unit/session/test_io_bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_create_job_configs_labels_length_limit_met_and_labels_is_none():
job_configs_labels=None, api_methods=api_methods
)
assert labels is not None
assert len(labels) == 64
assert len(labels) == log_adapter.MAX_LABELS_COUNT
assert "dataframe-head" in labels.values()


Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.