Copy execution environment to Poseidon on create and update
When creating or updating an execution environment, an API call to Poseidon is made with the necessary information to create the corresponding Nomad job. If runner management is configured, his will display a warning (currently in the same color as if it were a success) in the UI, if the API call fails. The environment is saved even if it fails. If runner management is not configured, this warning will not be created.
This commit is contained in:

committed by
Sebastian Serth

parent
b762c73ddd
commit
90fac7b94c
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddCpuLimitToExecutionEnvironment < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :execution_environments, :cpu_limit, :integer, default: 20
|
||||
end
|
||||
end
|
@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CleanExposedPortsInExecutionEnvironment < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
ExecutionEnvironment.all.each do |execution_environment|
|
||||
continue if execution_environment.exposed_ports.nil?
|
||||
|
||||
cleaned = execution_environment.exposed_ports.gsub(/[[:space:]]/, '')
|
||||
list = cleaned.split(',').map(&:to_i).uniq
|
||||
if list.empty?
|
||||
execution_environment.update(exposed_ports: nil)
|
||||
else
|
||||
execution_environment.update(exposed_ports: list.join(','))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2021_05_19_134938) do
|
||||
ActiveRecord::Schema.define(version: 2021_06_02_071834) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pg_trgm"
|
||||
@ -112,6 +112,7 @@ ActiveRecord::Schema.define(version: 2021_05_19_134938) do
|
||||
t.integer "file_type_id"
|
||||
t.integer "memory_limit"
|
||||
t.boolean "network_enabled"
|
||||
t.integer "cpu_limit"
|
||||
end
|
||||
|
||||
create_table "exercise_collection_items", id: :serial, force: :cascade do |t|
|
||||
|
Reference in New Issue
Block a user