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 "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"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user