You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@aurora.apache.org by Reza Motamedi <re...@gmail.com> on 2018/04/16 15:41:37 UTC

Review Request 66623: Fix the json endpoints in thermos

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66623/
-----------------------------------------------------------

Review request for Aurora, David McLaughlin, Santhosh Kumar Shanmugham, and Stephan Erb.


Repository: aurora


Description
-------

# Fixing the json endpoints in thermos

`TaskObserverJSONBindings` is mixin that includes a few routes that serve info about tasks and processes in pure JSON format. The functions are overridden in the main bottle server, so the routes are not accessible. This patch fixes it by renaming those methods.

Check here:
https://github.com/apache/aurora/blob/master/src/main/python/apache/thermos/observer/http/http_observer.py#L72


Diffs
-----

  src/main/python/apache/thermos/observer/http/json.py 4ba53245173c253a3f9044f6971c58b7e856171e 
  src/test/python/apache/thermos/observer/http/BUILD 708f09bef0755baebb64759eb4e920a1e213765b 


Diff: https://reviews.apache.org/r/66623/diff/1/


Testing
-------

There was no unit test affected. 

After fixing the routes server the expected content.
```
? curl http://192.168.33.7:1338/j/task_ids
{"type": "all", "tasks": [{"status": "sleeping", "ram": 3727360, "state_timestamp": 1523728477, "threads": 2, "user": 0.24, "disk": 10117120, "launch_timestamp": 1523728477, "vms": 22990848, "rss": 3727360, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "system": 0.34, "ports": {}, "state": "ACTIVE", "role": "www-data", "cpu": 0.0, "nice": 0}], "num": 20, "task_count": 1, "offset": 0}%

? curl http://192.168.33.7:1338/j/task/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10113024, "ram": 3719168, "system": 0.33, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3719168, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%

? curl http://192.168.33.7:1338/j/task\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10141696, "ram": 3731456, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.24, "rss": 3731456, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%

? curl http://192.168.33.7:1338/j/process/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098/hello/0
{"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.34, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3735552, "cpu": 0.0, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}%

? curl http://192.168.33.7:1338/j/processes\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"hello": {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.25, "rss": 3735552, "cpu": 0.0005000061512750167, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}}}%
```


Thanks,

Reza Motamedi


Re: Review Request 66623: Fix the json endpoints in thermos

Posted by Aurora ReviewBot <wf...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66623/#review201216
-----------------------------------------------------------



Master (ad0bc5f) is red with this patch.
  ./build-support/jenkins/build.sh

100   281  100   281    0     0   1016      0 --:--:-- --:--:-- --:--:--  1016

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0   300    0     0    559      0 --:--:-- --:--:-- --:--:--   559

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
/usr/bin/python2.7: can't open file '/home/jenkins/jenkins-slave/workspace/AuroraBot/.home/.cache/pants/setup/bootstrap-Linux-x86_64/virtualenv-15.0.2/virtualenv.py': [Errno 2] No such file or directory
./pants: line 99: /home/jenkins/jenkins-slave/workspace/AuroraBot/.home/.cache/pants/setup/bootstrap-Linux-x86_64/1.4.0.dev23/bin/python: No such file or directory
Traceback (most recent call last):
  File "/dev/fd/63", line 7, in <module>
    
  File "/usr/lib/python2.7/json/__init__.py", line 290, in load
    **kw)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Pants thrift version  does not match expected version 0.10.0!
:api:generateThriftJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':api:generateThriftJava'.
> Process 'command '/home/jenkins/jenkins-slave/workspace/AuroraBot/build-support/thrift/thriftw'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 18s
7 actionable tasks: 1 executed, 6 up-to-date


I will refresh this build result if you post a review containing "@ReviewBot retry"

- Aurora ReviewBot


On April 16, 2018, 4:41 p.m., Reza Motamedi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66623/
> -----------------------------------------------------------
> 
> (Updated April 16, 2018, 4:41 p.m.)
> 
> 
> Review request for Aurora, David McLaughlin, Santhosh Kumar Shanmugham, and Stephan Erb.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> # Fixing the json endpoints in thermos
> 
> `TaskObserverJSONBindings` is mixin that includes a few routes that serve info about tasks and processes in pure JSON format. The functions are overridden in the main bottle server, so the routes are not accessible. This patch fixes it by renaming those methods.
> 
> Check here:
> https://github.com/apache/aurora/blob/master/src/main/python/apache/thermos/observer/http/http_observer.py#L72
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/observer/http/json.py 4ba53245173c253a3f9044f6971c58b7e856171e 
>   src/test/python/apache/thermos/observer/http/BUILD 708f09bef0755baebb64759eb4e920a1e213765b 
> 
> 
> Diff: https://reviews.apache.org/r/66623/diff/1/
> 
> 
> Testing
> -------
> 
> There was no unit test affected. 
> 
> After fixing the routes server the expected content.
> ```
> ? curl http://192.168.33.7:1338/j/task_ids
> {"type": "all", "tasks": [{"status": "sleeping", "ram": 3727360, "state_timestamp": 1523728477, "threads": 2, "user": 0.24, "disk": 10117120, "launch_timestamp": 1523728477, "vms": 22990848, "rss": 3727360, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "system": 0.34, "ports": {}, "state": "ACTIVE", "role": "www-data", "cpu": 0.0, "nice": 0}], "num": 20, "task_count": 1, "offset": 0}%
> 
> ? curl http://192.168.33.7:1338/j/task/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10113024, "ram": 3719168, "system": 0.33, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3719168, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/task\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10141696, "ram": 3731456, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.24, "rss": 3731456, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/process/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098/hello/0
> {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.34, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3735552, "cpu": 0.0, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}%
> 
> ? curl http://192.168.33.7:1338/j/processes\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"hello": {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.25, "rss": 3735552, "cpu": 0.0005000061512750167, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}}}%
> ```
> 
> 
> Thanks,
> 
> Reza Motamedi
> 
>


