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.

Long time for running endpoint.all() function

See original GitHub issue

Issue description

I’m trying to get all change logs like the way https://pynetbox.readthedocs.io/en/stable/advanced.html has described. But got quite a long time to execute pynetbox.extras.object_changes.all(). I’ve traced the running time, just as below:

         10183574 function calls (10047882 primitive calls) in 41.631 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.007    0.007   41.632   41.632 /my/python/lib/python3.8/site-packages/pynetbox/core/endpoint.py:80(all)
        1    0.000    0.000   38.262   38.262 /my/python/lib/python3.8/site-packages/pynetbox/core/query.py:295(get)
        1    0.001    0.001   38.262   38.262 /my/python/lib/python3.8/site-packages/pynetbox/core/query.py:308(req_all)
       14    0.000    0.000   38.261    2.733 /my/python/lib/python3.8/site-packages/pynetbox/core/query.py:245(_make_call)
       14    0.000    0.000   38.020    2.716 /my/python/lib/python3.8/site-packages/requests/sessions.py:546(get)
       14    0.000    0.000   38.020    2.716 /my/python/lib/python3.8/site-packages/requests/sessions.py:470(request)
       14    0.001    0.000   37.988    2.713 /my/python/lib/python3.8/site-packages/requests/sessions.py:626(send)
     3693    0.009    0.000   37.804    0.010 /usr/local/lib/python3.8/socket.py:655(readinto)
     3693    0.008    0.000   37.789    0.010 /usr/local/lib/python3.8/ssl.py:1230(recv_into)
     3693    0.006    0.000   37.779    0.010 /usr/local/lib/python3.8/ssl.py:1090(read)
     3693   37.773    0.010   37.773    0.010 {method 'read' of '_ssl._SSLSocket' objects}
...

while using requests.get() directly, it returns:

         12782 function calls (12695 primitive calls) in 0.071 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    0.000    0.000    0.071    0.071 /my/python/lib/python3.8/site-packages/requests/api.py:64(get)
        1    0.000    0.000    0.071    0.071 /my/python/lib/python3.8/site-packages/requests/api.py:16(request)
        1    0.000    0.000    0.070    0.070 /my/python/lib/python3.8/site-packages/requests/sessions.py:470(request)
        1    0.000    0.000    0.068    0.068 /my/python/lib/python3.8/site-packages/requests/sessions.py:626(send)
        1    0.000    0.000    0.057    0.057 /my/python/lib/python3.8/site-packages/requests/adapters.py:394(send)
        1    0.000    0.000    0.056    0.056 /my/python/lib/python3.8/site-packages/urllib3/connectionpool.py:522(urlopen)
        1    0.000    0.000    0.056    0.056 /my/python/lib/python3.8/site-packages/urllib3/connectionpool.py:361(_make_request)
       21    0.000    0.000    0.046    0.002 /usr/local/lib/python3.8/socket.py:655(readinto)
       21    0.000    0.000    0.046    0.002 /usr/local/lib/python3.8/ssl.py:1230(recv_into)
       21    0.000    0.000    0.046    0.002 /usr/local/lib/python3.8/ssl.py:1090(read)
       21    0.046    0.002    0.046    0.002 {method 'read' of '_ssl._SSLSocket' objects}
...

Is there anyone else facing the same problem {method 'read' of '_ssl._SSLSocket' objects} takes such long please?

packages version

$ pip freeze
pynetbox==5.3.1
requests==2.26.0
...
netbox: 3.0.8

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
markkuleiniocommented, Feb 15, 2022
1reaction
z-8-dcommented, Feb 15, 2022

@markkuleinio - Appreciate a lot. That helps so much. I’ll try for a bit more. Hope you have a good rest of the day. Closing this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling long Web Requests with Asynchronous Request ...
Long requests can time out the Web server Web servers are set up with certain timeouts to kill connections after the timeout period...
Read more >
How to deal with long running Azure Functions in Azure Data ...
I have a Function (HttpTrigger) that can take a bit to run 5-10 minutes. It reads some information from the body of the...
Read more >
Django - run a function every x seconds - Stack Overflow
I'm working on a Django app. I have an API endpoint, which if requested, must carry out ...
Read more >
Runtime - R Plumber
This technique allows all endpoints and filters to share some data defined at the top-level of your API. Environments. By default, when you...
Read more >
Manage functions | Cloud Functions for Firebase - Google
firebase deploy --only functions. By default, the Firebase CLI deploys all of the functions inside index.js at the same time. If your project...
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