mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
Consistent Name for Process Title (#6276)
* Consistent naming for setprotitle * Address comments * Add debug/verbose mode * Fix test
This commit is contained in:
parent
141d667cee
commit
1ca8c427e3
4 changed files with 22 additions and 11 deletions
|
@ -536,14 +536,14 @@ cdef execute_task(
|
|||
b' "task_id": ' + task_id.Hex() + b'}')
|
||||
|
||||
if <int>task_type == <int>TASK_TYPE_NORMAL_TASK:
|
||||
title = "ray_worker:{}()".format(function_name)
|
||||
next_title = "ray_worker"
|
||||
title = "ray::{}()".format(function_name)
|
||||
next_title = "ray::IDLE"
|
||||
function_executor = execution_info.function
|
||||
else:
|
||||
actor = worker.actors[core_worker.get_actor_id()]
|
||||
class_name = actor.__class__.__name__
|
||||
title = "ray_{}:{}()".format(class_name, function_name)
|
||||
next_title = "ray_{}".format(class_name)
|
||||
title = "ray::{}.{}()".format(class_name, function_name)
|
||||
next_title = "ray::{}".format(class_name)
|
||||
worker_name = "ray_{}_{}".format(class_name, os.getpid())
|
||||
if c_resources.find(b"memory") != c_resources.end():
|
||||
worker.memory_monitor.set_heap_limit(
|
||||
|
|
|
@ -420,7 +420,12 @@ def start(node_ip_address, redis_address, address, redis_port,
|
|||
"--force",
|
||||
is_flag=True,
|
||||
help="If set, ray will send SIGKILL instead of SIGTERM.")
|
||||
def stop(force):
|
||||
@click.option(
|
||||
"-v",
|
||||
"--verbose",
|
||||
is_flag=True,
|
||||
help="If set, ray prints out more information about processes to kill.")
|
||||
def stop(force, verbose):
|
||||
# Note that raylet needs to exit before object store, otherwise
|
||||
# it cannot exit gracefully.
|
||||
processes_to_kill = [
|
||||
|
@ -440,7 +445,7 @@ def stop(force):
|
|||
["monitor.py", False],
|
||||
["redis-server", True],
|
||||
["default_worker.py", False], # Python worker.
|
||||
["ray_", True], # Python worker.
|
||||
["ray::", True], # Python worker.
|
||||
["org.ray.runtime.runner.worker.DefaultWorker", False], # Java worker.
|
||||
["log_monitor.py", False],
|
||||
["reporter.py", False],
|
||||
|
@ -463,13 +468,19 @@ def stop(force):
|
|||
str(len(keyword)) + ". Filter: " + keyword)
|
||||
else:
|
||||
ps_format = "pid,args"
|
||||
|
||||
debug_operator = "| tee /dev/stderr" if verbose else ""
|
||||
|
||||
command = (
|
||||
"kill -s {} $(ps ax -o {} | grep {} | grep -v grep | grep ray | "
|
||||
"kill -s {} $(ps ax -o {} | grep {} | grep -v grep {} | grep ray |"
|
||||
"awk '{{ print $1 }}') 2> /dev/null".format(
|
||||
# ^^ This is how you escape braces in python format string.
|
||||
signal_name,
|
||||
ps_format,
|
||||
keyword))
|
||||
keyword,
|
||||
debug_operator))
|
||||
if verbose:
|
||||
logger.info("Calling '{}'".format(command))
|
||||
subprocess.call([command], shell=True)
|
||||
|
||||
|
||||
|
|
|
@ -1843,10 +1843,10 @@ def test_ray_setproctitle(ray_start_2_cpus):
|
|||
@ray.remote
|
||||
class UniqueName(object):
|
||||
def __init__(self):
|
||||
assert setproctitle.getproctitle() == "ray_UniqueName:__init__()"
|
||||
assert setproctitle.getproctitle() == "ray::UniqueName.__init__()"
|
||||
|
||||
def f(self):
|
||||
assert setproctitle.getproctitle() == "ray_UniqueName:f()"
|
||||
assert setproctitle.getproctitle() == "ray::UniqueName.f()"
|
||||
|
||||
@ray.remote
|
||||
def unique_1():
|
||||
|
|
|
@ -1094,7 +1094,7 @@ def connect(node,
|
|||
# TODO(qwang): Rename this to `worker_id_str` or type to `WorkerID`
|
||||
worker.worker_id = _random_string()
|
||||
if setproctitle:
|
||||
setproctitle.setproctitle("ray_worker")
|
||||
setproctitle.setproctitle("ray::IDLE")
|
||||
elif mode is LOCAL_MODE:
|
||||
# Code path of local mode
|
||||
if job_id is None:
|
||||
|
|
Loading…
Add table
Reference in a new issue