Call to `googleapiclient.discovery.build` hangs for several minutes
See original GitHub issueWe’ve (the Cloud Profiler team) been seeing some prober and E2E test failures for our python agent (repo at https://github.com/GoogleCloudPlatform/cloud-profiler-python) where calls to googleapiclient.discovery.build
hangs for until our benchmark application finishes (this is 10 minutes), and are wondering if this is expected.
Environment details
- OS type and version: Linux (Using GCP image project ubuntu-os-cloud and image family ubuntu-1804-lts)
- Python version: Python 3.5
- pip version:
pip --version
google-api-python-client
version: 1.12.3 (will confirm this)
Steps to reproduce
This is consistently happening in our E2E tests and probers which run on GCE VMs in us-west2-a (we also run probers in asia-east1-c and europe-west1-b, which aren’t experiencing this) when we call:
googleapiclient.discovery.build(
'cloudprofiler',
'v2',
http=http,
cache_discovery=False,
requestBuilder=ProfilerHttpRequest,
discoveryServiceUrl= googleapiclient.discovery.DISCOVERY_URI)
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Python BigQuery really strange timeout - Stack Overflow
## some code that takes 5 minutes to execute r = load_mappings() ## aka long operation ## this hangs service.tabledata().insertAll(...) If i ...
Read more >[Fixed] ModuleNotFoundError: No module named 'google'
Quick Fix: Python raises the ImportError: No module named 'googleapiclient' when it cannot find the library google-api-python-client .
Read more >Release Notes for the Google API Client Library for .NET
1 and there is a problem in building the project using Google.Apis.Release tool), code review. Issue 475: Clicking the back button on WP...
Read more >Getting Started w/ Python on GCP - Medium
The convention is to call the virtualenv environment 'venv' but you ... Let's write some Python ... from apiclient.discovery import build
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would recommend downloading the discovery json and using
build_from_document
. https://github.com/googleapis/google-api-python-client/blob/30eff9d8276919b8c4e50df2d3b1982594423692/googleapiclient/discovery.py#L394 That way you won’t be dependent on the discovery doc being up.This quarter we’ll be restructuring the library to have a copy of all the discovery docs locally so the workaround will be temporary.
Incident is now resolved.