ray icon indicating copy to clipboard operation
ray copied to clipboard

[Test Bug] Matching `psutil.Process.name()` doesn't work on macOS

Open kfstorm opened this issue 3 years ago • 3 comments

Python workers leverage setproctitle to update the process title to something like ray::IDLE or ray::IDLE_SpillWorker. Sometimes we need to match the titles of processes returned from psutil.process_iter() to get the info of workers. e.g.

https://github.com/ray-project/ray/blob/b3a9d4d87d31255e0871852efaf1ddff7acdc390/python/ray/tests/test_multi_node.py#L69-L79

This works on Linux. However, on macOS, psutil.Process.name() returns the original command line while psutil.Process.cmdline() returns a list of strings with the modified process title included.

> ps 93591
  PID   TT  STAT      TIME COMMAND
93591 s000  S      0:01.57 ray::IDLE
> python -c 'import psutil; proc = psutil.Process(93591); print(proc.name()); print(proc.cmdline());'
python3.7
['ray::IDLE', '', '', '', '', '', '', '', '', '', '', '', '']

As a result, some test cases may not behave correctly on macOS.

kfstorm avatar Dec 09 '21 06:12 kfstorm

Hi, I'm a bot from the Ray team :)

To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.

If there is no further activity in the 14 days, the issue will be closed!

  • If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
  • If you'd like to get more attention to the issue, please tag one of Ray's contributors.

You can always ask for help on our discussion forum or Ray's public slack channel.

stale[bot] avatar Apr 08 '22 10:04 stale[bot]

Still valid

kfstorm avatar Apr 11 '22 08:04 kfstorm

Hi, I'm a bot from the Ray team :)

To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.

If there is no further activity in the 14 days, the issue will be closed!

  • If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
  • If you'd like to get more attention to the issue, please tag one of Ray's contributors.

You can always ask for help on our discussion forum or Ray's public slack channel.

stale[bot] avatar Aug 10 '22 03:08 stale[bot]

Still valid

kfstorm avatar Aug 11 '22 04:08 kfstorm

Hi, I'm a bot from the Ray team :)

To help human contributors to focus on more relevant issues, I will automatically add the stale label to issues that have had no activity for more than 4 months.

If there is no further activity in the 14 days, the issue will be closed!

  • If you'd like to keep the issue open, just leave any comment, and the stale label will be removed!
  • If you'd like to get more attention to the issue, please tag one of Ray's contributors.

You can always ask for help on our discussion forum or Ray's public slack channel.

stale[bot] avatar Dec 11 '22 08:12 stale[bot]