Adding some limits and monitoring with iNotify
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -10,6 +10,7 @@ gem "aws-sdk-ecr"
|
||||
gem "ffi-rzmq"
|
||||
gem "zeitwerk"
|
||||
gem "docopt"
|
||||
gem 'rb-inotify', '~> 0.9.7'
|
||||
|
||||
group :development, :test do
|
||||
# gem "bundler"
|
||||
|
||||
@@ -9,6 +9,7 @@ require 'aws-sdk-sts'
|
||||
require 'yaml'
|
||||
require 'json'
|
||||
require 'ffi-rzmq'
|
||||
require 'rb-inotifyq'
|
||||
|
||||
require "zeitwerk"
|
||||
loader = Zeitwerk::Loader.for_gem
|
||||
|
||||
@@ -35,7 +35,19 @@ module Pipeline::Util
|
||||
end
|
||||
|
||||
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)
|
||||
puts "ALL DONE"
|
||||
notifier.stop
|
||||
end
|
||||
|
||||
def run_analyzer_for(exercise_slug)
|
||||
|
||||
@@ -55,6 +55,16 @@ module Pipeline::Util
|
||||
"type": "RLIMIT_NOFILE",
|
||||
"hard": 1024,
|
||||
"soft": 1024
|
||||
},
|
||||
{
|
||||
"type": "RLIMIT_CPU",
|
||||
"hard": 70,
|
||||
"soft": 60
|
||||
},
|
||||
{
|
||||
"type": "RLIMIT_RTTIME",
|
||||
"hard": 70,
|
||||
"soft": 60
|
||||
}
|
||||
],
|
||||
"noNewPrivileges": true
|
||||
|
||||
Reference in New Issue
Block a user