Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add retry for 'partition_query' (via synth) #224

Merged
merged 3 commits into from
Oct 24, 2020
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
5 changes: 4 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Generated by synthtool. DO NOT EDIT!
[run]
branch = True
omit =
google/cloud/__init__.py

[report]
fail_under = 100
Expand All @@ -32,4 +34,5 @@ omit =
*/gapic/*.py
*/proto/*.py
*/core/*.py
*/site-packages/*.py
*/site-packages/*.py
google/cloud/__init__.py
2 changes: 1 addition & 1 deletion .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ env_vars: {

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
value: "docs-staging-v2"
}

# It will upload the docker image after successful builds.
Expand Down
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.6/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.6"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py36"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-firestore/.kokoro/test-samples.sh"
Expand Down
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.7/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.7"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py37"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-firestore/.kokoro/test-samples.sh"
Expand Down
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.8/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ env_vars: {
value: "py-3.8"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py38"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-firestore/.kokoro/test-samples.sh"
Expand Down
8 changes: 7 additions & 1 deletion .kokoro/test-samples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
git checkout $LATEST_RELEASE
fi

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
exit 0
fi

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

Expand Down Expand Up @@ -101,4 +107,4 @@ cd "$ROOT"
# Workaround for Kokoro permissions issue: delete secrets
rm testing/{test-env.sh,client-secrets.json,service-account.json}

exit "$RTN"
exit "$RTN"
12 changes: 11 additions & 1 deletion google/cloud/firestore_v1/services/firestore/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,17 @@ async def partition_query(
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.partition_query,
default_timeout=None,
default_retry=retries.Retry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded,
exceptions.InternalServerError,
exceptions.ServiceUnavailable,
),
),
default_timeout=300.0,
client_info=DEFAULT_CLIENT_INFO,
)

Expand Down
14 changes: 13 additions & 1 deletion google/cloud/firestore_v1/services/firestore/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,19 @@ def _prep_wrapped_messages(self, client_info):
client_info=client_info,
),
self.partition_query: gapic_v1.method.wrap_method(
self.partition_query, default_timeout=None, client_info=client_info,
self.partition_query,
default_retry=retries.Retry(
initial=0.1,
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded,
exceptions.InternalServerError,
exceptions.ServiceUnavailable,
),
),
default_timeout=300.0,
client_info=client_info,
),
self.write: gapic_v1.method.wrap_method(
self.write, default_timeout=86400.0, client_info=client_info,
Expand Down
117 changes: 5 additions & 112 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
{
"git": {
"name": ".",
"remote": "https://github.com/googleapis/python-firestore.git",
"sha": "2021f38bb6f016c13bc43d59730c77b57ae5c352"

"remote": "git@github.com:googleapis/python-firestore",
"sha": "db5f286772592460b2bf02df25a121994889585d"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "470d84e263c833af5280753b8e4188432b8d5b06",
"internalRef": "333132625"
"sha": "2131e2f755b3c2604e2d08de81a299fd7e377dcd",
"internalRef": "338527875"
}
},
{
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "a651c5fb763c69a921aecdd3e1d8dc51dbf20f8d"
"sha": "901ddd44e9ef7887ee681b9183bbdea99437fdcc"
}
}
],
Expand All @@ -43,111 +42,5 @@
"generator": "bazel"
}
}
],
"generatedFiles": [
".flake8",
".github/CONTRIBUTING.md",
".github/ISSUE_TEMPLATE/bug_report.md",
".github/ISSUE_TEMPLATE/feature_request.md",
".github/ISSUE_TEMPLATE/support_request.md",
".github/PULL_REQUEST_TEMPLATE.md",
".github/release-please.yml",
".github/snippet-bot.yml",
".gitignore",
".kokoro/build.sh",
".kokoro/continuous/common.cfg",
".kokoro/continuous/continuous.cfg",
".kokoro/docker/docs/Dockerfile",
".kokoro/docker/docs/fetch_gpg_keys.sh",
".kokoro/docs/common.cfg",
".kokoro/docs/docs-presubmit.cfg",
".kokoro/docs/docs.cfg",
".kokoro/populate-secrets.sh",
".kokoro/presubmit/common.cfg",
".kokoro/presubmit/presubmit.cfg",
".kokoro/publish-docs.sh",
".kokoro/release.sh",
".kokoro/release/common.cfg",
".kokoro/release/release.cfg",
".kokoro/samples/lint/common.cfg",
".kokoro/samples/lint/continuous.cfg",
".kokoro/samples/lint/periodic.cfg",
".kokoro/samples/lint/presubmit.cfg",
".kokoro/samples/python3.6/common.cfg",
".kokoro/samples/python3.6/continuous.cfg",
".kokoro/samples/python3.6/periodic.cfg",
".kokoro/samples/python3.6/presubmit.cfg",
".kokoro/samples/python3.7/common.cfg",
".kokoro/samples/python3.7/continuous.cfg",
".kokoro/samples/python3.7/periodic.cfg",
".kokoro/samples/python3.7/presubmit.cfg",
".kokoro/samples/python3.8/common.cfg",
".kokoro/samples/python3.8/continuous.cfg",
".kokoro/samples/python3.8/periodic.cfg",
".kokoro/samples/python3.8/presubmit.cfg",
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
"LICENSE",
"MANIFEST.in",
"docs/_static/custom.css",
"docs/_templates/layout.html",
"docs/conf.py",
"docs/multiprocessing.rst",
"google/cloud/firestore_admin_v1/__init__.py",
"google/cloud/firestore_admin_v1/py.typed",
"google/cloud/firestore_admin_v1/services/__init__.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/__init__.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/async_client.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/client.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/pagers.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/transports/__init__.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/transports/base.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/transports/grpc.py",
"google/cloud/firestore_admin_v1/services/firestore_admin/transports/grpc_asyncio.py",
"google/cloud/firestore_admin_v1/types/__init__.py",
"google/cloud/firestore_admin_v1/types/field.py",
"google/cloud/firestore_admin_v1/types/firestore_admin.py",
"google/cloud/firestore_admin_v1/types/index.py",
"google/cloud/firestore_admin_v1/types/location.py",
"google/cloud/firestore_admin_v1/types/operation.py",
"google/cloud/firestore_v1/py.typed",
"google/cloud/firestore_v1/services/__init__.py",
"google/cloud/firestore_v1/services/firestore/__init__.py",
"google/cloud/firestore_v1/services/firestore/async_client.py",
"google/cloud/firestore_v1/services/firestore/client.py",
"google/cloud/firestore_v1/services/firestore/pagers.py",
"google/cloud/firestore_v1/services/firestore/transports/__init__.py",
"google/cloud/firestore_v1/services/firestore/transports/base.py",
"google/cloud/firestore_v1/services/firestore/transports/grpc.py",
"google/cloud/firestore_v1/services/firestore/transports/grpc_asyncio.py",
"google/cloud/firestore_v1/types/__init__.py",
"google/cloud/firestore_v1/types/common.py",
"google/cloud/firestore_v1/types/document.py",
"google/cloud/firestore_v1/types/firestore.py",
"google/cloud/firestore_v1/types/query.py",
"google/cloud/firestore_v1/types/write.py",
"noxfile.py",
"renovate.json",
"samples/AUTHORING_GUIDE.md",
"samples/CONTRIBUTING.md",
"scripts/decrypt-secrets.sh",
"scripts/fixup_firestore_admin_v1_keywords.py",
"scripts/fixup_firestore_v1_keywords.py",
"scripts/readme-gen/readme_gen.py",
"scripts/readme-gen/templates/README.tmpl.rst",
"scripts/readme-gen/templates/auth.tmpl.rst",
"scripts/readme-gen/templates/auth_api_key.tmpl.rst",
"scripts/readme-gen/templates/install_deps.tmpl.rst",
"scripts/readme-gen/templates/install_portaudio.tmpl.rst",
"setup.cfg",
"testing/.gitignore",
"tests/unit/gapic/firestore_admin_v1/__init__.py",
"tests/unit/gapic/firestore_admin_v1/test_firestore_admin.py",
"tests/unit/gapic/firestore_v1/__init__.py",
"tests/unit/gapic/firestore_v1/test_firestore.py"
]
}