-----------------------------------------------------------
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

Reply via email to