aurora-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David McLaughlin" <da...@dmclaughlin.com>
Subject Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
Date Tue, 22 Jul 2014 23:12:11 GMT


> On July 22, 2014, 10:52 p.m., David McLaughlin wrote:
> > Overall I think this is great. For my own curiosity - any reason why you've used
gson over the simple JSON protocol that comes with Thrift?
> 
> Bill Farner wrote:
>     TSimpleJSONProtocol is one-way, so it doesn't solve consumption of parameters.  I
originally looked into writing my own TProtocol, but my gut instinct would be that it would
be a lot more code without much payoff.

Makes sense, thanks. 


- David


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


On July 21, 2014, 4:59 p.m., Bill Farner wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/23741/
> -----------------------------------------------------------
> 
> (Updated July 21, 2014, 4:59 p.m.)
> 
> 
> Review request for Aurora, Kevin Sweeney and Maxim Khutornenko.
> 
> 
> Repository: aurora
> 
> 
> Description
> -------
> 
> In this change, i've added two outputs from thrift_wrapper_codegen.py:
> - A service metadata file (java) that maps RPC method names to parameter and type information
> - A series of html documents that describes methods and types used in the API (drawing
from javadoc-style comments in api.thrift)
> 
> ApiBeta.java consumes the metadata file, and uses it to instruct gson how to deserialize
incoming requests.  It in turn uses reflection to invoke the appropriate method on the thrift
interface implementation.
> 
> 
> Diffs
> -----
> 
>   build.gradle 751bde2f5052c66eac043f0b784c6e3bef9d3de3 
>   src/main/java/org/apache/aurora/scheduler/http/ServletModule.java 27599f75603542069084631baf9195b8ad75e902

>   src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java PRE-CREATION 
>   src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py 9d500baf82914733c0f92752d9570da009870aa9

>   src/main/thrift/org/apache/aurora/gen/api.thrift 8ee43fa1f0e2e699b0f1a321e673e49221b528ad

