Merge pull request #1237 from openHPI/aws_experiment
Prepare AWS Experiment
This commit is contained in:
@ -16,6 +16,7 @@ class ExecutionEnvironment < ApplicationRecord
|
||||
has_many :exercises
|
||||
belongs_to :file_type
|
||||
has_many :error_templates
|
||||
belongs_to :testrun_execution_environment, optional: true, dependent: :destroy
|
||||
|
||||
scope :with_exercises, -> { where('id IN (SELECT execution_environment_id FROM exercises)') }
|
||||
|
||||
|
@ -46,6 +46,8 @@ class Submission < ApplicationRecord
|
||||
|
||||
validates :cause, inclusion: {in: CAUSES}
|
||||
|
||||
attr_reader :used_execution_environment
|
||||
|
||||
# after_save :trigger_working_times_action_cable
|
||||
|
||||
def build_files_hash(files, attribute)
|
||||
@ -195,7 +197,8 @@ class Submission < ApplicationRecord
|
||||
def prepared_runner
|
||||
request_time = Time.zone.now
|
||||
begin
|
||||
runner = Runner.for(user, exercise.execution_environment)
|
||||
@used_execution_environment = AwsStudy.get_execution_environment(user, exercise)
|
||||
runner = Runner.for(user, @used_execution_environment)
|
||||
files = collect_files
|
||||
files.reject!(&:teacher_defined_assessment?) if cause == 'run'
|
||||
Rails.logger.debug { "#{Time.zone.now.getutc.inspect}: Copying files to Runner #{runner.id} for #{user_type} #{user_id} and Submission #{id}." }
|
||||
@ -253,6 +256,7 @@ class Submission < ApplicationRecord
|
||||
container_execution_time: output[:container_execution_time],
|
||||
waiting_for_container_time: output[:waiting_for_container_time]
|
||||
)
|
||||
TestrunExecutionEnvironment.create(testrun: testrun, execution_environment: @used_execution_environment)
|
||||
|
||||
filename = file.filepath
|
||||
|
||||
|
@ -3,4 +3,5 @@
|
||||
class Testrun < ApplicationRecord
|
||||
belongs_to :file, class_name: 'CodeOcean::File', optional: true
|
||||
belongs_to :submission
|
||||
belongs_to :testrun_execution_environment, optional: true, dependent: :destroy
|
||||
end
|
||||
|
6
app/models/testrun_execution_environment.rb
Normal file
6
app/models/testrun_execution_environment.rb
Normal file
@ -0,0 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class TestrunExecutionEnvironment < ApplicationRecord
|
||||
belongs_to :testrun
|
||||
belongs_to :execution_environment
|
||||
end
|
Reference in New Issue
Block a user