Some logging, some code simplification, clear canvas on start

This commit is contained in:
Ralf Teusner
2015-11-03 15:54:08 +01:00
parent ef60494911
commit eb8c0e46fa
3 changed files with 10 additions and 3 deletions

View File

@ -1127,6 +1127,10 @@ $(function() {
var initTurtle = function() {
// todo guard clause if turtle is not required for the current exercise
// clear canvas
// turtlecanvas.getContext("2d").clearRect(0, 0, turtlecanvas.width, turtlecanvas.height);
turtlescreen = new Turtle(websocket, turtlecanvas);
if ($('#run').isPresent()) {
$('#run').bind('click', hideCanvas);

View File

@ -218,7 +218,7 @@ class DockerClient
"""
Run commands by attaching a websocket to Docker.
"""
command = submission.execution_environment.send(:"run_command") % command_substitutions(filename)
command = submission.execution_environment.run_command % command_substitutions(filename)
create_workspace_files = proc { create_workspace_files(container, submission) }
execute_websocket_command(command, create_workspace_files, block)
end
@ -227,7 +227,7 @@ class DockerClient
"""
Stick to existing Docker API with exec command.
"""
command = submission.execution_environment.send(:"test_command") % command_substitutions(filename)
command = submission.execution_environment.test_command % command_substitutions(filename)
create_workspace_files = proc { create_workspace_files(container, submission) }
execute_command(command, create_workspace_files, block)
end

View File

@ -83,10 +83,13 @@ class DockerContainerPool
def self.refill_for_execution_environment(execution_environment)
refill_count = [execution_environment.pool_size - @all_containers[execution_environment.id].length, config[:refill][:batch_size]].min
if refill_count > 0
Rails.logger.info('adding ' + refill_count.to_s + ' containers for ' + execution_environment.name )
Rails.logger.info('Adding ' + refill_count.to_s + ' containers for execution_environment ' + execution_environment.name )
c = refill_count.times.map { create_container(execution_environment) }
Rails.logger.debug('Created containers: ' + c.to_s )
@containers[execution_environment.id] += c
@all_containers[execution_environment.id] += c
Rails.logger.debug('@containers ' + @containers.object_id.to_s + ' has:'+ @containers[execution_environment.id].to_s)
Rails.logger.debug('@all_containers ' + @containers.object_id.to_s + ' has:'+ @all_containers[execution_environment.id].to_s)
#refill_count.times.map { create_container(execution_environment) }
end