Return-Path: X-Original-To: apmail-aurora-reviews-archive@minotaur.apache.org Delivered-To: apmail-aurora-reviews-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4103811737 for ; Tue, 29 Jul 2014 00:32:47 +0000 (UTC) Received: (qmail 45649 invoked by uid 500); 29 Jul 2014 00:32:47 -0000 Delivered-To: apmail-aurora-reviews-archive@aurora.apache.org Received: (qmail 45610 invoked by uid 500); 29 Jul 2014 00:32:47 -0000 Mailing-List: contact reviews-help@aurora.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: reviews@aurora.incubator.apache.org Delivered-To: mailing list reviews@aurora.incubator.apache.org Received: (qmail 45599 invoked by uid 99); 29 Jul 2014 00:32:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jul 2014 00:32:46 +0000 X-ASF-Spam-Status: No, hits=-1998.4 required=5.0 tests=ALL_TRUSTED,HTML_MESSAGE,RP_MATCHES_RCVD,WEIRD_PORT X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 29 Jul 2014 00:32:44 +0000 Received: (qmail 45473 invoked by uid 99); 29 Jul 2014 00:32:24 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jul 2014 00:32:24 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 9E69E1DBAFA; Tue, 29 Jul 2014 00:32:11 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============0853979110058232978==" MIME-Version: 1.0 Subject: Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation. From: "Kevin Sweeney" To: "Maxim Khutornenko" , "Kevin Sweeney" Cc: "Bill Farner" , "Aurora" Date: Tue, 29 Jul 2014 00:32:11 -0000 Message-ID: <20140729003211.18793.7121@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org Auto-Submitted: auto-generated Sender: "Kevin Sweeney" X-ReviewGroup: Aurora X-ReviewRequest-URL: https://reviews.apache.org/r/23741/ X-Sender: "Kevin Sweeney" References: <20140726181620.4203.8704@reviews.apache.org> In-Reply-To: <20140726181620.4203.8704@reviews.apache.org> Reply-To: "Kevin Sweeney" X-ReviewRequest-Repository: aurora X-Virus-Checked: Checked by ClamAV on apache.org --===============0853979110058232978== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48949 ----------------------------------------------------------- Ship it! Ship It! - Kevin Sweeney On July 26, 2014, 11:16 a.m., Bill Farner wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/23741/ > ----------------------------------------------------------- > > (Updated July 26, 2014, 11:16 a.m.) > > > Review request for Aurora, Kevin Sweeney and Maxim Khutornenko. > > > Bugs: AURORA-369 > https://issues.apache.org/jira/browse/AURORA-369 > > > 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 df0af9838f20d02f35427559a22a01e2274bdff4 > src/main/java/org/apache/aurora/scheduler/http/ServletModule.java 729e0ab035b29dc570a2128266112db5312138ed > src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java PRE-CREATION > src/main/java/org/apache/aurora/scheduler/http/api/GsonMessageBodyHandler.java PRE-CREATION > src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py 9d500baf82914733c0f92752d9570da009870aa9 > src/main/thrift/org/apache/aurora/gen/api.thrift 978525efb1f318ec6d728dd32ac4e89c310cbc48 > src/test/java/org/apache/aurora/scheduler/http/ServletFilterTest.java PRE-CREATION > src/test/java/org/apache/aurora/scheduler/http/ServletModuleTest.java 90a001b38ce35fe4da666febde328c1af30f9663 > src/test/java/org/apache/aurora/scheduler/http/api/ApiBetaTest.java PRE-CREATION > > 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 > > --===============0853979110058232978==--