Backup commit
This commit is contained in:
2
Gemfile
2
Gemfile
@ -60,7 +60,7 @@ group :test do
|
|||||||
gem 'nyan-cat-formatter'
|
gem 'nyan-cat-formatter'
|
||||||
gem 'rake'
|
gem 'rake'
|
||||||
gem 'rspec-autotest'
|
gem 'rspec-autotest'
|
||||||
gem 'rspec-rails', '~> 3.1.0'
|
gem 'rspec-rails'
|
||||||
gem 'selenium-webdriver'
|
gem 'selenium-webdriver'
|
||||||
gem 'simplecov', require: false
|
gem 'simplecov', require: false
|
||||||
end
|
end
|
||||||
|
@ -363,7 +363,7 @@ DEPENDENCIES
|
|||||||
rake
|
rake
|
||||||
ransack
|
ransack
|
||||||
rspec-autotest
|
rspec-autotest
|
||||||
rspec-rails (~> 3.1.0)
|
rspec-rails
|
||||||
rubocop
|
rubocop
|
||||||
rubocop-rspec
|
rubocop-rspec
|
||||||
rubytree
|
rubytree
|
||||||
|
@ -23,7 +23,7 @@ class Exercise < ActiveRecord::Base
|
|||||||
validates :token, presence: true, uniqueness: true
|
validates :token, presence: true, uniqueness: true
|
||||||
|
|
||||||
def average_percentage
|
def average_percentage
|
||||||
(average_score / maximum_score * 100).round if average_score
|
(average_score/ maximum_score * 100).round if average_score
|
||||||
end
|
end
|
||||||
|
|
||||||
def average_score
|
def average_score
|
||||||
|
@ -172,7 +172,12 @@ class DockerClient
|
|||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
{status: :timeout}
|
{status: :timeout}
|
||||||
ensure
|
ensure
|
||||||
Concurrent::Future.execute { self.class.destroy_container(container) }
|
Concurrent::Future.execute {
|
||||||
|
#self.class.destroy_container(container)
|
||||||
|
FileUtils.rm_rf(local_workspace_path(container)) if local_workspace_path(container)
|
||||||
|
FileUtils.mkdir(local_workspace_path)
|
||||||
|
DockerContainerPool.return_container(container, @execution_environment)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
private :send_command
|
private :send_command
|
||||||
|
|
||||||
|
@ -20,6 +20,11 @@ class DockerContainerPool
|
|||||||
DockerClient.create_container(execution_environment)
|
DockerClient.create_container(execution_environment)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.return_container(container, execution_environment)
|
||||||
|
#container.start()
|
||||||
|
@containers[execution_environment.id].push(container)
|
||||||
|
end
|
||||||
|
|
||||||
def self.get_container(execution_environment)
|
def self.get_container(execution_environment)
|
||||||
if config[:active]
|
if config[:active]
|
||||||
@containers[execution_environment.id].try(:shift) || create_container(execution_environment)
|
@containers[execution_environment.id].try(:shift) || create_container(execution_environment)
|
||||||
|
Reference in New Issue
Block a user