Remove ray.tasks() from API. (#7807)

This commit is contained in:
Robert Nishihara
2020-04-01 10:10:40 -05:00
committed by GitHub
parent 780c1c3b08
commit b011c604d7
13 changed files with 38 additions and 622 deletions
-28
View File
@@ -94,15 +94,6 @@ def wait_for_num_actors(num_actors, timeout=10):
raise RayTestTimeoutException("Timed out while waiting for global state.")
def wait_for_num_tasks(num_tasks, timeout=10):
start_time = time.time()
while time.time() - start_time < timeout:
if len(ray.tasks()) >= num_tasks:
return
time.sleep(0.1)
raise RayTestTimeoutException("Timed out while waiting for global state.")
def wait_for_num_objects(num_objects, timeout=10):
start_time = time.time()
while time.time() - start_time < timeout:
@@ -123,9 +114,6 @@ def test_global_state_api(shutdown_only):
with pytest.raises(Exception, match=error_message):
ray.actors()
with pytest.raises(Exception, match=error_message):
ray.tasks()
with pytest.raises(Exception, match=error_message):
ray.nodes()
@@ -142,22 +130,6 @@ def test_global_state_api(shutdown_only):
job_id = ray.utils.compute_job_id_from_driver(
ray.WorkerID(ray.worker.global_worker.worker_id))
driver_task_id = ray.worker.global_worker.current_task_id.hex()
# One task is put in the task table which corresponds to this driver.
wait_for_num_tasks(1)
task_table = ray.tasks()
assert len(task_table) == 1
assert driver_task_id == list(task_table.keys())[0]
task_spec = task_table[driver_task_id]["TaskSpec"]
nil_actor_id_hex = ray.ActorID.nil().hex()
assert task_spec["TaskID"] == driver_task_id
assert task_spec["ActorID"] == nil_actor_id_hex
assert task_spec["Args"] == []
assert task_spec["JobID"] == job_id.hex()
assert task_spec["FunctionDescriptor"]["type"] == "EmptyFunctionDescriptor"
assert task_spec["ReturnObjectIDs"] == []
client_table = ray.nodes()
node_ip_address = ray.worker.global_worker.node_ip_address