Skip to content

Commit

Permalink
collect a quickstack in rage
Browse files Browse the repository at this point in the history
Summary: Collecting `quickstack` would be helpful so we can to get a threadpool overview for debugging purposes

Reviewed By: kmancini

Differential Revision: D54702322

fbshipit-source-id: 48eac413d0b928640d8884ed99ba4505841da1fe
  • Loading branch information
genevievehelsel authored and facebook-github-bot committed Mar 16, 2024
1 parent 841737a commit 941e177
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions eden/fs/cli/rage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
from .config import EdenInstance

try:
from .facebook.rage import find_fb_cdb, get_host_dashboard_url, setup_fb_env
from .facebook.rage import (
find_fb_cdb,
get_host_dashboard_url,
get_quickstack_cmd,
setup_fb_env,
)

except ImportError:

Expand All @@ -50,6 +55,11 @@ def get_host_dashboard_url(
) -> Optional[str]:
return None

def get_quickstack_cmd(
instance: EdenInstance,
) -> Optional[List[str]]:
return None


try:
from eden.fs.cli.doctor.facebook.check_vscode_extensions import (
Expand Down Expand Up @@ -314,6 +324,17 @@ def print_diagnostic_info(

print_system_load(out)

quickstack_cmd = get_quickstack_cmd(instance)

if quickstack_cmd:
section_title("Quickstack:", out)
paste_output(
lambda sink: run_cmd(quickstack_cmd, sink, out),
processor,
out,
dry_run,
)

print_ulimits(out)


Expand Down Expand Up @@ -614,8 +635,17 @@ def print_system_load(out: IO[bytes]) -> None:
out.write(f"Error printing system load: {e}\n".encode())


def run_edenfsctl_cmd(cmd: List[str], sink: IO[bytes]) -> None:
subprocess.run(cmd, check=True, stderr=subprocess.STDOUT, stdout=sink)
def run_cmd(
cmd: List[str], sink: IO[bytes], out: IO[bytes], timeout: float = 10
) -> None:
try:
subprocess.run(
cmd, check=True, stderr=subprocess.STDOUT, stdout=sink, timeout=timeout
)
except subprocess.TimeoutExpired:
out.write(
f"Command {' '.join(cmd)} timed out after {timeout} seconds\n".encode()
)


def print_eden_config(
Expand All @@ -625,7 +655,7 @@ def print_eden_config(
fsconfig_cmd = ["edenfsctl", "fsconfig", "--all"]

result = paste_output(
lambda sink: run_edenfsctl_cmd(fsconfig_cmd, sink),
lambda sink: run_cmd(fsconfig_cmd, sink, out),
processor,
out,
dry_run,
Expand Down Expand Up @@ -740,7 +770,7 @@ def print_recent_events(processor: str, out: IO[bytes], dry_run: bool) -> None:
try:
out.write(f"{opt}: ".encode())
paste_output(
lambda sink: run_edenfsctl_cmd(trace_cmd, sink),
lambda sink, trace_cmd=trace_cmd: run_cmd(trace_cmd, sink, out),
processor,
out,
dry_run,
Expand Down

0 comments on commit 941e177

Please sign in to comment.