Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add InteractiveTools. #7494

Merged
merged 153 commits into from Aug 22, 2019
Merged
Show file tree
Hide file tree
Changes from 131 commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
261eb7f
Add RealTimeTools. Currently working for docker in local runner.
blankenberg Mar 8, 2019
edeca76
Flake8
blankenberg Mar 8, 2019
22f6d48
Update lib/galaxy/datatypes/realtime.py
nsoranzo Mar 8, 2019
a7c9ac0
fix
blankenberg Mar 9, 2019
b413771
fix
blankenberg Mar 9, 2019
acbee59
Make stop button in Active RealTimeTool list do something.
blankenberg Mar 13, 2019
593bffb
better handling of missing containers
blankenberg Mar 14, 2019
e853f4c
merge dev into realtimetools
blankenberg Mar 15, 2019
054f1fc
Update access to url_for().
blankenberg Mar 15, 2019
696c2cf
import ordering
blankenberg Mar 15, 2019
dcdbee1
Only display view result message when view is available.
blankenberg Mar 16, 2019
2bf465d
Add a ttl cache aware mapper to key_type_token_mapping.py.
blankenberg Mar 20, 2019
2570cb1
Remove entries from realtimetool sqlite db when job has ended.
blankenberg Mar 20, 2019
9274f7d
Simplify RealTimeTool model, associated entry points directly with job.
blankenberg Mar 20, 2019
82704fd
merge dev
blankenberg Mar 20, 2019
27fe34f
remove debug statement
blankenberg Mar 21, 2019
10c71c3
merge dev
blankenberg Mar 21, 2019
e037148
comma
blankenberg Mar 21, 2019
16eb46b
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Mar 21, 2019
91f5f6f
fix for displaying realtimetool grid on refresh.
blankenberg Mar 21, 2019
672d3c3
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Mar 21, 2019
e8da308
Ports for yaml tools.
blankenberg Mar 22, 2019
464aa35
update tools xsd
blankenberg Mar 22, 2019
fcd4c0f
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Mar 22, 2019
523f648
over zealous delete key
blankenberg Mar 22, 2019
d64ba78
flake
blankenberg Mar 22, 2019
c960113
flake
blankenberg Mar 22, 2019
cf314d2
naming update
blankenberg Mar 22, 2019
2d55589
move realtime rpc script to /scripts/realtime/
blankenberg Mar 22, 2019
9ee4b9c
move realtime rpc script to /scripts/realtime/
blankenberg Mar 22, 2019
0a6e4bb
Revert "move realtime rpc script to /scripts/realtime/"
blankenberg Mar 22, 2019
c484330
rename rtt db migration
blankenberg Mar 27, 2019
7f175ac
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Mar 27, 2019
73e81ac
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 2, 2019
3e94402
rename realtimetool migration to higher version
blankenberg Apr 2, 2019
417d777
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 3, 2019
2a26d8c
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 3, 2019
054e36e
change version number of realtimetools migration
blankenberg Apr 8, 2019
4bfd4d1
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 8, 2019
2c4f15e
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 8, 2019
557135b
update migrate version of realtimetools
blankenberg Apr 8, 2019
5fdcea3
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 8, 2019
ae312d7
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Apr 16, 2019
ee680d7
Remove inspection check, only do ports
blankenberg Apr 16, 2019
7a5a987
Remove unneeded RealTimeTool datatype.
blankenberg Apr 16, 2019
2fa9ff1
No more inspect, no more json needed.
blankenberg Apr 16, 2019
f164db2
Merge branch 'dev' of https://github.com/blankenberg/galaxy into real…
blankenberg May 9, 2019
e5947b9
Update rtt migrate version number
blankenberg May 9, 2019
97e8a4f
js-lint fix
blankenberg May 9, 2019
1fdfdd3
remove extra _
blankenberg May 10, 2019
ed66427
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 10, 2019
5fd9ef4
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 13, 2019
3d829c4
Update RealTimeTool entry point definitions.
blankenberg May 13, 2019
0c94350
Update xsd
blankenberg May 13, 2019
ac7d6fd
Enable templating of RealTime tools name, port, url.
blankenberg May 13, 2019
7376cc9
Add docs and example job config.
blankenberg May 13, 2019
d4fa635
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 13, 2019
13a5524
Remove unused import
blankenberg May 13, 2019
718f5f0
change cellxgene Container to work with the IE tools
bgruening May 5, 2019
3c56b59
make entry_point_url parsing more robust
bgruening May 5, 2019
ba6fc19
add initial condor runner support
bgruening May 5, 2019
0a15a46
add initial test tools for a interactive Vis
bgruening May 5, 2019
67e8ad3
add initial Jupyter notebook tool, this tool supports loading a noteb…
bgruening May 5, 2019
dd3839a
fix bug in setting the --net option during Docker startup
bgruening May 5, 2019
09397f8
Update example RealTimeTools to use current syntax.
blankenberg May 13, 2019
b060b72
Merge pull request #5 from blankenberg/realtimetools-bg
blankenberg May 13, 2019
13c3f77
flake8 for lib/galaxy/jobs/runners/condor.py
blankenberg May 13, 2019
b7072d8
mock
blankenberg May 13, 2019
2866b5f
Update docs
blankenberg May 13, 2019
2eb2106
Ports to test.
blankenberg May 13, 2019
6cc43da
Doc formatting
blankenberg May 13, 2019
5ee6e65
More doc info
blankenberg May 14, 2019
b0baaab
notes on resource consumption; and condor
blankenberg May 14, 2019
5f6f7df
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 14, 2019
1c12c74
update docs
blankenberg May 15, 2019
138e904
More doc formatting
blankenberg May 15, 2019
7c1e009
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 15, 2019
133d8b7
missing t
blankenberg May 15, 2019
d1f1391
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 20, 2019
87fed7e
re.sub on cellxgene input name
blankenberg May 20, 2019
9d93823
Simplify set_name stuff in container.
jmchilton May 20, 2019
9136e29
Only set container if container exists, fixes tests failing due to Mo…
blankenberg May 20, 2019
033a776
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 20, 2019
98f7fd7
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into rt…
blankenberg May 21, 2019
5cc0d80
Fix tool_util import
blankenberg May 21, 2019
6e01ca8
Change default realtime prefix to something that isn't broken.
jmchilton May 21, 2019
58cbb50
Refactor realtime entry point handling toward API usage.
jmchilton May 20, 2019
821778f
Move computing result_view for RTT to client.
jmchilton May 21, 2019
03e9a6f
Integration testing for RTT API hooks.
jmchilton May 20, 2019
ba41c5b
Rebase into intergration testsing..
jmchilton May 22, 2019
1126d68
Rework client polling & entry point index API for potential reuse in …
jmchilton May 22, 2019
75c5785
Make realtime tool grid actual links, poll on active.
jmchilton May 22, 2019
0dfe134
Realtime Tools: Monitor for entrypoint ports in job script.
jmchilton May 22, 2019
70989ef
Proper container killing when running jobs.
jmchilton May 22, 2019
e7d4265
Add missing container_monitor package to previous commits.
jmchilton May 28, 2019
b00cff0
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg May 30, 2019
57ac6bd
Lowercase import Vue from "vue";
blankenberg May 30, 2019
1ce76c2
flake8
blankenberg May 30, 2019
e194ba4
jslint
blankenberg May 30, 2019
afc048d
flake
blankenberg May 30, 2019
2ed75af
Update driver_util.py
blankenberg May 31, 2019
d05a3c9
Add container_montior_command to MockJobWrapper
blankenberg Jun 4, 2019
178c1ce
montior --> monitor
blankenberg Jun 4, 2019
7b4c1d7
juypter --> jupyter
blankenberg Jun 6, 2019
ccc4fc4
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jun 6, 2019
540b2b3
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jun 17, 2019
f231e42
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jul 5, 2019
4f347e0
Change RealTimeTool to InteractiveTool in UI.
blankenberg Jul 5, 2019
eb22876
Change realtime tagset to entry_points.
blankenberg Jul 5, 2019
588eb42
Merge pull request #7 from blankenberg/interactivetools
blankenberg Jul 5, 2019
35055ed
interactive
blankenberg Jul 6, 2019
9301550
Fix for check_for_entry_points when file exists, but is not fully pop…
blankenberg Jul 7, 2019
f0fce80
Pass through tool defined environment_variables to Docker.
blankenberg Jul 7, 2019
e4dd821
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jul 7, 2019
102f935
from galaxy.web.base.controller import is now from galaxy.webapps.bas…
blankenberg Jul 7, 2019
75bc929
Add 404 when InteractiveTool route doesn't exist or can't be accessed
blankenberg Jul 7, 2019
0d6a66f
Flake
blankenberg Jul 7, 2019
361ed34
Add ability to strip whitespace from tool environment_variables.
blankenberg Jul 7, 2019
fd7f0d3
Fix for fetching strip if not defined
blankenberg Jul 8, 2019
56aab88
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jul 11, 2019
e04e03d
Don't set user in example interactive tool job_conf.xml
blankenberg Jul 25, 2019
8aebb64
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Jul 25, 2019
04b1e8f
add a bunch of ITs
bgruening Aug 11, 2019
3689d85
some small changes
bgruening Aug 11, 2019
29e1173
Add API_KEY, GALAXY_URL, and fix HISTORY_ID envars
blankenberg Aug 12, 2019
717d949
Merge pull request #72 from blankenberg/patch-1
bgruening Aug 12, 2019
5655ace
Fix websockets in interactive_tool_bam_iobio.xml
blankenberg Aug 12, 2019
986b0ba
Merge pull request #73 from blankenberg/patch-1
bgruening Aug 13, 2019
22edfcc
fixes for askomics IT
abretaud Aug 13, 2019
01c23ce
Merge pull request #75 from abretaud/it_askoko
bgruening Aug 13, 2019
0e5892c
Update galaxy.yml.realtime example with outputs_to_working_directory:…
blankenberg Aug 13, 2019
5ed5ff6
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Aug 13, 2019
24c7c76
remove complexity from ipython wrapper, not needed for this version
bgruening Aug 14, 2019
2fd4c13
enhance documentation for developers
bgruening Aug 14, 2019
c34fce8
add some more comments
bgruening Aug 14, 2019
0ba4ca5
cleanup comments
blankenberg Aug 14, 2019
764e28f
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Aug 14, 2019
6953bfa
update migration script version
blankenberg Aug 14, 2019
8444da7
Merge pull request #8 from bgruening/it
blankenberg Aug 14, 2019
c3c4aef
Merge branch 'dev' of https://github.com/galaxyproject/galaxy into re…
blankenberg Aug 20, 2019
4bda4c9
Make InteractiveTools enable-able.
blankenberg Aug 20, 2019
ab6e934
minor typo
blankenberg Aug 20, 2019
00e575f
interactive_tool_juypter_notebook.xml -> interactive_tool_jupyter_not…
blankenberg Aug 20, 2019
41d7155
Add requires_domain to entry_point. Default is False. Currently only …
blankenberg Aug 20, 2019
f16da01
Set requires_domain="True" for all examples.
blankenberg Aug 20, 2019
7250162
Add warning on backwards compatibility of __app__ in future.
blankenberg Aug 20, 2019
34ec3bf
FIXME note on user's API key in tool.
blankenberg Aug 20, 2019
a3167bd
Update galaxy tool XSD.
blankenberg Aug 20, 2019
55c9297
more realtime to interactivetools name changes
blankenberg Aug 20, 2019
d7e99c7
more realtimetool --> interactivetool
blankenberg Aug 20, 2019
7732fae
more realtimetool --> interactivetool
blankenberg Aug 20, 2019
753d258
more realtimetool --> interactivetool
blankenberg Aug 20, 2019
aea9ed2
Fix get_hex for uuid4 in python3
blankenberg Aug 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,65 @@
<template>
<div class="infomessagelarge">
<p v-if="entryPoints.length==0" >
Waiting for InteractiveTool result view(s) to become available.
</p>
<p v-else-if="entryPoints.length==1" >
<span v-if="entryPoints[0].active" >
There is an InteractiveTool result view available, <a :href="entryPoints[0].target">click here to display</a>.
</span>
<span v-else>
There is an InteractiveTool result view available, waiting for view to become active...
</span>
</p>
<p v-else>
There are multiple InteractiveTool result views available:
<ul>
<li v-for="entryPoint of entryPoints" v-bind:key="entryPoint.id" >
{{ entryPoint.name }}
<span v-if="entryPoint.active">
(<a :href="entryPoints[0].target">click here to display</a>)
</span>
<span v-else>
(waiting to become active...)
</span>
</li>
</ul>
</p>

