Move copy_submission_files from runner to submission
This commit is contained in:

committed by
Sebastian Serth

parent
575057acd3
commit
3e6534567d
@ -185,10 +185,18 @@ class Submission < ApplicationRecord
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def copy_files_to(container)
|
||||||
|
files = {}
|
||||||
|
collect_files.each do |file|
|
||||||
|
files[file.name_with_extension] = file.content
|
||||||
|
end
|
||||||
|
container.copy_files(files)
|
||||||
|
end
|
||||||
|
|
||||||
def prepared_container
|
def prepared_container
|
||||||
request_time = Time.now
|
request_time = Time.now
|
||||||
container = Runner.new(execution_environment, execution_environment.permitted_execution_time)
|
container = Runner.new(execution_environment, execution_environment.permitted_execution_time)
|
||||||
container.copy_submission_files self
|
copy_files_to container
|
||||||
container.waiting_time = Time.now - request_time
|
container.waiting_time = Time.now - request_time
|
||||||
yield(container) if block_given?
|
yield(container) if block_given?
|
||||||
container.destroy
|
container.destroy
|
||||||
|
@ -21,14 +21,6 @@ class Runner
|
|||||||
Faraday.patch(url, body.to_json, HEADERS)
|
Faraday.patch(url, body.to_json, HEADERS)
|
||||||
end
|
end
|
||||||
|
|
||||||
def copy_submission_files(submission)
|
|
||||||
files = {}
|
|
||||||
submission.collect_files.each do |file|
|
|
||||||
files[file.name_with_extension] = file.content
|
|
||||||
end
|
|
||||||
copy_files(files)
|
|
||||||
end
|
|
||||||
|
|
||||||
def execute_command(command)
|
def execute_command(command)
|
||||||
url = "#{runner_url}/execute"
|
url = "#{runner_url}/execute"
|
||||||
response = Faraday.post(url, {command: command}.to_json, HEADERS)
|
response = Faraday.post(url, {command: command}.to_json, HEADERS)
|
||||||
|
Reference in New Issue
Block a user