Re: Review Request 66623: Fix the json endpoints in thermos

Posted by Santhosh Kumar Shanmugham <sa...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66623/#review201336
-----------------------------------------------------------


Ship it!




Ship It!

- Santhosh Kumar Shanmugham


On April 16, 2018, 2:01 p.m., Reza Motamedi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66623/
> -----------------------------------------------------------
> 
> (Updated April 16, 2018, 2:01 p.m.)
> 
> 
> Review request for Aurora, David McLaughlin, Santhosh Kumar Shanmugham, and Stephan Erb.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> # Fixing the json endpoints in thermos
> 
> `TaskObserverJSONBindings` is mixin that includes a few routes that serve info about tasks and processes in pure JSON format. The functions are overridden in the main bottle server, so the routes are not accessible. This patch fixes it by renaming those methods.
> 
> Check here:
> https://github.com/apache/aurora/blob/master/src/main/python/apache/thermos/observer/http/http_observer.py#L72
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/observer/http/json.py 4ba53245173c253a3f9044f6971c58b7e856171e 
>   src/test/python/apache/thermos/observer/http/BUILD 708f09bef0755baebb64759eb4e920a1e213765b 
> 
> 
> Diff: https://reviews.apache.org/r/66623/diff/2/
> 
> 
> Testing
> -------
> 
> There was no unit test affected. 
> 
> After fixing the routes server the expected content.
> ```
> ? curl http://192.168.33.7:1338/j/task_ids
> {"type": "all", "tasks": [{"status": "sleeping", "ram": 3727360, "state_timestamp": 1523728477, "threads": 2, "user": 0.24, "disk": 10117120, "launch_timestamp": 1523728477, "vms": 22990848, "rss": 3727360, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "system": 0.34, "ports": {}, "state": "ACTIVE", "role": "www-data", "cpu": 0.0, "nice": 0}], "num": 20, "task_count": 1, "offset": 0}%
> 
> ? curl http://192.168.33.7:1338/j/task/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10113024, "ram": 3719168, "system": 0.33, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3719168, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/task\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10141696, "ram": 3731456, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.24, "rss": 3731456, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/process/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098/hello/0
> {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.34, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3735552, "cpu": 0.0, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}%
> 
> ? curl http://192.168.33.7:1338/j/processes\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"hello": {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.25, "rss": 3735552, "cpu": 0.0005000061512750167, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}}}%
> ```
> 
> 
> Thanks,
> 
> Reza Motamedi
> 
>


Re: Review Request 66623: Fix the json endpoints in thermos

Posted by Aurora ReviewBot <wf...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66623/#review201265
-----------------------------------------------------------


Ship it!




Master (ad0bc5f) is green with this patch.
  ./build-support/jenkins/build.sh

I will refresh this build result if you post a review containing "@ReviewBot retry"

- Aurora ReviewBot


