| OLD | NEW |
| 1 # Appengine Frontend for Clovis | 1 # Appengine Frontend for Clovis |
| 2 | 2 |
| 3 [TOC] | 3 [TOC] |
| 4 | 4 |
| 5 ## Usage | 5 ## Usage |
| 6 | 6 |
| 7 Visit the application URL in your browser, and upload a JSON dictionary with the | 7 Visit the application URL in your browser, and upload a JSON dictionary with the |
| 8 following keys: | 8 following keys: |
| 9 | 9 |
| 10 - `action` (string): the action to perform. Only `trace` and `report` are | 10 - `action` (string): the action to perform. Only `trace` and `report` are |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 Finds all the traces in the specified bucket and generates a report in BigQuery. | 47 Finds all the traces in the specified bucket and generates a report in BigQuery. |
| 48 | 48 |
| 49 - `trace_bucket` (string): Name of the storage bucket where trace databases can | 49 - `trace_bucket` (string): Name of the storage bucket where trace databases can |
| 50 be found. It can be either absolute or relative to the `storage_bucket` | 50 be found. It can be either absolute or relative to the `storage_bucket` |
| 51 specified in the backend parameters. | 51 specified in the backend parameters. |
| 52 | 52 |
| 53 This requires an existing `clovis_dataset.report` BigQuery table that will be | 53 This requires an existing `clovis_dataset.report` BigQuery table that will be |
| 54 used as a template. The schema of this template is not updated automatically and | 54 used as a template. The schema of this template is not updated automatically and |
| 55 must match the format of the report (as generated by `report.py`). | 55 must match the format of the report (as generated by `report.py`). |
| 56 To update the schema manually, delete and recreate the `clovis_dataset.report` | 56 See [how to update the schema manually][7]. |
| 57 from the BigQuery web interface as an empty table with the new schema. | |
| 58 | 57 |
| 59 ## Development | 58 ## Development |
| 60 | 59 |
| 61 ### Design overview | 60 ### Design overview |
| 62 | 61 |
| 63 This is a [python AppEngine][5] application using [Flask][6]. | 62 This is a [python AppEngine][5] application using [Flask][6]. |
| 64 | 63 |
| 65 - Appengine configuration: | 64 - Appengine configuration: |
| 66 - `app.yaml` defines the handlers. There is a static handler for all URLs | 65 - `app.yaml` defines the handlers. There is a static handler for all URLs |
| 67 in the `static/` directory, and all other URLs are handled by the | 66 in the `static/` directory, and all other URLs are handled by the |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 # Install dependencies in the lib/ directory. | 119 # Install dependencies in the lib/ directory. |
| 121 pip install -r requirements.txt -t lib | 120 pip install -r requirements.txt -t lib |
| 122 # Deploy. | 121 # Deploy. |
| 123 gcloud preview app deploy app.yaml | 122 gcloud preview app deploy app.yaml |
| 124 ``` | 123 ``` |
| 125 | 124 |
| 126 ### Updating the Database Schema | 125 ### Updating the Database Schema |
| 127 | 126 |
| 128 When a change is made to the dictionary returned by report.py, the BigQuery | 127 When a change is made to the dictionary returned by report.py, the BigQuery |
| 129 database schema must be updated accordingly. | 128 database schema must be updated accordingly. |
| 130 Then, to actually update the schema, run: | 129 |
| 130 To update the schema, run: |
| 131 | 131 |
| 132 ```shell | 132 ```shell |
| 133 bq update \ | 133 bq update \ |
| 134 --schema \ | 134 --schema \ |
| 135 $CHROMIUM_SRC/tools/android/loading/cloud/frontend/bigquery_schema.json \ | 135 $CHROMIUM_SRC/tools/android/loading/cloud/frontend/bigquery_schema.json \ |
| 136 -t clovis_dataset.report | 136 -t clovis_dataset.report |
| 137 ``` | 137 ``` |
| 138 | 138 |
| 139 Adding a new field is harmless, but don't modify existing ones. | 139 Adding a new field is harmless, but don't modify existing ones. |
| 140 | 140 |
| 141 If the above command does not work, this is probably because you are doing more |
| 142 than adding fields. |
| 143 In this case, you can delete and recreate the `clovis_dataset.report` table from |
| 144 the [BigQuery web interface][8]: |
| 145 - Expand `clovis_dataset` from the left menu, and delete the `report` table. |
| 146 - Create a new table in `clovis_dataset`, and call it `report`. |
| 147 - Set `Location` to `None` in order to create an empty table. |
| 148 - Click `Edit as Text` in the `Schema` section , and paste the contents of |
| 149 `bigquery_schema.json` there. |
| 150 |
| 141 | 151 |
| 142 [1]: https://cloud.google.com/sdk | 152 [1]: https://cloud.google.com/sdk |
| 143 [2]: https://cloud.google.com/appengine/docs/python/taskqueue | 153 [2]: https://cloud.google.com/appengine/docs/python/taskqueue |
| 144 [3]: https://cloud.google.com/appengine/docs/python/config/queue | 154 [3]: https://cloud.google.com/appengine/docs/python/config/queue |
| 145 [4]: ../backend/README.md#Deploy-the-code | 155 [4]: ../backend/README.md#Deploy-the-code |
| 146 [5]: https://cloud.google.com/appengine/docs/python | 156 [5]: https://cloud.google.com/appengine/docs/python |
| 147 [6]: http://flask.pocoo.org | 157 [6]: http://flask.pocoo.org |
| 158 [7]: #Updating-the-Database-Schema |
| 159 [8]: https://bigquery.cloud.google.com |
| OLD | NEW |