-
Notifications
You must be signed in to change notification settings - Fork 1
/
manage.py
52 lines (41 loc) · 1.21 KB
/
manage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import click
from werkzeug.serving import run_simple
from ottomen.web import application
from ottomen import settings
from ottomen.manage.database import database
from ottomen.manage.accounts import accounts
from ottomen.web.api import create_app
from ottomen.core import db, mem
from ottomen.algorithm.experiment import *
from ottomen.algorithm import globals
from ottomen.algorithm.worker import *
from tests import populate_db
app = create_app()
db.app = app
@click.group()
def cli():
pass
cli.add_command(database)
cli.add_command(accounts)
@cli.command()
def runserver():
"Starts the web server"
run_simple('0.0.0.0', settings.PORT, application, use_reloader=settings.DEBUG, use_debugger=settings.DEBUG)
@cli.command()
def seed():
db.drop_all()
db.create_all()
mem.flushdb()
mem.flushall()
populate_db(db.session)
set_sizes = 500
set_limit = 200
worker_id = 'turkleton'
exp = new_experiment(1337, 0.98, set_limit=set_limit, set_sizes=set_sizes)
db_worker = workers.save(Worker(id=worker_id))
task = new_task('1337', 1337)
worker = workers.new_mem(1337, db_worker)
validated_qs_batch = 25
session_id = 'gaysession'
if __name__ == '__main__':
cli()