This module implements the functionality of the Thor Server, a web service for performing Bayesian optimization. This site is responsible for presenting a visual overview of a user's machine learning and parameter tuning experiments and for providing references to tutorials and software downloads of client-side applications.
In order to install and operate the Thor Server, please follow these steps:
- Ensure that you have installed the requirements for Thor and Thor-Server by executing
pip install -r requirements.txt.
- Create a local directory
instanceand a config file
local_config.pyin that directory to hold configuration variables specific to your configuration, e.g.:
SQLALCHEMY_DATABASE_URI- defaults to user
SECRET_KEY- for sessions; see How to generate good secret keys, under "Sessions"
MAIL_*- as appropriate
- Create a user and database to match your
- Execute the following block of code to set up the Thor database:
python db.py db init python db.py db migrate python db.py db upgrade head
- To run the Thor Server on your computer's localhost, simply run
makefrom the root directory of this repository. For development, run
make devto enable automatic application reloads whenever code changes as well as verbose (debug) logging.
Updates / schema migrations
Thor Server uses alembic for database schema migrations via flask-migrate. Migration support and versioning scripts are stored under
migrations/. When new
schema migrations are added, update an existing database using the
python db.py db upgrade head
It is probably best to test this first and to ensure backups are up to date before applying to production instances.
During development, after you change the models/schema, start a new migration
python db.py db migrate
Alembic will attempt to auto-generate the script for you, but note that its ability to detect changes is limited, and the generated script should be thought of as a starting point for your review. Be sure to examine the generated migration script before applying and committing.
To add a description to the migration name to help the versioning script stand out a little more, use
python db.py db migrate -m "add is_published column"
When a new migration script is complete, upgrade schemas using
upgrade as described above.
Documentation for using Thor's API clients, which exist presently for Python, MATLAB, and R, will be hosted online as well as made available as inline comments in the client source code.
Documentation for Python and MATLAB will be hosted on a corresponding site on Read the Docs. Documentation for R will be provided through CRAN or through the R client's dedicated page on GitHub.
For deployment it can be useful to have an email account setup to dispense messages. This can be accomplished by nagivating to the file
./website/__init__.py and modifying the application attributes
app.config["MAIL_USERNAME"] = "email@example.com" app.config["MAIL_PASSWORD"] = "this.is.a.password"
Enter the gmail address and the password you want to use.
tests.py contains a minimal set of basic tests of basic site functions. To