> 
> Diff: https://reviews.apache.org/r/23741/diff/
> 
> 
> Testing
> -------
> 
> Manually walked through /apibeta in a web browser, all links seem working and useful.
> 
> Started scheduler in vagrant, did some curling:
> 
> View the summary of all roles:
> 
> $ curl -s -X POST http://192.168.33.7:8081/apibeta/getRoleSummary | python -mjson.tool
> {
>     "DEPRECATEDversion": {
>         "major": 3
>     },
>     "details": [
>         {
>             "message": "Welcome, beta API user!  Please help us find and fix the bugs
that likely lurk in this API!"
>         }
>     ],
>     "responseCode": "OK",
>     "result": {
>         "summaries": [
>             {
>                 "cronJobCount": 0,
>                 "jobCount": 1,
>                 "role": "www-data"
>             }
>         ]
>     },
>     "serverInfo": {
>         "clusterName": "example",
>         "statsUrlPrefix": "",
>         "thriftAPIVersion": 3
>     }
> }
> 
> View the job summary for a role:
> 
> $ curl -s -X POST http://192.168.33.7:8081/apibeta/getJobSummary -d '{"role": "www-data"}'
| python -mjson.tool
> {
>     "DEPRECATEDversion": {
>         "major": 3
>     },
>     "details": [
>         {
>             "message": "Welcome, beta API user!  Please help us find and fix the bugs
that likely lurk in this API!"
>         }
>     ],
>     "responseCode": "OK",
>     "result": {
>         "summaries": [
>             {
>                 "job": {
>                     "instanceCount": 3,
>                     "key": {
>                         "environment": "devel",
>                         "name": "hello_world",
>                         "role": "www-data"
>                     },
>                     "owner": {
>                         "role": "www-data",
>                         "user": "vagrant"
>                     },
>                     "taskConfig": {
>                         "constraints": [
>                             {
>                                 "constraint": {
>                                     "limit": 1
>                                 },
>                                 "name": "host"
>                             }
>                         ],
>                         "diskMb": 8,
>                         "environment": "devel",
>                         "executorConfig": {
>                             "data": "{\"priority\": 0, \"health_check_config\": {\"initial_interval_secs\":
15.0, \"interval_secs\": 10.0, \"timeout_secs\": 1.0, \"max_consecutive_failures\": 0}, \"name\":
\"hello_world\", \"environment\": \"devel\", \"max_task_failures\": 1, \"task\": {\"processes\":
[{\"daemon\": false, \"name\": \"fetch_package\", \"ephemeral\": false, \"max_failures\":
1, \"min_duration\": 5, \"cmdline\": \"cp /vagrant/hello_world.py . && echo f182ae9a09cc7cea07dac9d595d5494a
&& chmod +x hello_world.py\", \"final\": false}, {\"daemon\": false, \"name\": \"hello_world\",
\"ephemeral\": false, \"max_failures\": 1, \"min_duration\": 5, \"cmdline\": \"python hello_world.py\",
\"final\": false}], \"name\": \"fetch_package\", \"finalization_wait\": 30, \"max_failures\":
1, \"max_concurrency\": 0, \"resources\": {\"disk\": 8388608, \"ram\": 1048576, \"cpu\": 1.0},
\"constraints\": [{\"order\": [\"fetch_package\", \"hello_world\"]}]}, \"enable_hooks\": false,
\"cluster
 \": \"devcluster\", \"production\": false, \"role\": \"www-data\"}",
>                             "name": "AuroraExecutor"
>                         },
>                         "isService": true,
>                         "jobName": "hello_world",
>                         "maxTaskFailures": 1,
>                         "metadata": [],
>                         "numCpus": 1.0,
>                         "owner": {
>                             "role": "www-data",
>                             "user": "vagrant"
>                         },
>                         "priority": 0,
>                         "production": false,
>                         "ramMb": 1,
>                         "requestedPorts": [],
>                         "taskLinks": {}
>                     }
>                 },
>                 "nextCronRunMs": 0,
>                 "stats": {
>                     "activeTaskCount": 1,
>                     "failedTaskCount": 1,
>                     "finishedTaskCount": 1,
>                     "pendingTaskCount": 0
>                 }
>             }
>         ]
>     },
>     "serverInfo": {
>         "clusterName": "example",
>         "statsUrlPrefix": "",
>         "thriftAPIVersion": 3
>     }
> }
> 
> 
> Fetch failed tasks:
> 
> 
> $ curl -s -X POST http://192.168.33.7:8081/apibeta/getTasksStatus -d '{"query": {"statuses":
["FAILED"]}}' | python -mjson.tool
> {
>     "DEPRECATEDversion": {
>         "major": 3
>     },
>     "details": [
>         {
>             "message": "Welcome, beta API user!  Please help us find and fix the bugs
that likely lurk in this API!"
>         }
>     ],
>     "responseCode": "OK",
>     "result": {
>         "tasks": [
>             {
>                 "assignedTask": {
>                     "assignedPorts": {},
>                     "instanceId": 0,
>                     "slaveHost": "192.168.33.7",
>                     "slaveId": "20140717-215647-119646400-5050-11441-0",
>                     "task": {
>                         "constraints": [
>                             {
>                                 "constraint": {
>                                     "limit": 1
>                                 },
>                                 "name": "host"
>                             }
>                         ],
>                         "diskMb": 8,
>                         "environment": "devel",
>                         "executorConfig": {
>                             "data": "{\"priority\": 0, \"health_check_config\": {\"initial_interval_secs\":
15.0, \"interval_secs\": 10.0, \"timeout_secs\": 1.0, \"max_consecutive_failures\": 0}, \"name\":
\"hello_world\", \"environment\": \"devel\", \"max_task_failures\": 1, \"task\": {\"processes\":
[{\"daemon\": false, \"name\": \"fetch_package\", \"ephemeral\": false, \"max_failures\":
1, \"min_duration\": 5, \"cmdline\": \"cp /vagrant/hello_world.py . && echo f0cc21c10c2b91974b0cac2629bbee6c
&& chmod +x hello_world.py\", \"final\": false}, {\"daemon\": false, \"name\": \"hello_world\",
\"ephemeral\": false, \"max_failures\": 1, \"min_duration\": 5, \"cmdline\": \"python hello_world.py\",
\"final\": false}], \"name\": \"fetch_package\", \"finalization_wait\": 30, \"max_failures\":
1, \"max_concurrency\": 0, \"resources\": {\"disk\": 8388608, \"ram\": 1048576, \"cpu\": 1.0},
\"constraints\": [{\"order\": [\"fetch_package\", \"hello_world\"]}]}, \"enable_hooks\": false,
\"cluster
 \": \"devcluster\", \"production\": false, \"role\": \"www-data\"}",
>                             "name": "AuroraExecutor"
>                         },
>                         "isService": true,
>                         "jobName": "hello_world",
>                         "maxTaskFailures": 1,
>                         "metadata": [],
>                         "numCpus": 1.0,
>                         "owner": {
>                             "role": "www-data",
>                             "user": "vagrant"
>                         },
>                         "priority": 0,
>                         "production": false,
>                         "ramMb": 1,
>                         "requestedPorts": [],
>                         "taskLinks": {}
>                     },
>                     "taskId": "1405961615070-www-data-devel-hello_world-0-a6768198-8365-4053-a769-744b0c9f8f80"
>                 },
>                 "failureCount": 1,
>                 "status": "FAILED",
>                 "taskEvents": [
>                     {
>                         "scheduler": "192.168.33.7",
>                         "status": "PENDING",
>                         "timestamp": 1405961615081
>                     },
>                     {
>                         "scheduler": "192.168.33.7",
>                         "status": "ASSIGNED",
>                         "timestamp": 1405961615110
>                     },
>                     {
>                         "message": "Initializing sandbox.",
>                         "scheduler": "192.168.33.7",
>                         "status": "STARTING",
>                         "timestamp": 1405961615607
>                     },
>                     {
>                         "scheduler": "192.168.33.7",
>                         "status": "RUNNING",
>                         "timestamp": 1405961616166
>                     },
>                     {
>                         "message": "Task failed.",
>                         "scheduler": "192.168.33.7",
>                         "status": "FAILED",
>                         "timestamp": 1405961618189
>                     }
>                 ]
>             }
>         ]
>     },
>     "serverInfo": {
>         "clusterName": "example",
>         "statsUrlPrefix": "",
>         "thriftAPIVersion": 3
>     }
> }
> 
> 
> Thanks,
> 
> Bill Farner
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message