Weired question

How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

import ray
from selenium import webdriver
ray.init()

@ray.remote
class test:
fg = False
def init(self):
if test.fg: return
test.fg = True
self.driver = webdriver.Chrome()

w = [test.remote() for _ in range(4)]

This part of the code would have worked fine in pycharm (four chrome Windows would have popped up), but if the py test.py statement had not achieved the same result on the command line, nothing would have ended in a few seconds, and no chrome window would have popped up. My pycharm uses the system python interpreter native to my computer and does not use a virtual environment. The same problem applies to ubuntu. It has nothing to do with the python version, I’ve tried it all, and it has nothing to do with the computer system. Who knows what happened.


If I uncheck this option in the pycharm run configuration, chrome won’t pop up either

hmm, i wonder if it’s because the actors have been deallocated after you finished the script. What happens if you add a sleep after line 16?

1 Like

Thanks for your reply, I tried time.sleep(), after my continuous research I have now solved the problem, the reason I am sure is related to the root thread or process, if I introduce a new thread/process to the main code then I will not have such a strange problem.

The reason that checking python console in pycharm makes a difference is that pycharm python console has ipython built in, and if it is checked, it introduces new processes/threads which in turn have an effect, but the deeper reason for this I can’t say.