Adding some limits and monitoring with iNotify

This commit is contained in:
Charles Care
2019-11-28 17:44:27 +00:00
parent 0a79875416
commit e5d6ce5c2c
4 changed files with 24 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ gem "aws-sdk-ecr"
gem "ffi-rzmq" gem "ffi-rzmq"
gem "zeitwerk" gem "zeitwerk"
gem "docopt" gem "docopt"
gem 'rb-inotify', '~> 0.9.7'
group :development, :test do group :development, :test do
# gem "bundler" # gem "bundler"

View File

@@ -9,6 +9,7 @@ require 'aws-sdk-sts'
require 'yaml' require 'yaml'
require 'json' require 'json'
require 'ffi-rzmq' require 'ffi-rzmq'
require 'rb-inotifyq'
require "zeitwerk" require "zeitwerk"
loader = Zeitwerk::Loader.for_gem loader = Zeitwerk::Loader.for_gem

View File

@@ -35,7 +35,19 @@ module Pipeline::Util
end end
def run_analyzer def run_analyzer
notifier = INotify::Notifier.new
notifier.watch("iteration", :moved_to, :create) do |event|
puts "#{event.name} is now in iteration!"
end
notifier.watch("tmp", :moved_to, :create) do |event|
puts "#{event.name} is now in tmp!"
end
Thread.new do
notifier.run
end
runc.run(workdir) runc.run(workdir)
puts "ALL DONE"
notifier.stop
end end
def run_analyzer_for(exercise_slug) def run_analyzer_for(exercise_slug)

View File

@@ -55,6 +55,16 @@ module Pipeline::Util
"type": "RLIMIT_NOFILE", "type": "RLIMIT_NOFILE",
"hard": 1024, "hard": 1024,
"soft": 1024 "soft": 1024
},
{
"type": "RLIMIT_CPU",
"hard": 70,
"soft": 60
},
{
"type": "RLIMIT_RTTIME",
"hard": 70,
"soft": 60
} }
], ],
"noNewPrivileges": true "noNewPrivileges": true