Custom process name for Ray actors

  • Low: It annoys or frustrates me for a moment

Hi, I’m using ray actors to run my tasks in parallel. I have a task need to be repeatedly run multiple times. I want a more informative process name in htop so I can monitor the task step without looking into the long stdout output.

class Trainer:
    def __init__(self, player, iteration, config):
        self.player = player
        self.iteration = iteration = f'{player}_{iteration:03d}'
        self.config = config

    def result(self):
        analysis ='PPO', config)
        return analysis

resultA, resultB = None, None
for i in range(1, 21):
    # update config
    configA, configB = ...
    actorA = Trainer.remote('PlayerA', i, config)
    actorB = Trainer.remote('PlayerB', i, config)
    resultA, resultB = ray.get([actorA.result(), actorB.result()])

I got ray:Trainer.__init__() and ray:Trainer.result() in htop. The actor process name is ray:<class name>.<method name>(). I expect a process name with ray:PlayerA_003.result() or something similar.

Is it possible to customize the actor process name?

I tried:

actor = Trainer.options(name='xxx').remote()

but it still gives ray:<class name>.<method name>().

Edit: unfortunately this doesn’t seem to work for the process name.

Hi, check our the custom Actor log prefix feature: Logging — Ray 2.0.0.dev0

cc @sangcho it might be nice to put the actor name in the prefix automatically by default as well, that seems pretty intuitive.

Thanks for the post. I’m curious about setting process names in top-like process monitors. The .log file (and/or stdout / stderr) is too long for me.

I can customize the process name by setproctitle (

import time

import ray
from setproctitle import setproctitle

class Timer:
    def __init__(self, name, duration): = name
        self.duration = duration

    def sleep(self):


actor = Timer.remote(name='MyNamed', duration=120)

Thanks. @ericl @XuehaiPan please check if this issue seems to be what you guys are looking for; [Core Observability] Include name to actor log prefix + process name · Issue #24876 · ray-project/ray · GitHub