Joshua Hesketh | 3b7765d | 2013-11-18 13:06:20 +1100 | [diff] [blame] | 1 | :title: Running |
| 2 | |
| 3 | |
| 4 | Running |
| 5 | ======= |
| 6 | |
Lana Brindley | ec7637a | 2014-01-17 13:32:17 +1000 | [diff] [blame^] | 7 | Starting turbo-hipster |
| 8 | ---------------------- |
| 9 | |
| 10 | Turbo-hipster can be run from the command line:: |
| 11 | |
| 12 | $ ./turbo-hipster/worker_server.py |
| 13 | |
| 14 | This option allows you to pass parameters to turbo-hipster. Use the --help |
| 15 | parameter to see a full list. |
| 16 | |
| 17 | +-------+--------------+--------------------------------------------------------+ |
| 18 | | Short | Long | Description | |
| 19 | +=======+==============+========================================================+ |
| 20 | | -c | --config | Print the path to the configuration file and exit | |
| 21 | +-------+--------------+--------------------------------------------------------+ |
| 22 | | -b | --background | Run as a daemon in the background | |
| 23 | +-------+--------------+--------------------------------------------------------+ |
| 24 | | -p | --pidfile | Specify the PID file to lock while running as a daemon | |
| 25 | +-------+--------------+--------------------------------------------------------+ |
| 26 | |
| 27 | Alternatively, you can start turbo-hipster as a service. |
| 28 | |
| 29 | 1. Copy the turbo-hipster init.d script to /etc/init.d/: |
| 30 | |
| 31 | $ sudo cp etc/init.d/turbo-hipster /etc/init.d/ |
| 32 | |
| 33 | 2. Reload the script with the default configuration: |
| 34 | |
| 35 | $ sudo update-rc.d turbo-hipster defaults |
| 36 | |
| 37 | 3. Start the service: |
| 38 | |
| 39 | $ sudo service turbo-hipster start |
| 40 | |
| 41 | Plugins |
| 42 | ======= |
| 43 | |
| 44 | Plugins can be used to extend turbo-hipster's capabilities. |
| 45 | |
| 46 | .. note:: |
| 47 | Currently, the only available plugin for turbo-hipster is the |
| 48 | Database Migration plugin, ``gate_real_db_upgrade``, which tests code |
| 49 | against a variety of real-world databases. |
| 50 | |
| 51 | Installing plugins |
| 52 | ------------------ |
| 53 | |
| 54 | Turbo-hipster plugins are responsible for handling the jobs that are passed |
| 55 | to it. They must successfully build reports and publish them according to |
| 56 | their configuration. They must also be able to communicate test results back |
| 57 | to Zuul using Gearman. |
| 58 | |
| 59 | Plugins must take a standard format in order to be able to work correctly |
| 60 | with turbo-hipster. They must contain a ``task.py`` file with a ``Runner`` |
| 61 | class. |
| 62 | |
| 63 | Once you have created a turbo-hipster plugin, you need to configure it in |
| 64 | the ``config.json`` configuration file. |
| 65 | |
| 66 | .. FIXME More config information required here |
| 67 | |
| 68 | Plugin: Database migration with ``gate_real_db_upgrade`` |
| 69 | -------------------------------------------------------- |
| 70 | |
| 71 | The database migration plugin, ``gate_real_db_upgrade``, is used to test |
| 72 | datasets against real-world, anonymized, databases. |
| 73 | |
| 74 | Migrating a database |
| 75 | -------------------- |
| 76 | |
| 77 | In order to use turbo-hipster with the ``gate_real_db_upgrade`` plugin, you |
| 78 | need to set up the databases to test against, and point to the plugin in |
| 79 | turbo-hipster's configuration file. |
| 80 | |
| 81 | 1. Create a directory for the datasets: |
| 82 | |
| 83 | $ mkdir -p /var/lib/turbo-hipster/datasets |
| 84 | |
| 85 | 2. Copy the json dataset to the directory you created: |
| 86 | |
| 87 | $ cp /my/dataset.json /var/lib/turbo-hipster/datasets/ |
| 88 | |
| 89 | 3. Open the ``/etc/turbo-hipster/config.json`` file in your preferred |
| 90 | editor, locate the plugins section, and add this line:: |
| 91 | |
| 92 | **plugins** |
| 93 | gate_real_db_upgrade |
| 94 | |
| 95 | Testing with turbo-hipster |
| 96 | ========================== |
| 97 | |
| 98 | When turbo-hipster completes a test, it sends the result of the test back to |
| 99 | Gearman. These results contain a link to a compiled logfile for the test. |
| 100 | |
| 101 | If the test fails, or takes too long to complete, turbo-hipster will add a |
| 102 | review to your patchset that looks like this: |
| 103 | |
| 104 | .. image:: ../images/THTestResult.png |
| 105 | |
| 106 | Reading test reports |
| 107 | -------------------- |
| 108 | |
| 109 | An example of a standard log file: |
| 110 | http://thw01.rcbops.com/results/54/54202/5/check/gate-real-db-upgrade_nova_mysql_devstack_150/ddd6d53/20130910_devstack_applied_to_150.log |
| 111 | |
| 112 | An example of the same logfile, using the javascript logviewer: |
| 113 | http://thw01.rcbops.com/logviewer/?q=/results/54/54202/5/check/gate-real-db-upgrade_nova_mysql_devstack_150/ddd6d53/20130910_devstack_applied_to_150.log |
| 114 | |
| 115 | Test failure codes |
| 116 | ------------------ |
| 117 | |
| 118 | This section gives a list of failure codes, including some steps you can |
| 119 | take for troubleshooting errors: |
| 120 | |
| 121 | FAILURE - Did not find the end of a migration after a start |
| 122 | |
| 123 | If you look at the log you should find that a migration began but never |
| 124 | finished. Hopefully there'll be a traceroute for you to follow through to |
| 125 | get some hints about why it failed. |
| 126 | |
| 127 | WARNING - Migration %s took too long |
| 128 | |
| 129 | In this case your migration took a long time to run against one of the test |
| 130 | datasets. You should reconsider what operations your migration is performing |
| 131 | and see if there are any optimizations you can make, or if it is really |
| 132 | necessary. If there is no way to speed up your migration you can email us at |
| 133 | rcbau@rcbops.com for an exception. |
| 134 | |
| 135 | FAILURE - Final schema version does not match expectation |
| 136 | |
| 137 | Somewhere along the line the migrations stopped and did not reach the |
| 138 | expected version. Our datasets start at previous releases and have to |
| 139 | upgrade all the way through to the most current release. If you see this, |
| 140 | inspect the log for traceroutes or other hints about the failure. |
| 141 | |
| 142 | FAILURE - Could not setup seed database. |
| 143 | FAILURE - Could not find seed database. |
| 144 | |
| 145 | These errors are internal errors. If you see either of these, contact us at |
| 146 | rcbau@rcbops.com to let us know so we can fix and rerun the tests for you. |
| 147 | |
| 148 | FAILURE - Could not import required module. |
| 149 | |
| 150 | This error probably shouldn't happen as Jenkins should catch it in the unit |
| 151 | tests before Turbo-Hipster launches. If you see this, please contact us at |
| 152 | rcbau@rcbops.com and let us know. |
| 153 | |
| 154 | If you receive an error that you think is a false positive, leave a comment |
| 155 | on the review with the sole contents of "recheck migrations". |
| 156 | |
| 157 | If you have any questions/problems please contact us at rcbau@rcbops.com. |