Commit d4ab44e8 authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Fix vispa config queries, add possibility to disable alembic (e.g. for developing using SQLite).

parent 01bc5a93
[database]
#sqlalchemy.url = sqlite:////var/db/vispa.db
[alembic]
use_alembic = True
# inplace installation
script_location = vispa/models/alembic
# global installation
......@@ -27,9 +29,11 @@ text.welcome = Welcome to VISPA!
#text.forgot = Check your spam folder and uncheck no-reply@vispa.physik.rwth-aachen.de
use_forgot = False
[websockets]
enabled = False
[executable]
# pxlrun command options, call of executable will be:
# pre_command_options command post_command_options
......@@ -38,16 +42,19 @@ pre_command_options =
#pre_command_options = nice -n 19 ionice -c 3
post_command_options = -p
[BatchSystem]
# BatchSystem used for submission of jobs
manager = local
#manager = condor
[workspace]
# define default workspace id to use.
#default_workspace_id = 1
[user]
workspaces.add = True
workspaces.alter = True
......@@ -65,5 +72,6 @@ registration.forgot = http://localhost/forgot
registration.smpt_host = localhost
#registration.smpt_port = 25
[extensions]
ignore = dummy
......@@ -22,21 +22,19 @@ class JobPool(object):
self.__defaultmanager = "CondorBatchManager"
if vispa.config.has_section('BatchSystem'):
if vispa.config.has_option('BatchSystem', 'manager'):
readout = vispa.config.get('BatchSystem', 'manager')
if readout in ["local", "LocalBatchManager"]:
self.__defaultmanager = "LocalBatchManager"
elif readout in ["grid", "GridBatchManager"]:
self.__defaultmanager = "GridBatchManager"
elif readout in ["lsf", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["hpc", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["condor", "CondorBatchManager"]:
self.__defaultmanager = "CondorBatchManager"
else:
logging.getLogger("system.batchsystem").info("Could not recognize the shortcut of the default manager in vispa.ini configuration. Use one out of '%s' or use the exact name, e.g. 'CondorBatchManager' (without quotation marks)." % ("'local','grid','lsf','hpc','condor'"))
readout = vispa.config('BatchSystem', 'manager', "")
if readout in ["local", "LocalBatchManager"]:
self.__defaultmanager = "LocalBatchManager"
elif readout in ["grid", "GridBatchManager"]:
self.__defaultmanager = "GridBatchManager"
elif readout in ["lsf", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["hpc", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["condor", "CondorBatchManager"]:
self.__defaultmanager = "CondorBatchManager"
else:
logging.getLogger("system.batchsystem").info("Could not recognize the shortcut of the default manager in vispa.ini configuration. Use one out of '%s' or use the exact name, e.g. 'CondorBatchManager' (without quotation marks)." % ("'local','grid','lsf','hpc','condor'"))
logging.getLogger("system.batchsystem").info("Default batchsystem is '%s' ." % (self.__defaultmanager))
self._batchmanagerOutputFolder = "/tmp"
......
......@@ -32,22 +32,20 @@ class JobmanagementController(AbstractController):
self.__defaultmanager = "CondorBatchManager"
if vispa.config.has_section('BatchSystem'):
if vispa.config.has_option('BatchSystem', 'manager'):
readout = vispa.config.get('BatchSystem', 'manager')
if readout in ["local", "LocalBatchManager"]:
self.__defaultmanager = "LocalBatchManager"
logger.debug("setting default manager to %s" % self.__defaultmanager)
elif readout in ["grid", "GridBatchManager"]:
self.__defaultmanager = "GridBatchManager"
elif readout in ["lsf", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["hpc", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["condor", "CondorBatchManager"]:
self.__defaultmanager = "CondorBatchManager"
else:
logger.info("Could not recognize the shortcut of the default manager in vispa.ini configuration. Use one out of '%s' or use the exact name, e.g. 'CondorBatchManager' (without quotation marks)." % ("'local','grid','lsf','hpc','condor'"))
readout = vispa.config('BatchSystem', 'manager', "")
if readout in ["local", "LocalBatchManager"]:
self.__defaultmanager = "LocalBatchManager"
logger.debug("setting default manager to %s" % self.__defaultmanager)
elif readout in ["grid", "GridBatchManager"]:
self.__defaultmanager = "GridBatchManager"
elif readout in ["lsf", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["hpc", "LSFBatchManager"]:
self.__defaultmanager = "LSFBatchManager"
elif readout in ["condor", "CondorBatchManager"]:
self.__defaultmanager = "CondorBatchManager"
else:
logger.info("Could not recognize the shortcut of the default manager in vispa.ini configuration. Use one out of '%s' or use the exact name, e.g. 'CondorBatchManager' (without quotation marks)." % ("'local','grid','lsf','hpc','condor'"))
logger.info("Default batchsystem is '%s' ." % (self.__defaultmanager))
def _manager(self, manager=None):
......
......@@ -8,6 +8,9 @@ from vispa.models import Base, insertion_safe
from vispa import MessageException
import json as JSON
_all__ = ["VispaPreference", "ExtensionPreference"]
class VispaPreference(Base):
__tablename__ = "vispa_preference"
......
......@@ -7,6 +7,8 @@ from datetime import datetime
from vispa.models import Base, insertion_safe
import json as JSON
__all__ = ["VispaShortcuts", "ExtensionShortcuts"]
class VispaShortcuts(Base):
......
......@@ -7,6 +7,8 @@ from sqlalchemy import Column, schema
from sqlalchemy.types import Unicode, Integer, Date
from vispa.models import Base
__all__ = ["AccessStats", "PageStats"]
class AccessStats(Base):
......
......@@ -14,6 +14,8 @@ import logging
logger = logging.getLogger(__name__)
__all__ = ["User"]
class User(Base):
......
......@@ -9,6 +9,8 @@ from vispa.models.user import User
from vispa import MessageException
import json
__all__ = ["Workspace", "WorkspaceState", "WorkspaceConnection"]
class Workspace(Base):
......
......@@ -13,7 +13,13 @@ import sqlalchemy
import vispa.url
import vispa.plugins.template
import vispa.extensions
from vispa.models import Base as sql_base
import vispa.models.alembic
from vispa.models.user import *
from vispa.models.workspace import *
from vispa.models.stats import *
from vispa.models.preference import *
from vispa.models.shortcuts import *
logger = logging.getLogger(__name__)
......@@ -234,12 +240,13 @@ class Server(object):
logger.info('Use database %s.' % sa_identifier)
self._engine = sqlalchemy.create_engine(sa_identifier, echo=False)
if vispa.config.has_option('alembic', 'auto_migrate'):
auto_migrate = vispa.config.get('alembic', 'auto_migrate', True)
if vispa.config('alembic', 'use_alembic', True):
logger.info("Use alembic")
if vispa.config('alembic', 'auto_migrate', True):
vispa.models.alembic.migrate(self._engine)
else:
auto_migrate = True
if auto_migrate:
vispa.models.alembic.migrate(self._engine)
logger.info("Do not use alembic")
sql_base.metadata.create_all(self._engine)
def __init_plugins(self, args):
if vispa.config('websockets', 'enabled', False):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment