Skip to content

Commit

Permalink
Remove method about py-spy permissions from every py-spy error. (#31600)
Browse files Browse the repository at this point in the history
This confused people into thinking the error was related to permissioning when it was really a much simpler error like "no stacks currently running".

When it is a permissioning error, this shouldn't be necessary since py-py already returns a message like "Permission Denied: Try running again with elevated permissions by going 'sudo env "PATH=$PATH" !!'" in stderr.

Signed-off-by: Alan Guo <aguo@anyscale.com>
  • Loading branch information
alanwguo committed Jan 12, 2023
1 parent 6d00593 commit 1c53c9c
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions dashboard/modules/reporter/profile_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

logger = logging.getLogger(__name__)


def _format_failed_pyspy_command(cmd, stdout, stderr) -> str:
return f"""Failed to execute `{cmd}`.
PYSPY_PERMISSIONS_ERROR_MESSAGE = """
Note that this command requires `py-spy` to be installed with root permissions. You
can install `py-spy` and give it root permissions as follows:
$ pip install py-spy
Expand All @@ -19,11 +16,25 @@ def _format_failed_pyspy_command(cmd, stdout, stderr) -> str:
Alternatively, you can start Ray with passwordless sudo / root permissions.
=== stdout ===
{stdout.decode("utf-8")}
"""


def _format_failed_pyspy_command(cmd, stdout, stderr) -> str:
stderr_str = stderr.decode("utf-8")

# If some sort of permission error returned, show a message about how
# to set up permissions correctly.
extra_message = (
PYSPY_PERMISSIONS_ERROR_MESSAGE if "permission" in stderr_str.lower() else ""
)

return f"""Failed to execute `{cmd}`.
{extra_message}
=== stderr ===
{stderr.decode("utf-8")}
=== stdout ===
{stdout.decode("utf-8")}
"""


Expand Down

0 comments on commit 1c53c9c

Please sign in to comment.