On April 16, 2018, 9:01 p.m., Reza Motamedi wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/66623/
> -----------------------------------------------------------
> 
> (Updated April 16, 2018, 9:01 p.m.)
> 
> 
> Review request for Aurora, David McLaughlin, Santhosh Kumar Shanmugham, and Stephan Erb.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> # Fixing the json endpoints in thermos
> 
> `TaskObserverJSONBindings` is mixin that includes a few routes that serve info about tasks and processes in pure JSON format. The functions are overridden in the main bottle server, so the routes are not accessible. This patch fixes it by renaming those methods.
> 
> Check here:
> https://github.com/apache/aurora/blob/master/src/main/python/apache/thermos/observer/http/http_observer.py#L72
> 
> 
> Diffs
> -----
> 
>   src/main/python/apache/thermos/observer/http/json.py 4ba53245173c253a3f9044f6971c58b7e856171e 
>   src/test/python/apache/thermos/observer/http/BUILD 708f09bef0755baebb64759eb4e920a1e213765b 
> 
> 
> Diff: https://reviews.apache.org/r/66623/diff/2/
> 
> 
> Testing
> -------
> 
> There was no unit test affected. 
> 
> After fixing the routes server the expected content.
> ```
> ? curl http://192.168.33.7:1338/j/task_ids
> {"type": "all", "tasks": [{"status": "sleeping", "ram": 3727360, "state_timestamp": 1523728477, "threads": 2, "user": 0.24, "disk": 10117120, "launch_timestamp": 1523728477, "vms": 22990848, "rss": 3727360, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "system": 0.34, "ports": {}, "state": "ACTIVE", "role": "www-data", "cpu": 0.0, "nice": 0}], "num": 20, "task_count": 1, "offset": 0}%
> 
> ? curl http://192.168.33.7:1338/j/task/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10113024, "ram": 3719168, "system": 0.33, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3719168, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/task\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10141696, "ram": 3731456, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.24, "rss": 3731456, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%
> 
> ? curl http://192.168.33.7:1338/j/process/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098/hello/0
> {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.34, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3735552, "cpu": 0.0, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}%
> 
> ? curl http://192.168.33.7:1338/j/processes\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
> {"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"hello": {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.25, "rss": 3735552, "cpu": 0.0005000061512750167, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}}}%
> ```
> 
> 
> Thanks,
> 
> Reza Motamedi
> 
>


Re: Review Request 66623: Fix the json endpoints in thermos

Posted by Reza Motamedi <re...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/66623/
-----------------------------------------------------------

(Updated April 16, 2018, 9:01 p.m.)


Review request for Aurora, David McLaughlin, Santhosh Kumar Shanmugham, and Stephan Erb.


Changes
-------

@ReviewBot retry


Repository: aurora


Description
-------

# Fixing the json endpoints in thermos

`TaskObserverJSONBindings` is mixin that includes a few routes that serve info about tasks and processes in pure JSON format. The functions are overridden in the main bottle server, so the routes are not accessible. This patch fixes it by renaming those methods.

Check here:
https://github.com/apache/aurora/blob/master/src/main/python/apache/thermos/observer/http/http_observer.py#L72


Diffs (updated)
-----

  src/main/python/apache/thermos/observer/http/json.py 4ba53245173c253a3f9044f6971c58b7e856171e 
  src/test/python/apache/thermos/observer/http/BUILD 708f09bef0755baebb64759eb4e920a1e213765b 


Diff: https://reviews.apache.org/r/66623/diff/2/

Changes: https://reviews.apache.org/r/66623/diff/1-2/


Testing
-------

There was no unit test affected. 

After fixing the routes server the expected content.
```
? curl http://192.168.33.7:1338/j/task_ids
{"type": "all", "tasks": [{"status": "sleeping", "ram": 3727360, "state_timestamp": 1523728477, "threads": 2, "user": 0.24, "disk": 10117120, "launch_timestamp": 1523728477, "vms": 22990848, "rss": 3727360, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "system": 0.34, "ports": {}, "state": "ACTIVE", "role": "www-data", "cpu": 0.0, "nice": 0}], "num": 20, "task_count": 1, "offset": 0}%

? curl http://192.168.33.7:1338/j/task/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10113024, "ram": 3719168, "system": 0.33, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3719168, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%

? curl http://192.168.33.7:1338/j/task\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"task": {"processes": [{"daemon": false, "name": "hello", "max_failures": 1, "ephemeral": false, "min_duration": 5, "cmdline": "\n    while true; do\n      echo hello world\n      sleep 10\n    done\n  ", "final": false}], "name": "hello", "finalization_wait": 30, "max_failures": 1, "max_concurrency": 0, "resources": {"gpu": 0, "disk": 134217728, "ram": 134217728, "cpu": 1.0}, "constraints": [{"order": ["hello"]}]}, "name": "hello", "task_id": "www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098", "processes": {"failed": [], "running": ["hello"], "killed": [], "success": [], "waiting": []}, "state_timestamp": 1523728477, "state": "ACTIVE", "resource_consumption": {"status": "sleeping", "disk": 10141696, "ram": 3731456, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.24, "rss": 3731456, "cpu": 0.0, "nice": 0}, "user": "www-data", "launch_timestamp": 1523728477, "ports": {}}}%

? curl http://192.168.33.7:1338/j/process/www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098/hello/0
{"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.34, "vms": 22990848, "threads": 2, "user": 0.24, "rss": 3735552, "cpu": 0.0, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}%

? curl http://192.168.33.7:1338/j/processes\?task_id\=www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098
{"www-data-prod-hello-0-00e58d09-a67f-4a46-94a0-15bcad26a098": {"hello": {"state": "RUNNING", "process_name": "hello", "used": {"status": "sleeping", "ram": 3735552, "system": 0.35, "vms": 22994944, "threads": 2, "user": 0.25, "rss": 3735552, "cpu": 0.0005000061512750167, "nice": 0}, "start_time": 1523728477.867429, "process_run": 0}}}%
```


Thanks,

Reza Motamedi