Remove AWS study
This commit is contained in:

committed by
Sebastian Serth

parent
1dd8b4d8ff
commit
bbb791471b
@ -200,8 +200,7 @@ class Submission < ApplicationRecord
|
||||
def prepared_runner
|
||||
request_time = Time.zone.now
|
||||
begin
|
||||
@used_execution_environment = AwsStudy.get_execution_environment(user, exercise)
|
||||
runner = Runner.for(user, @used_execution_environment)
|
||||
runner = Runner.for(user, exercise.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}." }
|
||||
|
@ -1,30 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AwsStudy
|
||||
def self.get_for(exercise)
|
||||
java20_collection = ExerciseCollection.find_by(name: 'java2020', id: 11)
|
||||
java20_bonus_collection = ExerciseCollection.find_by(name: 'java2020-bonusexercise', id: 12)
|
||||
|
||||
exercise.exercise_collections.any? {|ec| [java20_collection, java20_bonus_collection].include?(ec) }
|
||||
end
|
||||
|
||||
def self.get_execution_environment(user, exercise)
|
||||
# Poseidon is disabled and thus no AWS support available
|
||||
return exercise.execution_environment unless Runner::Strategy::Poseidon == Runner.strategy_class
|
||||
|
||||
java20_exercise = get_for(exercise)
|
||||
# Exercise is not part of the experiment
|
||||
return exercise.execution_environment unless java20_exercise
|
||||
|
||||
user_group = UserGroupSeparator.get_aws_group(user.id)
|
||||
case user_group
|
||||
when :use_aws
|
||||
# AWS functions are currently identified with their name
|
||||
aws_function = ExecutionEnvironment.find_by(docker_image: 'java11Exec')
|
||||
# Fallback to the default execution environment if no AWS function is found
|
||||
aws_function || exercise.execution_environment
|
||||
else # :no_aws
|
||||
exercise.execution_environment
|
||||
end
|
||||
end
|
||||
end
|
@ -32,16 +32,4 @@ class UserGroupSeparator
|
||||
:no_community_solution
|
||||
end
|
||||
end
|
||||
|
||||
# Different user groups for using AWS lambda functions instead of Nomad based on the user_id
|
||||
# This test is independent from any other A/B Test
|
||||
def self.get_aws_group(user_id)
|
||||
user_group = user_id % 2 # => 0, 1
|
||||
case user_group
|
||||
when 0
|
||||
:no_aws
|
||||
else # 1
|
||||
:use_aws
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user