Make uwsgi app to not demonize 29/58929/6
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Fri, 22 Jun 2018 15:04:14 +0000 (16:04 +0100)
committerMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
Tue, 10 Jul 2018 12:28:40 +0000 (13:28 +0100)
Supervisord doesn't support demonize applications, thus we have to
make the uwsgi application to run not in background.

- Fixed Yardstick API path.
- Fixed HttpClient class to raise correct exception when
  the HTML response (not JSON) like 4xx, 5xx is received.
  (http://docs.python-requests.org/en/master/user/quickstart/#json-response-content)

JIRA: YARDSTICK-1297

Change-Id: I4d1c1bb7266eeed0bd357bd28b91206d1580611f
Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
ansible/roles/configure_uwsgi/templates/yardstick.ini.j2
docker/Dockerfile
docker/Dockerfile.aarch64.patch
yardstick/common/httpClient.py

index 044f42a..495febb 100644 (file)
@@ -12,7 +12,7 @@ chmod-socket = 666
 callable = app_wrapper
 enable-threads = true
 close-on-exec = 1
-daemonize = {{ log_dir }}uwsgi.log
+logto = {{ log_dir }}/uwsgi.log
 socket = {{ socket_file }}
 {# If virtual environment, we need to add:
    virtualenv = <virtual_env> #}
index 097bc3c..71ce6b5 100644 (file)
@@ -51,6 +51,8 @@ EXPOSE 5000 5672
 ADD http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img ${IMAGE_DIR}
 ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img ${IMAGE_DIR}
 
+# For developers: when `docker build ...` is running from YARDSTICK_REPO_DIR, please change
+#                 path `./exec_tests.sh` -> `./docker/exec_tests.sh``.
 COPY ./exec_tests.sh /usr/local/bin/
 
 ENV NSB_DIR="/opt/nsb_bin"
index ef41cba..472310f 100644 (file)
@@ -8,7 +8,7 @@ Signed-off-by: ting wu <ting.wu@enea.com>
  1 file changed, 6 insertions(+), 5 deletions(-)
 
 diff --git a/docker/Dockerfile b/docker/Dockerfile
-index 62ea0d0..f2f41771 100644
+index 71ce6b58..952d0f78 100644
 --- a/docker/Dockerfile
 +++ b/docker/Dockerfile
 @@ -7,9 +7,9 @@
@@ -42,6 +42,5 @@ index 62ea0d0..f2f41771 100644
 +ADD http://download.cirros-cloud.net/daily/20161201/cirros-d161201-aarch64-disk.img ${IMAGE_DIR}
 +ADD http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-arm64-disk1.img ${IMAGE_DIR}
 
- COPY ./exec_tests.sh /usr/local/bin/
-
-
+ # For developers: when `docker build ...` is running from YARDSTICK_REPO_DIR, please change
+ #                 path `./exec_tests.sh` -> `./docker/exec_tests.sh``.
index 54f7be6..5b78311 100644 (file)
@@ -26,10 +26,11 @@ class HttpClient(object):
         while True:
             try:
                 response = requests.post(url, data=data, headers=headers)
+                response.raise_for_status()
                 result = response.json()
                 logger.debug('The result is: %s', result)
                 return result
-            except Exception:
+            except Exception: # pylint: disable=broad-except
                 if time.time() > t_end:
                     logger.exception('')
                     raise
@@ -37,4 +38,5 @@ class HttpClient(object):
 
     def get(self, url):
         response = requests.get(url)
+        response.raise_for_status()
         return response.json()