Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Pass resource limits directly to warden
Browse files Browse the repository at this point in the history
Change-Id: Ifd6b27ca295d4201dddf54aefb936a7f50b1069d
  • Loading branch information
pietern committed Nov 5, 2012
1 parent a9075d5 commit 9fa8d18
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/dea/instance.rb
Expand Up @@ -634,9 +634,7 @@ def promise_prepare_start_script
def promise_start
Promise.new do |p|
script = []
script << "renice 0 $$"
script << "ulimit -n %d" % self.file_descriptor_limit
script << "ulimit -u %d" % 512

script << "umask 077"

env = Env.new(self)
Expand All @@ -657,6 +655,11 @@ def promise_start
request = ::Warden::Protocol::SpawnRequest.new
request.handle = attributes["warden_handle"]
request.script = script.join("\n")

request.rlimits = ::Warden::Protocol::ResourceLimits.new
request.rlimits.nofile = self.file_descriptor_limit
request.rlimits.nproc = 512

response = promise_warden_call(:app, request).resolve

attributes["warden_job_id"] = response.job_id
Expand Down

0 comments on commit 9fa8d18

Please sign in to comment.