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

Containers interface and GIE bugfixes #3941

Merged
merged 4 commits into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 39 additions & 17 deletions client/galaxy/scripts/galaxy.interactive_environments.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,30 @@ function display_spinner(){
$('#main').append('<img id="spinner" src="' + galaxy_root + 'static/style/largespinner.gif" style="position:absolute;margin:auto;top:0;left:0;right:0;bottom:0;">');
}

function not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step) {
if(timeout_values.count == 0){
display_spinner();
toastr.info(
"Galaxy is launching a container in which to run this interactive environment. Please wait...",
{'closeButton': true, 'tapToDismiss': false}
);
}
timeout_values.count++;
if(timeout_values.time < timeout_time_max){
timeout_values.time += timeout_time_step;
}
console.log("Readiness request " + timeout_values.count + " sleeping " + timeout_values.time / 1000 + "s");
window.setTimeout(timeout, timeout_values.time)
}

/**
* Check a URL for a boolean true/false and call a callback when done.
*/
function load_when_ready(url, success_callback){
var request_count = 0;
var timeout_time = 1000;
var ajax_timeout = 500;
var ajax_timeout_max = 10000;
var ajax_timeout_step = 250;
var timeout_values = { time: 1000, count: 0 };
var timeout_time_max = 15000;
var timeout_time_step = 1000;
var timeout = function(){
Expand All @@ -32,7 +50,7 @@ function load_when_ready(url, success_callback){
withCredentials: true
},
type: "GET",
timeout: 500,
timeout: ajax_timeout,
dataType: "json",
success: function(data){
if(data == true){
Expand All @@ -41,19 +59,7 @@ function load_when_ready(url, success_callback){
toastr.clear();
success_callback();
}else if(data == false){
if(request_count == 0){
display_spinner();
toastr.info(
"Galaxy is launching a container in which to run this interactive environment. Please wait...",
{'closeButton': true, 'tapToDismiss': false}
);
}
request_count++;
if(timeout_time < timeout_time_max){
timeout_time += timeout_time_step;
}
console.log("Readiness request " + request_count + " sleeping " + timeout_time / 1000 + "s");
window.setTimeout(timeout, timeout_time)
not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step);
}else{
clear_main_area();
toastr.clear();
Expand All @@ -63,10 +69,26 @@ function load_when_ready(url, success_callback){
{'closeButton': true, 'tapToDismiss': false}
);
}
},
error: function(jqXHR, textStatus, errorThrown){
if(textStatus == "timeout"){
if(ajax_timeout < ajax_timeout_max){
ajax_timeout += ajax_timeout_step;
}
not_ready(timeout, timeout_values, timeout_time_max, timeout_time_step);
}else{
clear_main_area();
toastr.clear();
toastr.error(
"Galaxy encountered an error while attempting to determine the readiness of this interactive environment, contact your administrator.",
"Error",
{'closeButton': true, 'tapToDismiss': false}
);
}
}
});
}
window.setTimeout(timeout, timeout_time);
window.setTimeout(timeout, timeout_values.time);
}


Expand Down
4 changes: 4 additions & 0 deletions config/containers_conf.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@
# https://github.com/docker/docker/issues/31427
# resolve_image_digest: no

# If a container run request is received that defines volumes to attach, should those volumes be ignored? Swarm mode
# does not support mounting volumes.
# ignore_volumes: no

## For the following `service_create_*_constraint` options, if set, the swarm manager automatically sets a corresponding
## label on nodes it spawns for services with the given constraints.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ie_password = '${ ie_request.notebook_pw }';

var galaxy_root = '${ ie_request.attr.root }';
var app_root = '${ ie_request.attr.app_root }';
var ie_readiness_url = '${ ie_request.url_template("${PROXY_PREFIX}/interactive_environments/ready") }';
var ie_readiness_url = '${ h.url_for("/interactive_environments/ready") }';
</%def>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
function load_notebook(url){
$( document ).ready(function() {
test_ie_availability(url, function(){
append_notebook(url)
});
test_ie_availability(url, function(){
append_notebook(url)
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ requirejs(['interactive_environments', 'plugin/ethercalc'], function(){
});

requirejs(['interactive_environments', 'plugin/ethercalc'], function(){
load_notebook(url);
load_when_ready(ie_readiness_url, function(){
load_notebook(url);
});
});
</script>
<div id="main" width="100%" height="100%">
Expand Down
17 changes: 17 additions & 0 deletions lib/galaxy/containers/docker_swarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DockerSwarmInterface(DockerInterface):

container_class = DockerService
conf_defaults = {
'ignore_volumes': False,
'node_prefix': None,
'service_create_image_constraint': False,
'service_create_cpus_constraint': False,
Expand Down Expand Up @@ -64,6 +65,22 @@ def run_in_container(self, command, image=None, **kwopts):
)
elif kwopts.get('detach', None):
del kwopts['detach']
if kwopts.get('volumes', None):
if self._conf.ignore_volumes:
log.warning(
"'volumes' kwopt is set and not supported in Docker swarm "
"mode, volumes will not be passed (set 'ignore_volumes: "
"False' in containers config to fail instead): %s" % kwopts['volumes']
)
del kwopts['volumes']
else:
raise ContainerRunError(
"'volumes' kwopt is set and not supported in Docker swarm "
"mode (set 'ignore_volumes: True' in containers config to "
"warn instead): %s" % kwopts['volumes'],
image=image,
command=command
)
service = self.service_create(command, image=image, **kwopts)
self._run_swarm_manager()
return service
Expand Down
2 changes: 1 addition & 1 deletion static/maps/galaxy.interactive_environments.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/galaxy.interactive_environments.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.