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


Changes
-------

Added more thorough test coverage, build is now green.


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\"]}]}, \"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

Reply via email to