mirror of
https://github.com/wassname/ray.git
synced 2026-07-24 13:20:22 +08:00
Add ray stack tool for debugging (#3213)
This commit is contained in:
committed by
Robert Nishihara
parent
ca7d4c2cf5
commit
9a0f0db070
@@ -5,6 +5,7 @@ from __future__ import print_function
|
||||
import os
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
@@ -2296,3 +2297,38 @@ def test_wait_reconstruction(shutdown_only):
|
||||
ray.pyarrow.plasma.ObjectID(x_id.id()))
|
||||
ready_ids, _ = ray.wait([x_id])
|
||||
assert len(ready_ids) == 1
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
os.getenv("TRAVIS") is None,
|
||||
reason="This test should only be run on Travis.")
|
||||
def test_ray_stack(shutdown_only):
|
||||
ray.init(num_cpus=2)
|
||||
|
||||
def unique_name_1():
|
||||
time.sleep(1000)
|
||||
|
||||
@ray.remote
|
||||
def unique_name_2():
|
||||
time.sleep(1000)
|
||||
|
||||
@ray.remote
|
||||
def unique_name_3():
|
||||
unique_name_1()
|
||||
|
||||
unique_name_2.remote()
|
||||
unique_name_3.remote()
|
||||
|
||||
success = False
|
||||
start_time = time.time()
|
||||
while time.time() - start_time < 30:
|
||||
# Attempt to parse the "ray stack" call.
|
||||
output = ray.utils.decode(subprocess.check_output(["ray", "stack"]))
|
||||
if ("unique_name_1" in output and "unique_name_2" in output
|
||||
and "unique_name_3" in output):
|
||||
success = True
|
||||
break
|
||||
|
||||
if not success:
|
||||
raise Exception("Failed to find necessary information with "
|
||||
"'ray stack'")
|
||||
|
||||
Reference in New Issue
Block a user