I want to set a new limit of possible open files with the command:
import resource
resource.setrlimit(RLIMIT_NOFILE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
However, I'm getting an error: ValueError: current limit exceeds maximum limit
Is there any way to overcome this and set a new limit on OS X?
You can only do it like this in Mac os.
import resource
target_procs = 10240
your_procs = ???
real_procs = min(target_procs, your_procs)
resource.setrlimit(RLIMIT_NOFILE, real_procs, resource.RLIM_INFINITY))
The reference is https://github.com/chapmanb/bcbio-nextgen/commit/0f590e12854df466053fcbfa590ab4ce9d7b9c45#diff-56930ee326340a3ab74bf8a0368e2d55