Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48897 --- All ship-its have been given, but i'll give you guys until EOD to veto the latest patch. - Bill Farner On July 26, 2014, 6:16 p.m., Bill Farner wrote: --- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/ --- (Updated July 26, 2014, 6:16 p.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,
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48905 --- build.gradle https://reviews.apache.org/r/23741/#comment85685 Is there an actual dependency conflict here? - 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\:
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- 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\:
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/ --- (Updated July 25, 2014, 6:07 p.m.) Review request for Aurora, Kevin Sweeney and Maxim Khutornenko. Changes --- Attaching ticket. Still some work to do on the testing front before this change is ready to go. 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 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
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/ --- (Updated July 26, 2014, 3:43 a.m.) Review request for Aurora, Kevin Sweeney and Maxim Khutornenko. Changes --- Added test coverage. Thanks for the nudge, David! There were several major issues with last round's code. I still have one strange findbugs error to address, but that shouldn't change the shape of things much. 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 (updated) - 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\]}]},
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48442 --- 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? src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java https://reviews.apache.org/r/23741/#comment85048 We could probably remove this message.. I'm not sure it will have the desired effect. On the subject of testing though, is it worth hitting this API in the end to end tests? - David McLaughlin 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\,
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
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\:
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48449 --- Ship it! lgtm. - David McLaughlin 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,
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48450 --- Ship it! src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java https://reviews.apache.org/r/23741/#comment85067 Should this location be hardcoded like this or can it be injected? Right now I wouldn't expect removing ITaskConfig to break autogenerated documentation. - Kevin Sweeney On July 21, 2014, 9:59 a.m., Bill Farner wrote: --- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/ --- (Updated July 21, 2014, 9:59 a.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\,
Re: Review Request 23741: Add a human-friendly HTTP/JSON API with auto-generated documentation.
--- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/23741/#review48327 --- Ship it! src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java https://reviews.apache.org/r/23741/#comment85099 Since metadata is extracted using method name, would it make sense to wrap this into a LoadingCache? Might save a bit of perf by not going through class metadata every time a method is called. src/main/java/org/apache/aurora/scheduler/http/api/ApiBeta.java https://reviews.apache.org/r/23741/#comment84816 If you decide to keep it move it into constant? - Maxim Khutornenko 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\,