Initial commit

This commit is contained in:
AndyGrant committed 2018-06-09 15:21:19 -04:00
commit e33e7a50a4
24 files changed
+275

No files matched your search

View File
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.
+4
View File
@@ -0,0 +1,4 @@
from django.apps import AppConfig
class OpenbenchConfig(AppConfig):
name = 'OpenBench'
View File
Whitespace-only changes.
+74
View File
@@ -0,0 +1,74 @@
from django.db.models import CharField, IntegerField, BooleanField
from django.db.models import FloatField, ForeignKey, DateTimeField
from django.db.models import PROTECT, Model
class Engine(Model):
name = CharField(max_length=128)
source = CharField(max_length=1024)
proto = CharField(max_length=16)
sha = CharField(max_length=64)
bench = IntegerField(default=0)
def __str__(self):
return '{0} ({1})'.format(self.name, self.bench)
class Machine(Model):
owner = CharField(max_length=64)
osname = CharField(max_length=128)
lastseen = DateTimeField(auto_now=True)
def __str__(self):
return '{0}-{1} ({2})'.format(self.owner.name, self.osname, self.id)
class Workload(Model):
test = ForeignKey('Test', PROTECT, related_name='test')
machine = ForeignKey('Machine', PROTECT, related_name='machine')
games = IntegerField(default=0)
wins = IntegerField(default=0)
losses = IntegerField(default=0)
draws = IntegerField(default=0)
crashes = IntegerField(default=0)
time = IntegerField(default=0)
lastseen = DateTimeField(default=0)
def __str__(self):
return '{0} {1}'.format(self.test.dev.name, self.machine.__str__())
class Test(Model):
dev = ForeignKey('Engine', PROTECT, related_name='dev')
base = ForeignKey('Engine', PROTECT, related_name='base')
timecontrol = CharField(max_length=16)
hashsize = IntegerField(default=1)
threads = IntegerField(default=1)
priority = IntegerField(default=0)
throughput = IntegerField(default=0)
alpha = FloatField(default=0.0)
beta = FloatField(default=0.0)
elolower = FloatField(default=0.0)
eloupper = FloatField(default=0.0)
lowerllr = FloatField(default=0.0)
currentllr = FloatField(default=0.0)
upperllr = FloatField(default=0.0)
elo = FloatField(default=0.0)
games = IntegerField(default=0)
wins = IntegerField(default=0)
draws = IntegerField(default=0)
losses = IntegerField(default=0)
passed = BooleanField(default=False)
failed = BooleanField(default=False)
deleted = BooleanField(default=False)
def __str__(self):
return '{0} vs {1} @ {2}'.format(self.dev.name, self.base.name, self.timecontrol)
+3
View File
@@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.
+22
View File
@@ -0,0 +1,22 @@
from django.conf.urls import url
import OpenBench.views
urlpatterns = [
#url(r"all/$", EtherBench.views.allTests),
#url(r"index/$", EtherBench.views.index),
#url(r"index/([0-9]+)/$", EtherBench.views.index),
#url(r"greens/$", EtherBench.views.greens),
#url(r"greens/([0-9]+)/$", EtherBench.views.greens),
#url(r"register/$", EtherBench.views.register),
#url(r"login/$", EtherBench.views.login),
#url(r"logout/$", EtherBench.views.logout),
#url(r"newEngineTest/$", EtherBench.views.newEngineTest),
#url(r"editEngineTest/([0-9]+)/$", EtherBench.views.editEngineTest),
#url(r"getCoreFiles/$", EtherBench.views.getCoreFiles),
#url(r"getWorkload/([0-9]+)/$", EtherBench.views.getWorkload),
#url(r"submitResults/$", EtherBench.views.submitResults),
#url(r"wrongbench/([0-9]+)/$", EtherBench.views.wrongBench),
]
+3
View File
@@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.
View File
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+126
View File
@@ -0,0 +1,126 @@
"""
Django settings for OpenSite project.
Generated by 'django-admin startproject' using Django 2.0.6.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '@!zw2l8til1(0eb_nk+1w!(n78gqm&u)s)_v7#k6iseia@g9q0'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition
SETTINGS_DIR = os.path.dirname(__file__)
PROJECT_PATH = os.path.join(SETTINGS_DIR, os.pardir)
PROJECT_PATH = os.path.abspath(PROJECT_PATH)
TEMPLATE_PATH = os.path.join(PROJECT_PATH,'templates')
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'OpenBench',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'OpenSite.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'OpenSite.wsgi.application'
# Database
# https://docs.djangoproject.com/en/2.0/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.0/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
STATIC_URL = '/static/'
+9
View File
@@ -0,0 +1,9 @@
from django.contrib import admin
from django.urls import path, include
import OpenBench.urls
urlpatterns = [
path(r'admin/', admin.site.urls),
path(r'^', include(OpenBench.urls.urlpatterns)),
]
+16
View File
@@ -0,0 +1,16 @@
"""
WSGI config for OpenSite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "OpenSite.settings")
application = get_wsgi_application()
View File
Whitespace-only changes.
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "OpenSite.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)