Set rlimit for open files to max allowed on bots
Bug: 127264123
Change-Id: I10641cef7f5ad2d838a1f3f840478bf87322e20c
diff --git a/tools/archive.py b/tools/archive.py
index 2c2b135..25e6a4f 100755
--- a/tools/archive.py
+++ b/tools/archive.py
@@ -91,6 +91,10 @@
def GetMavenUrl(is_master):
return GetVersionDestination('http://storage.googleapis.com/', '', is_master)
+def SetRLimitToMax():
+ (soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE)
+ resource.setrlimit(resource.RLIMIT_NOFILE, (hard, hard))
+
def PrintResourceInfo():
(soft, hard) = resource.getrlimit(resource.RLIMIT_NOFILE)
print('INFO: Open files soft limit: %s' % soft)
@@ -101,6 +105,8 @@
if not utils.is_bot() and not options.dry_run:
raise Exception('You are not a bot, don\'t archive builds')
+ if utils.is_bot():
+ SetRLimitToMax()
PrintResourceInfo()
# Create maven release which uses a build that exclude dependencies.
create_maven_release.main(["--out", utils.LIBS])