question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Call to `googleapiclient.discovery.build` hangs for several minutes

See original GitHub issue

We’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:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
busunkim96commented, Oct 7, 2020

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.

0reactions
busunkim96commented, Oct 8, 2020

Incident is now resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Call to `googleapiclient.discovery.build ` hangs for several minutes.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found