Phantom stdout when # actors > # cpus

I’m running ray 1.4.0, and I’ve noticed that ray prints empty (pid=…) lines to the terminal when the number of actors exceeds the number of cpus. I wonder if this is intentional, and/or how to disable this annoying behavior.

Here’s a simple example:

ray.init(num_cpus=1)

@ray.remote
class Actor:
pass

Actor.remote()
Actor.remote()
time.sleep(5) # the print takes a second or two to show up

ray.shutdown()

When I ran

   ...: @ray.remote 
    ...: class Actor: 
    ...:     def __init__(self): 
    ...:         print("a") 
    ...:  
    ...: a = Actor.remote() 
    ...: b= Actor.remote() 
    ...: time.sleep(5) # the print takes a second or two to show up 

This prints stuff with pid correctly.

That prints correctly for me, too. I think the difference is that you assign handles to the actor objects, so they don’t get killed until those handles go out of scope or ray.shutdown() is called. If you add ray.kill(a) before time.sleep(5) nothing happens, while ray.kill(b) leads to printing an empty (pid=…) line.

In my real-life application the actors always get killed sooner or later, so assigning handles just delays the print behavior.

Hmm but it makes sense actors don’t print messages when it is killed right? It’s impossible to log when it is dead

Actors number 1… # cpus don’t print messages when they are killed, which is what should happen. There seems to be a bug so that additional actors beyond that (the second one in my example, but it could be any number) print a blank line when they are killed.

I guess the right answer is to file a bug report on GH?

Oh I see. I probably misread some of your comments. So you are saying when actors are killed, it prints an “empty line” which is not supposed happen. I think you are right! Can you file a Github issue?

Sure thing, thanks sangcho –