Commit 4184e922 authored by Gero Müller's avatar Gero Müller
Browse files

rename vispa.rpc -> vispa.workspace, rename AbstractExtension function names

parent 80d595ce
......@@ -40,20 +40,11 @@ post_command_options = -p
manager = local
#manager = condor
[rpc]
verbose = False
[workspace]
# define default workspace id to use.
#default_workspace_id = 1
# command line to start rpc process. use the variables:
# - $PYTHONPATH
# - $username
# - $userid
# - $python
# - $file
#wrapper = ['/usr/bin/sudo', 'PYTHONPATH=$PYTHONPATH', '-E', '-u', '$username', '$python', '-u', '$file']
[user]
# user registration
# use $username and $userid variables
......
......@@ -108,7 +108,7 @@ class AbstractController(object):
return cherrypy.request.profile
elif key == 'fs':
workspace = cherrypy.request.workspace if len(args) == 0 else args[0]
return vispa.rpc.get(cherrypy.request.user, workspace, 'vispa.remote.filesystem.FileSystem')
return vispa.workspace.get(cherrypy.request.user, workspace, 'vispa.remote.filesystem.FileSystem')
except:
vispa.log_exception()
return None
......
......@@ -125,7 +125,7 @@ class AjaxController(AbstractController):
@cherrypy.tools.json_in()
def addworkspace(self):
try:
if not vispa.config("rpc", "allow_new_workspaces", True):
if not vispa.config("workspace", "allow_new_workspaces", True):
raise Exception("No permission to add a new Workspace!")
json = cherrypy.request.json
db = self.get("db")
......@@ -258,7 +258,7 @@ class AjaxController(AbstractController):
if workspace.user_id and workspace.user_id != uid:
raise Exception("No permission to select this Workspace! (id: %s)" % wid)
# disconnect
vispa.rpc.clear(cherrypy.request.user, workspace)
vispa.workspace.clear(cherrypy.request.user, workspace)
# update the session
wids = cherrypy.session.get("workspace_ids", None)
if wids and wid in wids:
......
......@@ -105,7 +105,7 @@ class PlatformController(AbstractController):
workspace_ids = self.get("workspace_ids")
workspace_data = self.workspace_data()
workspace_data = JSON.dumps(workspace_data)
add_workspaces = vispa.config("rpc", "allow_new_workspaces", True)
add_workspaces = vispa.config("workspace", "allow_new_workspaces", True)
data = {"devmode" : devmode,
"username" : username,
"common_js" : self.common_js,
......@@ -138,7 +138,7 @@ class PlatformController(AbstractController):
workspace_ids = JSON.dumps(workspace_ids)
workspace_data = self.workspace_data()
workspace_data = JSON.dumps(workspace_data)
# add_workspaces = vispa.config("rpc", "allow_new_workspaces", True)
# add_workspaces = vispa.config("workspace", "allow_new_workspaces", True)
data = {
"dev_mode" : dev_mode,
"username" : username,
......@@ -209,7 +209,7 @@ class PlatformController(AbstractController):
@cherrypy.tools.render(template="sites/workspace.html", subfolder="html")
def workspace(self, *args, **kwargs):
path = self.requested_path()
show_add_form = vispa.config("rpc", "allow_new_workspaces", True)
show_add_form = vispa.config("workspace", "allow_new_workspaces", True)
workspace_data = self.workspace_data()
workspace_data = JSON.dumps(workspace_data)
return {"requested_path": path,
......
......@@ -6,7 +6,7 @@ import cherrypy
import vispa
from vispa.server import AbstractExtension
from vispa.controller import AbstractController
import vispa.rpc
import vispa.workspace
class CodeEditorController(AbstractController):
......@@ -53,7 +53,7 @@ class CodeEditorController(AbstractController):
fs = self.get("fs")
jid = self._jobPool.submit(cmd, fs.expand('~/'), manager=self._jobManager)
# return time on server after execute() has been fired
return self.success(jid=jid, etime=vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace).getmodule('time').time(), encode_json=True)
return self.success(jid=jid, etime=vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace).getmodule('time').time(), encode_json=True)
except Exception, e:
return self.fail(msg="Couldn\"t submit the job: %s" % str(e), encode_json=True)
......@@ -77,15 +77,15 @@ class CodeEditorController(AbstractController):
class CodeEditorExtension(AbstractExtension):
def get_name(self):
def name(self):
return 'codeeditor'
def dependencies(self):
return []
return ['jobmanagement']
def setup(self, extensionList):
self.controller(CodeEditorController(self.server))
self.js('js/extension.js')
self.js('js/editor.js')
self.css('css/styles.css')
self.remote()
def setup(self):
self.add_controller(CodeEditorController(self.server))
self.add_js('js/extension.js')
self.add_js('js/editor.js')
self.add_css('css/styles.css')
self.add_workspace_directoy()
# -*- coding: utf-8 -*-
# imports
import vispa.rpc
from vispa.server import AbstractExtension
# we import the controller from a seperate file
......@@ -10,14 +9,14 @@ from controller import DemoController
class DemoExtension(AbstractExtension):
def get_name(self):
def name(self):
return 'demo'
def dependencies(self):
return []
def setup(self, extensions):
self.controller(DemoController())
self.js('js/extension.js')
self.css('css/styles.css')
self.remote()
def setup(self):
self.add_controller(DemoController())
self.add_js('js/extension.js')
self.add_css('css/styles.css')
self.add_workspace_directoy()
......@@ -2,9 +2,9 @@
# imports
import cherrypy
import vispa.rpc
from vispa.controller import AbstractController
class DemoController(AbstractController):
def __init__(self):
......
# -*- coding: utf-8 -*-
# imports
import vispa.rpc
from vispa.server import AbstractExtension
# we import the controller from a seperate file
......@@ -10,14 +8,14 @@ from controller import DummyController
class DummyExtension(AbstractExtension):
def get_name(self):
def name(self):
return 'dummy'
def dependencies(self):
return []
def setup(self, extensions):
self.controller(DummyController())
self.js('js/extension.js')
self.css('css/styles.css')
self.remote()
def setup(self):
self.add_controller(DummyController())
self.add_js('js/extension.js')
self.add_css('css/styles.css')
self.add_workspace_directoy()
......@@ -2,11 +2,14 @@
# imports
import cherrypy
import vispa.rpc
import vispa.workspace
from vispa.controller import AbstractController
class DummyController(AbstractController):
_workspace_class_name = 'vispa.extensions.dummy.workspace.DummyRpc'
def __init__(self):
AbstractController.__init__(self)
......@@ -15,13 +18,16 @@ class DummyController(AbstractController):
content = ''
# import the remote sys module
service = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace)
service = vispa.workspace.get(cherrypy.request.user,
cherrypy.request.workspace)
rsys = service.getmodule('sys')
content += '<p>sys.path: %s</p>' % rsys.path
# the class 'DummyRPC' is located in the __init__.py file in remote/,
# so we can create an instance of that class on remote-side
dummyrpc = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, 'vispa.extensions.dummy.remote.DummyRpc')
dummyrpc = vispa.workspace.get(cherrypy.request.user,
cherrypy.request.workspace,
self._workspace_class_name)
content += '<p>dummy: %s</p>' % dummyrpc.dummy()
return content
......@@ -12,33 +12,33 @@ class FileBrowserController(AbstractController):
class FileBrowserExtension(AbstractExtension):
def get_name(self):
def name(self):
return 'file'
def dependencies(self):
return []
def setup(self, extensionList):
self.controller(FileBrowserController())
self.js('js/base/base.js')
self.js('js/base/view.js')
self.js('js/base/actions.js')
self.js('js/base/events.js')
self.js('js/base/items.js')
self.js('js/base/selections.js')
self.js('js/base/views/symbol/view.js')
self.js('js/base/views/table/view.js')
self.js('js/browser/browser.js')
self.js('js/browser/view.js')
self.js('js/browser/actions.js')
self.js('js/selector/selector.js')
self.js('js/selector/view.js')
self.js('js/selector/actions.js')
self.js('js/extension.js')
self.css('css/base/base.css')
self.css('css/base/views/symbol/symbol.css')
self.css('css/base/views/table/table.css')
def setup(self):
self.add_controller(FileBrowserController())
self.add_js('js/base/base.add_js')
self.add_js('js/base/view.add_js')
self.add_js('js/base/actions.add_js')
self.add_js('js/base/events.add_js')
self.add_js('js/base/items.add_js')
self.add_js('js/base/selections.add_js')
self.add_js('js/base/views/symbol/view.add_js')
self.add_js('js/base/views/table/view.add_js')
self.add_js('js/browser/browser.add_js')
self.add_js('js/browser/view.add_js')
self.add_js('js/browser/actions.add_js')
self.add_js('js/selector/selector.add_js')
self.add_js('js/selector/view.add_js')
self.add_js('js/selector/actions.add_js')
self.add_js('js/extension.add_js')
self.add_css('css/base/base.css')
self.add_css('css/base/views/symbol/symbol.css')
self.add_css('css/base/views/table/table.css')
......@@ -3,7 +3,7 @@
# imports
import cherrypy
import vispa
import vispa.rpc
import vispa.workspace
import logging
import os
import BatchSystemManager
......@@ -16,8 +16,8 @@ class JobmanagementController(AbstractController):
setattr(self, 'extension', extension)
# batchManager = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, 'BatchSystemManager')
batchManager = vispa.rpc.add_package_files(BatchSystemManager)
# batchManager = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, 'BatchSystemManager')
batchManager = vispa.workspace.add_package_files(BatchSystemManager)
print batchManager
# default paths
......@@ -35,7 +35,7 @@ class JobmanagementController(AbstractController):
@cherrypy.tools.workspace()
def getCommandLineDesigner(self):
try:
cmdLineDesigner = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.CommandLineDesigner.CommandLineDesigner")
cmdLineDesigner = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.CommandLineDesigner.CommandLineDesigner")
return cmdLineDesigner
except Exception, e:
......@@ -75,7 +75,7 @@ class JobmanagementController(AbstractController):
@cherrypy.tools.workspace()
def getAvailableBatchManager(self):
try:
bm = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.BatchSystemManagerAvailability.BatchSystemManagerAvailability")
bm = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.BatchSystemManagerAvailability.BatchSystemManagerAvailability")
bm_dict = {}
......@@ -103,7 +103,7 @@ class JobmanagementController(AbstractController):
try:
template = cherrypy.engine.publish("lookup_template", batchmanager + "Configuration.html", "", "jobmanagement").pop()
bm = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager." + batchmanager + "." + batchmanager + "." + batchmanager)
bm = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager." + batchmanager + "." + batchmanager + "." + batchmanager)
bm.update()
contentDict = {}
......@@ -228,7 +228,7 @@ class JobmanagementController(AbstractController):
def getparameterrange(self, extid, script):
try:
# logging.getLogger("system.batchsystem").info(script)
parameterRange = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.ParameterRange.ParameterRange")
parameterRange = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager.Core.ParameterRange.ParameterRange")
if (script):
parameterRange.setScript(script)
......
......@@ -14,41 +14,41 @@ class JobmanagementExtension(AbstractExtension):
self._jobPool = JobPool(self)
def get_name(self):
def name(self):
return 'jobmanagement'
def dependencies(self):
return []
def setup(self, extensionList):
def setup(self):
controller = JobmanagementController(extension=self)
self.controller(controller)
self.js('js/extension.js')
# vispa.rpc.add_package_files(remote)
self.add_controller(controller)
self.add_js('js/extension.js')
# vispa.workspace.add_package_files(remote)
""" general """
self.css('css/common.css')
self.js("js/common/guid.js")
self.js("js/common/DataModel.js")
self.js("js/common/JobAjaxHandler.js")
self.js("js/common/BatchManagerSelector.js")
self.js("js/common/SelectableTable.js")
self.js("js/common/SimpleButton.js")
self.add_css('css/common.css')
self.add_js("js/common/guid.js")
self.add_js("js/common/DataModel.js")
self.add_js("js/common/JobAjaxHandler.js")
self.add_js("js/common/BatchManagerSelector.js")
self.add_js("js/common/SelectableTable.js")
self.add_js("js/common/SimpleButton.js")
""" job submission """
self.js("js/jobsubmission/ajax.js")
self.js("js/jobsubmission/submission.js")
self.js("js/jobsubmission/view.js")
self.css('css/jobsubmission.css')
self.add_js("js/jobsubmission/ajax.js")
self.add_js("js/jobsubmission/submission.js")
self.add_js("js/jobsubmission/view.js")
self.add_css('css/jobsubmission.css')
""" job dashboard """
self.js("js/jobdashboard/ajax.js")
self.js("js/jobdashboard/dashboard.js")
self.js("js/jobdashboard/view.js")
self.css('css/jobdashboard.css')
self.add_js("js/jobdashboard/ajax.js")
self.add_js("js/jobdashboard/dashboard.js")
self.add_js("js/jobdashboard/view.js")
self.add_css('css/jobdashboard.css')
""" job designer """
self.js("js/jobdesigner/ajax.js")
self.js("js/jobdesigner/jobdesigner.js")
self.js("js/jobdesigner/view.js")
self.css('css/jobdesigner.css')
self.add_js("js/jobdesigner/ajax.js")
self.add_js("js/jobdesigner/jobdesigner.js")
self.add_js("js/jobdesigner/view.js")
self.add_css('css/jobdesigner.css')
......@@ -7,9 +7,8 @@ import datetime, time, os
import cherrypy
import vispa
import vispa.rpc
import vispa.workspace
#from analysis import *
#from vispa.plugins.rpc import RpcProcess
from inspect import getmembers
import logging
......@@ -54,7 +53,7 @@ class JobPool(object):
manager = self.__defaultmanager
try:
m = vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager." + manager + "." + manager + "." + manager)
m = vispa.workspace.get(cherrypy.request.user, cherrypy.request.workspace, "BatchSystemManager." + manager + "." + manager + "." + manager)
return m
except Exception, e:
vispa.log_exception()
......
......@@ -5,16 +5,20 @@ import uuid
import time
import rpyc
import vispa.rpc
import vispa.workspace
from vispa.controller import AbstractController
from vispa.server import AbstractExtension
class TerminalController(AbstractController):
_workspace_class_name = "vispa.extensions.terminal.workspace.Terminal"
def _terminal(self, tid):
return vispa.rpc.get(cherrypy.request.user, cherrypy.request.workspace,
"vispa.extensions.terminal.remote.Terminal", tid)
return vispa.workspace.get(cherrypy.request.user,
cherrypy.request.workspace,
self._workspace_class_name,
tid)
@cherrypy.expose
def open(self):
......@@ -24,19 +28,21 @@ class TerminalController(AbstractController):
@cherrypy.expose
def close(self, tid):
vispa.rpc.clear(cherrypy.request.user, cherrypy.request.workspace,
"vispa.extensions.terminal.remote.Terminal", tid)
vispa.workspace.clear(cherrypy.request.user,
cherrypy.request.workspace,
self._workspace_class_name,
tid)
@cherrypy.expose
def command(self, tid, command):
terminal = self._terminal(tid)
self.endRequest()
self.release()
terminal.command(command)
@cherrypy.expose
def html(self, tid):
terminal = self._terminal(tid)
self.endRequest()
self.release()
htmlfunction = rpyc.timed(terminal.html, 3)
htmldata = htmlfunction().value
return htmldata
......@@ -44,14 +50,14 @@ class TerminalController(AbstractController):
class TerminalExtension(AbstractExtension):
def get_name(self):
def name(self):
return 'terminal'
def dependencies(self):
return []
def setup(self, extensionList):
self.controller(TerminalController())
self.js('js/extension.js')
self.css('css/styles.css')
self.remote()
def setup(self):
self.add_controller(TerminalController())
self.add_js('js/extension.js')
self.add_css('css/styles.css')
self.add_workspace_directoy()
......@@ -117,6 +117,7 @@ var TerminalContent = ExtensionContentFull.extend({
_this.beforeClose = function() {
$.get(Vispa.urlHandler
.dynamic('extensions/terminal/close'), {
_wid: Vispa.workspaceManager.getWorkspace().id,
tid: terminalid
});
window.clearInterval(interval);
......
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