HUE-7667 [core] Fix http client pool by correctly mounting Transport Adapter to a prefix.

Review Request #12102 - Created Nov. 28, 2017 and submitted

Prakash Ranade
hue
master
hue
enricoberti, jennykim, jgauthier, johan, krish, ranade, romain, subrata, weixia, yingc
commit c252436bb4dffdc4f6eb451539cc5cabb3e6b072
Author: Prakash Ranade <ranade@cloudera.com>
Date:   Wed Nov 22 20:42:27 2017 -0800

    HUE-7667 [core] Fix http client pool by correctly mounting Transport Adapter to a prefix.

:100644 100644 a3b333587e... 232893be6c... M	desktop/core/src/desktop/lib/rest/http_client.py

tested on nightly 5.13 and personal cluster

  • 0
  • 0
  • 7
  • 3
  • 10
Description From Last Updated
  1. A few nits but this is great!

  2. nit: move at line 22 with new lines around

    (Python imports are always on top)

  3. Curious:

    Would

    CACHE_SESSION = requests.Session()

    work?

  4. nit:

    if not CACHE_SESSION.adapters.get(url):

    (more Pythonic, if URL is not there get(url) returns None which is like False)

  5. Nit: one line

    return ...

    1. i prefer this way.

    2. This is more a convention for cleaner code, people rading the code would not need to undertand an extra variable

  6. 
      
  1. also commit message --> 'HUE-7667 [core]'

  2. 
      
  1. 
      
  2. New line after global

  3. with
    good with Python 2.6?

    1. yes the code is tested on Python 2.6.6

  4. Ha, so that was the trick, one session by mount point?

    1. you need to publish such coding guideline.

  5. Redefines base_url which is a parameter of the function already and it complicating the code for no reason

  6. 
      
  1. Fantastic! I think we're there! I've been running Jmeter on it for about 10 minutes without any extraneous 401 attempts! I'll let it run for a few hours just in case, but I believe we're good to go.

  2. 
      
Review request changed

Status: Closed (submitted)

Loading...