[docker] Detect CPUs in container correctly (#10507)

Co-authored-by: simon-mo <simon.mo@hey.com>
Co-authored-by: Richard Liaw <rliaw@berkeley.edu>
Co-authored-by: Alex Wu <itswu.alex@gmail.com>
This commit is contained in:
Ian Rodney
2020-09-13 23:40:48 -07:00
committed by GitHub
parent 660aee6311
commit 5bc2ba38fd
35 changed files with 173 additions and 45 deletions
@@ -70,6 +70,7 @@ class TestMemoryScheduling(unittest.TestCase):
def testTuneDriverHeapLimit(self):
try:
ray.init(num_cpus=4, _memory=100 * MB)
_register_all()
result = tune.run(
"PG",
@@ -89,6 +90,11 @@ class TestMemoryScheduling(unittest.TestCase):
def testTuneDriverStoreLimit(self):
try:
ray.init(
num_cpus=4,
_memory=100 * MB,
object_store_memory=100 * MB,
)
_register_all()
self.assertRaisesRegexp(
ray.tune.error.TuneError,
@@ -107,6 +113,7 @@ class TestMemoryScheduling(unittest.TestCase):
def testTuneWorkerHeapLimit(self):
try:
ray.init(num_cpus=4, _memory=100 * MB)
_register_all()
result = tune.run(
"PG",
@@ -127,6 +134,11 @@ class TestMemoryScheduling(unittest.TestCase):
def testTuneWorkerStoreLimit(self):
try:
ray.init(
num_cpus=4,
_memory=100 * MB,
object_store_memory=100 * MB,
)
_register_all()
self.assertRaisesRegexp(
ray.tune.error.TuneError,
@@ -144,6 +156,7 @@ class TestMemoryScheduling(unittest.TestCase):
def testTuneObjectLimitApplied(self):
try:
ray.init(num_cpus=2, object_store_memory=500 * MB)
result = tune.run(
train_oom,
resources_per_trial={"object_store_memory": 150 * 1024 * 1024},