mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge remote-tracking branch 'erasche/ie-updates2' into pr229
Conflicts: config/plugins/interactive_environments/ipython/config/ipython.ini.sample
This commit is contained in:
@@ -12,10 +12,10 @@
|
||||
command = docker
|
||||
|
||||
# The docker image name that should be started.
|
||||
image = bgruening/docker-ipython-notebook:0.2
|
||||
image = bgruening/docker-ipython-notebook:dev
|
||||
|
||||
# Additional arguments that are passed to the `docker run` command.
|
||||
command_inject = --sig-proxy=true
|
||||
command_inject = --sig-proxy=true -e DEBUG=false
|
||||
|
||||
# URL to access the Galaxy API with from the spawn Docker containter, if empty
|
||||
# this falls back to galaxy.ini's galaxy_infrastructure_url and finally to the
|
||||
|
||||
@@ -11,8 +11,10 @@ ie_request.load_deploy_config()
|
||||
ie_request.attr.docker_port = 6789
|
||||
# Create tempdir in galaxy
|
||||
temp_dir = os.path.abspath( tempfile.mkdtemp() )
|
||||
# Write out conf file...needs work
|
||||
ie_request.write_conf_file(temp_dir)
|
||||
|
||||
# Get all configurations
|
||||
conf = ie_request.get_conf_dict()
|
||||
ENV = ' '.join(['-e "%s=%s"' % (key.upper(), item) for key, item in conf.items()])
|
||||
|
||||
## IPython Specific
|
||||
# Prepare an empty notebook
|
||||
@@ -34,9 +36,12 @@ else:
|
||||
notebook_access_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/notebooks/ipython_galaxy_notebook.ipynb')
|
||||
notebook_login_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/login?next=%2Fipython%2F${PORT}%2Ftree')
|
||||
|
||||
docker_cmd = ie_request.docker_cmd(temp_dir)
|
||||
|
||||
# Add all environment variables collected from Galaxy's IE infrastructure
|
||||
docker_cmd = ie_request.docker_cmd(temp_dir).replace('run', 'run %s' % ENV)
|
||||
ie_request.log.info("Starting IPython docker container with command [%s]" % docker_cmd)
|
||||
subprocess.call(docker_cmd, shell=True)
|
||||
|
||||
%>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You can access your data via the dataset number. For example, ``handle = get(42)``.",
|
||||
"You can access your data via the dataset number. For example, ``handle = open(get(42), 'r')``.",
|
||||
"To save data, write your data to a file, and then call ``put('filename.txt')``. The dataset will then be available in your galaxy history.",
|
||||
"Notebooks can be saved to Galaxy by clicking the large green button at the top right of the IPython interface.<br>",
|
||||
"More help and informations can be found on the project [website](https://github.com/bgruening/galaxy-ipython)."
|
||||
|
||||
@@ -6,9 +6,6 @@ import random
|
||||
|
||||
from galaxy.util.bunch import Bunch
|
||||
from galaxy import web
|
||||
from galaxy import eggs
|
||||
eggs.require("PyYAML")
|
||||
import yaml
|
||||
from galaxy.managers import api_keys
|
||||
|
||||
import logging
|
||||
@@ -68,9 +65,9 @@ class InteractiveEnviornmentRequest(object):
|
||||
self.attr.APACHE_URLS = _boolean_option("apache_urls")
|
||||
self.attr.SSL_URLS = _boolean_option("ssl")
|
||||
|
||||
def write_conf_file(self, output_directory, extra={}):
|
||||
def get_conf_dict(self, extra={}):
|
||||
"""
|
||||
Build up a configuration file that is standard for ALL IEs.
|
||||
Build up a configuration dictionary that is standard for ALL IEs.
|
||||
|
||||
TODO: replace hashed password with plaintext.
|
||||
"""
|
||||
@@ -92,7 +89,9 @@ class InteractiveEnviornmentRequest(object):
|
||||
else:
|
||||
conf_file['galaxy_url'] = request.application_url.rstrip('/') + '/'
|
||||
web_port = self.attr.galaxy_config.galaxy_infrastructure_web_port
|
||||
conf_file['galaxy_paster_port'] = web_port or self.attr.galaxy_config.guess_galaxy_port()
|
||||
conf_file['galaxy_web_port'] = web_port or self.attr.galaxy_config.guess_galaxy_port()
|
||||
# Galaxy paster port is deprecated
|
||||
conf_file['galaxy_paster_port'] = conf_file['galaxy_web_port']
|
||||
|
||||
if self.attr.PASSWORD_AUTH:
|
||||
# Generate a random password + salt
|
||||
@@ -110,9 +109,7 @@ class InteractiveEnviornmentRequest(object):
|
||||
conf_file[extra_key] = extra[extra_key]
|
||||
|
||||
self.attr.notebook_pw = notebook_pw
|
||||
# Write conf
|
||||
with open( os.path.join( output_directory, 'conf.yaml' ), 'wb' ) as handle:
|
||||
handle.write( yaml.dump(conf_file, default_flow_style=False) )
|
||||
return conf_file
|
||||
|
||||
def generate_hex(self, length):
|
||||
return ''.join(random.choice('0123456789abcdef') for _ in range(length))
|
||||
|
||||
@@ -36,6 +36,23 @@ var DynamicProxy = function(options) {
|
||||
};
|
||||
|
||||
DynamicProxy.prototype.rewriteRequest = function(request) {
|
||||
if(request.url.indexOf('rstudio') != -1){
|
||||
var remap = {
|
||||
'content-type': 'Content-Type',
|
||||
'content-length': 'Content-Length',
|
||||
}
|
||||
// RStudio isn't spec compliant and pitches a fit on NodeJS's http module's lowercase HTTP headers
|
||||
for(var i = 0; i<Object.keys(remap).length; i++){
|
||||
var key = Object.keys(remap)[i];
|
||||
if(key in request.headers){
|
||||
request.headers[remap[key]] = request.headers[key];
|
||||
delete request.headers[key];
|
||||
}
|
||||
}
|
||||
if('Content-Type' in request.headers && request.headers['Content-Type'] == 'application/x-www-form-urlencoded; charset=UTF-8'){
|
||||
request.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DynamicProxy.prototype.targetForRequest = function(request) {
|
||||
|
||||
Reference in New Issue
Block a user