Move MemoryLimit to Execution Environment

This commit is contained in:
Sebastian Serth
2021-10-24 09:55:12 +02:00
parent 8a4bd84d04
commit 0db6f20933
6 changed files with 7 additions and 7 deletions

View File

@@ -8,6 +8,8 @@ class ExecutionEnvironment < ApplicationRecord
VALIDATION_COMMAND = 'whoami'
DEFAULT_CPU_LIMIT = 20
DEFAULT_MEMORY_LIMIT = 256
MINIMUM_MEMORY_LIMIT = 4
after_initialize :set_default_values
@@ -21,7 +23,7 @@ class ExecutionEnvironment < ApplicationRecord
validate :working_docker_image?, if: :validate_docker_image?
validates :docker_image, presence: true
validates :memory_limit,
numericality: {greater_than_or_equal_to: DockerClient::MINIMUM_MEMORY_LIMIT, only_integer: true}, presence: true
numericality: {greater_than_or_equal_to: MINIMUM_MEMORY_LIMIT, only_integer: true}, presence: true
validates :network_enabled, boolean_presence: true
validates :name, presence: true
validates :permitted_execution_time, numericality: {only_integer: true}, presence: true