mirror of
https://github.com/wassname/ray.git
synced 2026-09-09 11:32:43 +08:00
Set the process title in workers and actors (#3219)
This commit is contained in:
committed by
Robert Nishihara
parent
f3efcd2342
commit
725df3a485
@@ -4,6 +4,7 @@ from __future__ import print_function
|
||||
|
||||
import os
|
||||
import re
|
||||
import setproctitle
|
||||
import string
|
||||
import subprocess
|
||||
import sys
|
||||
@@ -2299,6 +2300,26 @@ def test_wait_reconstruction(shutdown_only):
|
||||
assert len(ready_ids) == 1
|
||||
|
||||
|
||||
def test_ray_setproctitle(shutdown_only):
|
||||
ray.init(num_cpus=2)
|
||||
|
||||
@ray.remote
|
||||
class UniqueName(object):
|
||||
def __init__(self):
|
||||
assert setproctitle.getproctitle() == "ray_UniqueName:__init__()"
|
||||
|
||||
def f(self):
|
||||
assert setproctitle.getproctitle() == "ray_UniqueName:f()"
|
||||
|
||||
@ray.remote
|
||||
def unique_1():
|
||||
assert setproctitle.getproctitle() == "ray_worker:runtest.unique_1()"
|
||||
|
||||
actor = UniqueName.remote()
|
||||
ray.get(actor.f.remote())
|
||||
ray.get(unique_1.remote())
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
os.getenv("TRAVIS") is None,
|
||||
reason="This test should only be run on Travis.")
|
||||
|
||||
Reference in New Issue
Block a user