mirror of
https://github.com/wassname/ray.git
synced 2026-06-27 20:06:31 +08:00
[Core] New scheduler fixes (#9186)
* . * test_args passes * . * test_basic.py::test_many_fractional_resources causes ray to hang * test_basic.py::test_many_fractional_resources causes ray to hang * . * . * useful * test_many_fractional_resources fails instead of hanging now :) * Passes test_fractional_resources * . * . * Some cleanup * git is hard * cleanup * Fixed scheduling tests * . * .
This commit is contained in:
@@ -7,6 +7,7 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
import socket
|
||||
import math
|
||||
|
||||
import ray
|
||||
import ray.services
|
||||
@@ -277,6 +278,22 @@ class Semaphore:
|
||||
return self._sema.locked()
|
||||
|
||||
|
||||
def dicts_equal(dict1, dict2, abs_tol=1e-4):
|
||||
"""Compares to dicts whose values may be floating point numbers."""
|
||||
|
||||
if dict1.keys() != dict2.keys():
|
||||
return False
|
||||
|
||||
for k, v in dict1.items():
|
||||
if isinstance(v, float) and \
|
||||
isinstance(dict2[k], float) and \
|
||||
math.isclose(v, dict2[k], abs_tol=abs_tol):
|
||||
continue
|
||||
if v != dict2[k]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@ray.remote
|
||||
def _put(obj):
|
||||
return obj
|
||||
|
||||
@@ -127,7 +127,7 @@ def test_many_fractional_resources(shutdown_only):
|
||||
}
|
||||
if block:
|
||||
ray.get(g.remote())
|
||||
return true_resources == accepted_resources
|
||||
return ray.test_utils.dicts_equal(true_resources, accepted_resources)
|
||||
|
||||
# Check that the resource are assigned correctly.
|
||||
result_ids = []
|
||||
|
||||
Reference in New Issue
Block a user