qinling/runtimes/python2/custom-entrypoint.sh
Lingxian Kong 09f5e6dc60 Limit resource consumption of function
Usages of following resources are limited(for at least python runtime):
- cpu
- process number
- file descriptor
- file size

Change-Id: I3bbd9e7a46a970eb0d9e99d1258b7b27407c0d90
Implements: blueprint qinling-container-resource-limitation
2017-12-04 23:26:13 +13:00

19 lines
579 B
Bash

#!/usr/bin/env bash
# This is expected to run as root for setting the ulimits
set -e
# ensure increased ulimits - for nofile - for the runtime containers
# the limit on the number of files that a single process can have open at a time
ulimit -n 1024
# ensure increased ulimits - for nproc - for the runtime containers
# the limit on the number of processes
ulimit -u 128
# ensure increased ulimits - for file size - for the runtime containers
# the limit on the total file size that a single process can create, 30M
ulimit -f 61440
/sbin/setuser qinling python -u server.py