mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
RT to IT
This commit is contained in:
@@ -4,7 +4,7 @@ related to running and queued jobs.
|
||||
import logging
|
||||
|
||||
from galaxy import exceptions, util
|
||||
from galaxy.managers.realtime import RealTimeManager
|
||||
from galaxy.managers.interactivetool import InteractiveToolManager
|
||||
from galaxy.web import expose_api_anonymous_and_sessionless
|
||||
from galaxy.webapps.base.controller import BaseAPIController
|
||||
|
||||
@@ -15,7 +15,7 @@ class ToolEntryPointsAPIController(BaseAPIController):
|
||||
|
||||
def __init__(self, app):
|
||||
self.app = app
|
||||
self.realtime_manager = RealTimeManager(app)
|
||||
self.interactivetool_manager = InteractiveToolManager(app)
|
||||
|
||||
@expose_api_anonymous_and_sessionless
|
||||
def index(self, trans, running=False, job_id=None, **kwd):
|
||||
@@ -43,16 +43,16 @@ class ToolEntryPointsAPIController(BaseAPIController):
|
||||
|
||||
if job_id is not None:
|
||||
job = trans.sa_session.query(trans.app.model.Job).get(self.decode_id(job_id))
|
||||
if not self.realtime_manager.can_access_job(trans, job):
|
||||
if not self.interactivetool_manager.can_access_job(trans, job):
|
||||
raise exceptions.ItemAccessibilityException()
|
||||
entry_points = job.realtimetool_entry_points
|
||||
entry_points = job.interactivetool_entry_points
|
||||
if running:
|
||||
entry_points = self.realtime_manager.get_nonterminal_for_user_by_trans(trans)
|
||||
entry_points = self.interactivetool_manager.get_nonterminal_for_user_by_trans(trans)
|
||||
|
||||
rval = []
|
||||
for entry_point in entry_points:
|
||||
as_dict = self.encode_all_ids(trans, entry_point.to_dict(), True)
|
||||
target = self.realtime_manager.target_if_active(trans, entry_point)
|
||||
target = self.interactivetool_manager.target_if_active(trans, entry_point)
|
||||
if target:
|
||||
as_dict["target"] = target
|
||||
rval.append(as_dict)
|
||||
@@ -68,10 +68,10 @@ class ToolEntryPointsAPIController(BaseAPIController):
|
||||
:param id: Encoded entry point id
|
||||
|
||||
:rtype: dictionary
|
||||
:returns: dictionary containing target for realtime entry point
|
||||
:returns: dictionary containing target for interactivetool entry point
|
||||
"""
|
||||
# Because of auto id encoding needed for link from grid, the item.id keyword must be 'id'
|
||||
if not id:
|
||||
raise exceptions.RequestParameterMissingException("Must supply entry point ID.")
|
||||
entry_point_id = self.decode_id(id)
|
||||
return {"target": self.realtime_manager.access_entry_point_target(trans, entry_point_id)}
|
||||
return {"target": self.interactivetool_manager.access_entry_point_target(trans, entry_point_id)}
|
||||
|
||||
@@ -152,7 +152,7 @@ def app_factory(global_conf, load_app_kwds={}, **kwargs):
|
||||
webapp.add_client_route('/workflows/import')
|
||||
webapp.add_client_route('/workflows/invocations/report')
|
||||
webapp.add_client_route('/custom_builds')
|
||||
webapp.add_client_route('/realtime_entry_points/list')
|
||||
webapp.add_client_route('/interactivetool_entry_points/list')
|
||||
|
||||
# ==== Done
|
||||
# Indicate that all configuration settings have been provided
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Provides web interaction with RealTimeTools
|
||||
Provides web interaction with InteractiveTools
|
||||
"""
|
||||
import logging
|
||||
|
||||
@@ -28,7 +28,7 @@ class EntryPointLinkColumn(grids.GridColumn):
|
||||
return '<a class="entry-point-link" entry_point_id="%s">%s</a>' % (trans.security.encode_id(item.id), item.name)
|
||||
|
||||
|
||||
class RealTimeToolEntryPointListGrid(grids.Grid):
|
||||
class InteractiveToolEntryPointListGrid(grids.Grid):
|
||||
|
||||
use_panels = True
|
||||
title = "Available InteractiveTools"
|
||||
@@ -53,16 +53,16 @@ class RealTimeToolEntryPointListGrid(grids.Grid):
|
||||
]
|
||||
|
||||
def build_initial_query(self, trans, **kwargs):
|
||||
# Get list of user's active RealTimeTools
|
||||
return trans.app.realtime_manager.get_nonterminal_for_user_by_trans(trans)
|
||||
# Get list of user's active InteractiveTools
|
||||
return trans.app.interactivetool_manager.get_nonterminal_for_user_by_trans(trans)
|
||||
|
||||
|
||||
class RealTime(BaseUIController):
|
||||
entry_point_grid = RealTimeToolEntryPointListGrid()
|
||||
class InteractiveTool(BaseUIController):
|
||||
entry_point_grid = InteractiveToolEntryPointListGrid()
|
||||
|
||||
@web.expose_api_anonymous
|
||||
def list(self, trans, **kwargs):
|
||||
"""List all available realtimetools"""
|
||||
"""List all available interactivetools"""
|
||||
if not trans.app.config.interactivetools_enable:
|
||||
raise web.httpexceptions.HTTPNotFound()
|
||||
operation = kwargs.get('operation', None)
|
||||
@@ -77,7 +77,7 @@ class RealTime(BaseUIController):
|
||||
for entry_point_id in ids:
|
||||
entry_point_id = self.decode_id(entry_point_id)
|
||||
entry_point = trans.sa_session.query(trans.app.model.InteractiveToolEntryPoint).get(entry_point_id)
|
||||
if trans.app.realtime_manager.can_access_entry_point(trans, entry_point):
|
||||
if trans.app.interactivetool_manager.can_access_entry_point(trans, entry_point):
|
||||
eps.append(entry_point)
|
||||
if eps:
|
||||
failed = []
|
||||
@@ -86,7 +86,7 @@ class RealTime(BaseUIController):
|
||||
if operation == 'stop':
|
||||
for ep in eps:
|
||||
if ep.job not in jobs:
|
||||
stopped = trans.app.realtime_manager.stop(trans, ep)
|
||||
stopped = trans.app.interactivetool_manager.stop(trans, ep)
|
||||
if stopped:
|
||||
succeeded.append(ep)
|
||||
jobs.append(ep.job)
|
||||
@@ -62,7 +62,7 @@ class ToolRunner(BaseUIController):
|
||||
if not tool.allow_user_access(trans.user):
|
||||
return __tool_404__()
|
||||
# FIXME: Tool class should define behavior
|
||||
if tool.tool_type in ['default', 'realtime']:
|
||||
if tool.tool_type in ['default', 'interactivetool']:
|
||||
return trans.response.send_redirect(url_for(controller='root', tool_id=tool_id))
|
||||
|
||||
# execute tool without displaying form (used for datasource tools)
|
||||
|
||||
Reference in New Issue
Block a user