-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Note: #501 was also for this test, but it was closed more than 10 days ago. So, I didn't mark it flaky.
commit: e596b74
buildURL: Build Status, Sponge
status: failed
Test output
self =
dataframe = test_col test_col2
0 1.428571e-01 1.428571e-01
1 4.406780e-01 4.406780e-01
2 1.051480e+00 1.051480e+0...4 1.857143e+00 1.857143e+00
5 2.718282e+00 2.718282e+00
6 3.141593e+00 3.141593e+00
7 2.098894e+43 2.098894e+43
destination_table_ref = TableReference(DatasetReference('precise-truck-742', 'python_bigquery_pandas_tests_system_20231018132626_87875e'), 'round_trip_75986')
write_disposition = 'WRITE_EMPTY', chunksize = None
schema = {'fields': [{'name': 'test_col', 'type': 'FLOAT'}, {'name': 'test_col2', 'type': 'FLOAT'}]}
progress_bar = True, api_method = 'load_parquet'
billing_project = 'precise-truck-742'
def load_data(
self,
dataframe,
destination_table_ref,
write_disposition,
chunksize=None,
schema=None,
progress_bar=True,
api_method: str = "load_parquet",
billing_project: Optional[str] = None,
):
from pandas_gbq import load
total_rows = len(dataframe)
try:
chunks = load.load_chunks(
self.client,
dataframe,
destination_table_ref,
chunksize=chunksize,
schema=schema,
location=self.location,
api_method=api_method,
write_disposition=write_disposition,
billing_project=billing_project,
)
pandas_gbq/gbq.py:602:
pandas_gbq/load.py:243: in load_chunks
load_parquet(
pandas_gbq/load.py:137: in load_parquet
).result()
.nox/system-3-10/lib/python3.10/site-packages/google/cloud/bigquery/job/base.py:922: in result
return super(_AsyncJob, self).result(timeout=timeout, **kwargs)
.nox/system-3-10/lib/python3.10/site-packages/google/api_core/future/polling.py:256: in result
self._blocking_poll(timeout=timeout, retry=retry, polling=polling)
.nox/system-3-10/lib/python3.10/site-packages/google/api_core/future/polling.py:137: in _blocking_poll
polling(self._done_or_raise)(retry=retry)
.nox/system-3-10/lib/python3.10/site-packages/google/api_core/retry.py:366: in retry_wrapped_func
return retry_target(
.nox/system-3-10/lib/python3.10/site-packages/google/api_core/retry.py:204: in retry_target
return target()
.nox/system-3-10/lib/python3.10/site-packages/google/api_core/future/polling.py:119: in _done_or_raise
if not self.done(retry=retry):
.nox/system-3-10/lib/python3.10/site-packages/google/cloud/bigquery/job/base.py:889: in done
self.reload(retry=retry, timeout=timeout)
.nox/system-3-10/lib/python3.10/site-packages/google/cloud/bigquery/job/base.py:781: in reload
api_response = client._call_api(
.nox/system-3-10/lib/python3.10/site-packages/google/cloud/bigquery/client.py:816: in _call_api
return call()
self = <google.cloud.bigquery._http.Connection object at 0x7f0fcc5746a0>
method = 'GET'
path = '/projects/precise-truck-742/jobs/4d13926f-af9d-4951-9387-913f052768e7'
query_params = {'location': 'US'}, data = None, content_type = None
headers = None, api_base_url = None, api_version = None, expect_json = True
_target_object = None, timeout = None, extra_api_info = None
def api_request(
self,
method,
path,
query_params=None,
data=None,
content_type=None,
headers=None,
api_base_url=None,
api_version=None,
expect_json=True,
_target_object=None,
timeout=_DEFAULT_TIMEOUT,
extra_api_info=None,
):
"""Make a request over the HTTP transport to the API.
You shouldn't need to use this method, but if you plan to
interact with the API using these primitives, this is the
correct one to use.
:type method: str
:param method: The HTTP method name (ie, ``GET``, ``POST``, etc).
Required.
:type path: str
:param path: The path to the resource (ie, ``'/b/bucket-name'``).
Required.
:type query_params: dict or list
:param query_params: A dictionary of keys and values (or list of
key-value pairs) to insert into the query
string of the URL.
:type data: str
:param data: The data to send as the body of the request. Default is
the empty string.
:type content_type: str
:param content_type: The proper MIME type of the data provided. Default
is None.
:type headers: dict
:param headers: extra HTTP headers to be sent with the request.
:type api_base_url: str
:param api_base_url: The base URL for the API endpoint.
Typically you won't have to provide this.
Default is the standard API base URL.
:type api_version: str
:param api_version: The version of the API to call. Typically
you shouldn't provide this and instead use
the default for the library. Default is the
latest API version supported by
google-cloud-python.
:type expect_json: bool
:param expect_json: If True, this method will try to parse the
response as JSON and raise an exception if
that cannot be done. Default is True.
:type _target_object: :class:`object`
:param _target_object:
(Optional) Protected argument to be used by library callers. This
can allow custom behavior, for example, to defer an HTTP request
and complete initialization of the object at a later time.
:type timeout: float or tuple
:param timeout: (optional) The amount of time, in seconds, to wait
for the server response.
Can also be passed as a tuple (connect_timeout, read_timeout).
See :meth:`requests.Session.request` documentation for details.
:type extra_api_info: string
:param extra_api_info: (optional) Extra api info to be appended to
the X-Goog-API-Client header
:raises ~google.cloud.exceptions.GoogleCloudError: if the response code
is not 200 OK.
:raises ValueError: if the response content type is not JSON.
:rtype: dict or str
:returns: The API response payload, either as a raw string or
a dictionary if the response is valid JSON.
"""
url = self.build_api_url(
path=path,
query_params=query_params,
api_base_url=api_base_url,
api_version=api_version,
)
# Making the executive decision that any dictionary
# data will be sent properly as JSON.
if data and isinstance(data, dict):
data = json.dumps(data)
content_type = "application/json"
response = self._make_request(
method=method,
url=url,
data=data,
content_type=content_type,
headers=headers,
target_object=_target_object,
timeout=timeout,
extra_api_info=extra_api_info,
)
if not 200 <= response.status_code < 300:
raise exceptions.from_http_response(response)
E google.api_core.exceptions.ServiceUnavailable: 503 GET https://bigquery.googleapis.com/bigquery/v2/projects/precise-truck-742/jobs/4d13926f-af9d-4951-9387-913f052768e7?location=US&prettyPrint=false: Error encountered during execution. Retrying may solve the problem.
.nox/system-3-10/lib/python3.10/site-packages/google/cloud/_http/init.py:494: ServiceUnavailable
The above exception was the direct cause of the following exception:
method_under_test = functools.partial(<function to_gbq at 0x7f0fceec2dd0>, project_id='precise-truck-742', credentials=<google.oauth2.service_account.Credentials object at 0x7f0fced358d0>)
random_dataset_id = 'python_bigquery_pandas_tests_system_20231018132626_87875e'
read_gbq = functools.partial(<function read_gbq at 0x7f0fceec2d40>, project_id='precise-truck-742', credentials=<google.oauth2.service_account.Credentials object at 0x7f0fced358d0>)
input_series = 0 1.428571e-01
1 4.406780e-01
2 1.051480e+00
3 1.051530e+00
4 1.857143e+00
5 2.718282e+00
6 3.141593e+00
7 2.098894e+43
Name: test_col, dtype: float64
api_method = 'load_parquet', api_methods = {'load_csv', 'load_parquet'}
@pytest.mark.parametrize(
["input_series", "api_methods"],
[
# Ensure that 64-bit floating point numbers are unchanged.
# See: https://github.com/pydata/pandas-gbq/issues/326
SeriesRoundTripTestCase(
input_series=pandas.Series(
[
0.14285714285714285,
0.4406779661016949,
1.05148,
1.05153,
1.8571428571428572,
2.718281828459045,
3.141592653589793,
2.0988936657440586e43,
],
name="test_col",
),
),
SeriesRoundTripTestCase(
input_series=pandas.Series(
[
"abc",
"defg",
# Ensure that unicode characters are encoded. See:
# https://github.com/googleapis/python-bigquery-pandas/issues/106
"信用卡",
"Skywalker™",
"hülle",
],
name="test_col",
),
),
SeriesRoundTripTestCase(
input_series=pandas.Series(
[
"abc",
"defg",
# Ensure that empty strings are written as empty string,
# not NULL. See:
# https://github.com/googleapis/python-bigquery-pandas/issues/366
"",
None,
],
name="empty_strings",
),
# BigQuery CSV loader uses empty string as the "null marker" by
# default. Potentially one could choose a rarely used character or
# string as the null marker to disambiguate null from empty string,
# but then that string couldn't be loaded.
# TODO: Revist when custom load job configuration is supported.
# https://github.com/googleapis/python-bigquery-pandas/issues/425
api_methods={"load_parquet"},
),
],
)
def test_series_round_trip(
method_under_test,
random_dataset_id,
read_gbq,
input_series,
api_method,
api_methods,
):
if api_method not in api_methods:
pytest.skip(f"{api_method} not supported.")
table_id = f"{random_dataset_id}.round_trip_{random.randrange(1_000_000)}"
input_series = input_series.sort_values().reset_index(drop=True)
df = pandas.DataFrame(
# Some errors only occur in multi-column dataframes. See:
# https://github.com/googleapis/python-bigquery-pandas/issues/366
{"test_col": input_series, "test_col2": input_series}
)
method_under_test(df, table_id, api_method=api_method)
tests/system/test_to_gbq.py:110:
pandas_gbq/gbq.py:1220: in to_gbq
connector.load_data(
pandas_gbq/gbq.py:622: in load_data
self.process_http_error(ex)
ex = ServiceUnavailable('GET https://bigquery.googleapis.com/bigquery/v2/projects/precise-truck-742/jobs/4d13926f-af9d-4951-9387-913f052768e7?location=US&prettyPrint=false: Error encountered during execution. Retrying may solve the problem.')
@staticmethod
def process_http_error(ex):
# See `BigQuery Troubleshooting Errors
# <https://cloud.google.com/bigquery/troubleshooting-errors>`__
if "cancelled" in ex.message:
raise QueryTimeout("Reason: {0}".format(ex))
elif "Provided Schema does not match" in ex.message:
error_message = ex.errors[0]["message"]
raise InvalidSchema(f"Reason: {error_message}")
elif "Already Exists: Table" in ex.message:
error_message = ex.errors[0]["message"]
raise TableCreationError(f"Reason: {error_message}")
else:
raise GenericGBQException("Reason: {0}".format(ex)) from ex
E pandas_gbq.exceptions.GenericGBQException: Reason: 503 GET https://bigquery.googleapis.com/bigquery/v2/projects/precise-truck-742/jobs/4d13926f-af9d-4951-9387-913f052768e7?location=US&prettyPrint=false: Error encountered during execution. Retrying may solve the problem.
pandas_gbq/gbq.py:396: GenericGBQException