You may also access all active InteractiveTools from the User menu.
</div>
</template>

<script>
import { clearPolling, pollUntilActive } from "mvc/entrypoints/poll";
export default {
props: {
jobId: {
type: String,
required: true
}
},
data() {
return {
entryPoints: [],
};
},
created: function() {
this.pollEntryPoints();
},
beforeDestroy: function(){
clearPolling();
},
methods: {
pollEntryPoints: function() {
const onUpdate = (entryPoints) => {
this.entryPoints = entryPoints;
}
const onError = (e) => {
console.error(e);
}
pollUntilActive(onUpdate, onError, {"job_id": this.jobId})
}
}
};
</script>
13 changes: 12 additions & 1 deletion client/galaxy/scripts/entry/analysis/AnalysisRouter.js
Expand Up @@ -22,6 +22,7 @@ import UserPreferences from "mvc/user/user-preferences";
import CustomBuilds from "mvc/user/user-custom-builds";
import Tours from "mvc/tours";
import GridView from "mvc/grid/grid-view";
import EntryPointGridView from "mvc/entrypoints/view";
import GridShared from "mvc/grid/grid-shared";
import Workflows from "mvc/workflow/workflow";
import WorkflowImport from "components/WorkflowImport.vue";
Expand Down Expand Up @@ -74,7 +75,8 @@ export const getAnalysisRouter = Galaxy =>
"(/)datasets(/)list(/)": "show_datasets",
"(/)custom_builds": "show_custom_builds",
"(/)datasets/edit": "show_dataset_edit_attributes",
"(/)datasets/error": "show_dataset_error"
"(/)datasets/error": "show_dataset_error",
"(/)realtime_entry_points(/)list": "show_realtime_list"
},

require_login: ["show_user", "show_user_form", "show_workflows", "show_cloud_auth"],
Expand Down Expand Up @@ -111,6 +113,15 @@ export const getAnalysisRouter = Galaxy =>
this.page.display(new FormWrapper.View(_.extend(model.get(form_id), { active_tab: "user" })));
},

show_realtime_list: function() {
this.page.display(
new EntryPointGridView({
url_base: `${getAppRoot()}realtime/list`,
active_tab: "analysis"
})
);
},

show_cloud_auth: function() {
this._display_vue_helper(CloudAuth);
},
Expand Down
6 changes: 6 additions & 0 deletions client/galaxy/scripts/layout/menu.js
Expand Up @@ -301,6 +301,12 @@ const Collection = Backbone.Collection.extend({
{
title: _l("Visualizations"),
url: "visualizations/list",
target: "__use_router__",
divider: true,
},
{
title: _l("Active InteractiveTools"),
url: "realtime_entry_points/list",
target: "__use_router__"
}
]
Expand Down
33 changes: 33 additions & 0 deletions client/galaxy/scripts/mvc/entrypoints/poll.js
@@ -0,0 +1,33 @@
import axios from "axios";
import { getAppRoot } from "onload/loadConfig";

let interval;

export const clearPolling = () => {
clearInterval(interval);
}

export const pollUntilActive = (onUpdate, onError, params) => {
clearPolling();
const url = getAppRoot() + `api/entry_points`;
console.log(params);
axios
.get(url, {params: params})
.then(response => {
const entryPoints = [];
let allReady = true;
response.data.forEach((entryPoint, i) => {
entryPoints.push(entryPoint);
if(! entryPoint.active) {
allReady = false;
}
});
onUpdate(entryPoints)
if(! allReady || entryPoints.length == 0) {
interval = setInterval(() => {
pollUntilActive(onUpdate, onError, params);
}, 3000);
}
})
.catch(onError);
}
34 changes: 34 additions & 0 deletions client/galaxy/scripts/mvc/entrypoints/view.js
@@ -0,0 +1,34 @@
import $ from "jquery";
import GridView from "mvc/grid/grid-view";
import { clearPolling, pollUntilActive } from "mvc/entrypoints/poll";


export default GridView.extend({
init_grid_elements: function() {
GridView.prototype.init_grid_elements.call(this);

const activated = {};

const onUpdate = (entryPoints) => {
entryPoints.forEach((entryPoint) => {
const entryPointId = entryPoint.id;
if (entryPoint.active && ! activated[entryPointId]) {
const $link = $(`.entry-point-link[entry_point_id='${entryPointId}']`)
if ($link.length > 0) {
$link.attr("href", entryPoint["target"]);
activated[entryPointId] = true;
}
}
});
}
const onError = (e) => {
console.error(e);
}
pollUntilActive(onUpdate, onError, {"running": true});
},
remove: function() {
// Your processing code here
clearPolling();
GridView.prototype.remove.apply(this, arguments);
}
});
15 changes: 15 additions & 0 deletions client/galaxy/scripts/mvc/tool/tool-form.js
Expand Up @@ -11,6 +11,8 @@ import Ui from "mvc/ui/ui-misc";
import Modal from "mvc/ui/ui-modal";
import ToolFormBase from "mvc/tool/tool-form-base";
import Webhooks from "mvc/webhooks";
import Vue from "vue";
import ToolEntryPoints from "components/ToolEntryPoints/ToolEntryPoints";

const View = Backbone.View.extend({
initialize: function(options) {
Expand Down Expand Up @@ -230,6 +232,19 @@ const View = Backbone.View.extend({
success: response => {
callback && callback();
this.$el.children().hide();
if (response.produces_entry_points) {
for (const job of response.jobs) {
const toolEntryPointsInstance = Vue.extend(ToolEntryPoints);
const vm = document.createElement("div");
this.$el.append(vm);
const instance = new toolEntryPointsInstance({
propsData: {
jobId: job.id
}
});
instance.$mount(vm);
}
}
this.$el.append(this._templateSuccess(response, job_def));
this.$el.parent().scrollTop(0);
// Show Webhook if job is running
Expand Down
28 changes: 28 additions & 0 deletions config/galaxy.yml.realtime
@@ -0,0 +1,28 @@
uwsgi:

http: localhost:8080

threads: 8

http-raw-body: True

offload-threads: 8

master: true

module: galaxy.webapps.galaxy.buildapp:uwsgi_app()

realtime_map: database/realtime_map.sqlite
python-raw: scripts/realtime/key_type_token_mapping.py
route-host: ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.(realtime\.localhost:8080)$ goto:realtime
route-run: goto:endendend
route-label: realtime
route-host: ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.(realtime\.localhost:8080)$ rpcvar:TARGET_HOST rtt_key_type_token_mapper_cached $2 $1 $3 $4 $0 5
route-if-not: empty:${TARGET_HOST} httpdumb:${TARGET_HOST}
route: .* break:404 Not Found
route-label: endendend


galaxy:

realtime_prefix: realtime
28 changes: 28 additions & 0 deletions config/job_conf.xml.realtime
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<!-- A sample job config for RealTimeTools using local runner. -->
<job_conf>
<plugins>
<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
</plugins>
<destinations default="docker_dispatch">
<destination id="local" runner="local"/>

<destination id="docker_local" runner="local">
<param id="docker_enabled">true</param>
<param id="docker_volumes">$galaxy_root:ro,$tool_directory:ro,$job_directory:rw,$working_directory:rw,$default_file_path:ro</param>
<param id="docker_sudo">false</param>
<param id="docker_net">bridge</param>
<param id="docker_auto_rm">true</param>
<param id="require_container">true</param>
<param id="docker_set_user"></param>
</destination>

<destination id="docker_dispatch" runner="dynamic">
<param id="type">docker_dispatch</param>
<param id="docker_destination_id">docker_local</param>
<param id="default_destination_id">local</param>
</destination>

</destinations>

</job_conf>
125 changes: 125 additions & 0 deletions doc/source/admin/special_topics/realtimetools.rst
@@ -0,0 +1,125 @@
Galaxy RealTimeTools
=====================================

A Galaxy RealTimeTool allows launching a container-backed Galaxy Tool
and enabling a Galaxy User to gain access to content inside in real-time.


How Galaxy RealTimeTools work
-----------------------------

A RealTimeTool is defined in the same familiar way as standard Galaxy Tools,
but are specified with **tool_type="realtime"**, and providing additional entry point
information:

.. code-block:: xml

<realtime>
<entry_point name="Display name">
<port>80</port>
<url><![CDATA[optional/path/can/be/${templated}]]></url>
</entry_point>
</realtime>

**Note** that name, port, and url are each able to be templated from the RealTimeTool's parameter dictionary.



Some important benefits of using Galaxy RealTimeTools
-----------------------------------------------------

- You can have and access **any number of RealTimeTools at a time** (admin configurable)
- If you accidentally close the **RealTimeTool browser window**, you can **regain access** by selecting from a **list of active RealTimeTools**
- A single **RealTimeTool** can **grant access** to **multiple running applications, servers, and interfaces**
- **RealTimeTools** can be **added to** Galaxy **Workflows**
- **Native, out-of-the box support for RealTimeTools** in Galaxy via uWSGI proxying
- **RealTimeTools** are **bonafide Galaxy Tools**; just specify **tool_type as "realtime"** and list the ports you want to expose
- **RealTimeTools** can be **added** to and **installed from the ToolShed**.
- **R Shiny apps**, **Javascript-based VNC** access to desktop environments, **genome-browsers-in-a-box**, **interactive notebook environments**, etc, are all possible with **RealTimeTools**



Server-side configuration of Galaxy RealTimeTools
-------------------------------------------------

The **galaxy.yml** file will need to be populated as seen in **config/galaxy.yml.realtime**.

In the **uwsgi:** section:

.. code-block:: yaml

http-raw-body: true
# master: true

realtime_map: database/realtime_map.sqlite
python-raw: scripts/realtime/key_type_token_mapping.py
route-host: ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.(realtime\.localhost:8080)$ goto:realtime
route-run: goto:endendend
route-label: realtime
route-host: ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)\.(realtime\.localhost:8080)$ rpcvar:TARGET_HOST rtt_key_type_token_mapper_cached $2 $1 $3 $4 $0 5
route-if-not: empty:${TARGET_HOST} httpdumb:${TARGET_HOST}
route-label: endendend

In the **galaxy:** section:

.. code-block:: yaml

realtime_prefix: realtime


The admin should modify the **route-host**s and **realtime_prefix** to match their preferred configuration.


An example **job_conf.xml** file as seen in **config/galaxy.yml.realtime**:

.. code-block:: xml

<job_conf>
<plugins>
<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
</plugins>
<destinations default="docker_dispatch">
<destination id="local" runner="local"/>
<destination id="docker_local" runner="local">
<param id="docker_enabled">true</param>
<param id="docker_volumes">$galaxy_root:ro,$tool_directory:ro,$job_directory:rw,$working_directory:rw,$default_file_path:ro</param>
<param id="docker_sudo">false</param>
<param id="docker_net">bridge</param>
<param id="docker_auto_rm">true</param>
<param id="require_container">true</param>
</destination>
<destination id="docker_dispatch" runner="dynamic">
<param id="type">docker_dispatch</param>
<param id="docker_destination_id">docker_local</param>
<param id="default_destination_id">local</param>
</destination>
</destinations>
</job_conf>


Alternatively to the local job runner, RealTimeTools have been enabled for the condor job runner, e.g.:

.. code-block:: xml

<destination id="condor" runner="condor">
<param id="docker_enabled">true</param>
<param id="docker_sudo">false</param>
</destination>


**Note on resource consumption:** Keep in mind that Distributed Resource Management (DRM) / cluster systems may have a maximum runtime configured for jobs. From the Galaxy point of view, such a container could run as long as the user desires, this may not be advisable and an admin may want to restrict the runtime of RealTimeTools *(and jobs in general)*. However, if the job is killed by the DRM, the user is not informed beforehand and data in the container could be discarded.

Two **example test RealTimeTools** have been defined, and can be added to the **config/tool_conf.xml**:

.. code-block:: xml

<tool file="../test/functional/tools/realtimetool_juypter_notebook.xml" />
<tool file="../test/functional/tools/realtimetool_cellxgene.xml" />


A few words on the condor integration
-------------------------------------

Galaxy needs to be able to stop a container gracefully. This is not a problem with the local job runner, where we assume that Docker is either running on the same host. However, if you are using production scale DRM, like condor, then your job is running
somewhere on your cluster and you can not easily **docker stop** your container. For the condor integration we are using a great
condor feature and commandline utility called **condor_ssh_to_job**. This tool (assuming your condor setup is configured correctly) will bring us directly to the host in question and we can execute the **docker stop** command. Galaxy will simply run **condor_ssh_to_job <condor_job_id> docker stop <container_name>** to stop the container gracefully.