Skip to content

Commit

Permalink
Add executable paths to self-diagnostic output
Browse files Browse the repository at this point in the history
The paths to the `globus-compute-endpoint` and `process_worker_pool.py`
executables can help us to identify issues with a user's local
environment.
  • Loading branch information
rjmello committed Jun 24, 2024
1 parent be94cc6 commit 659fd91
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
New Functionality
^^^^^^^^^^^^^^^^^

- Included the paths to the ``globus-compute-endpoint`` and ``process_worker_pool.py``
executables in the ``self-diagnostic`` command output.
19 changes: 15 additions & 4 deletions compute_endpoint/globus_compute_endpoint/self_diagnostic.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ def kernel():
return kernel


def get_executable_path(exec_name: str):
def kernel():
path = shutil.which(exec_name)
click.echo(f"{path}\n")

kernel.display_name = f"which({exec_name})" # type: ignore
return kernel


def which_python():
click.echo(f"{sys.executable}\n")


def get_openssl_version():
click.echo(f"{ssl.OPENSSL_VERSION}\n")

Expand All @@ -106,10 +119,6 @@ def get_python_version():
click.echo(f"Python version {sys.version}\n")


def which_python():
click.echo(f"{sys.executable}\n")


def _run_command(cmd: str):
cmd_list = shlex.split(cmd)
arg0 = cmd_list[0]
Expand Down Expand Up @@ -152,6 +161,8 @@ def run_self_diagnostic(log_bytes: int = 0):
"ifconfig",
"ip route",
"netstat -r",
get_executable_path("globus-compute-endpoint"),
get_executable_path("process_worker_pool.py"),
"globus-compute-endpoint whoami",
"globus-compute-endpoint list",
cat("~/.globus_compute/*/*.yaml", wildcard=True),
Expand Down
6 changes: 3 additions & 3 deletions compute_endpoint/tests/unit/test_cli_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ def test_self_diagnostic(
res = run_line("self-diagnostic")
stdout = res.stdout_bytes.decode("utf-8")

assert stdout.count("== Diagnostic") >= 19
assert stdout.count("== Diagnostic") >= 21
assert stdout.count("Connected successfully") == 2
assert stdout.count("established SSL connection") == 2
assert conf_data in stdout
Expand Down Expand Up @@ -718,7 +718,7 @@ def test_self_diagnostic_gzip(
with gzip.open(fname, "rb") as f:
contents = f.read().decode("utf-8")

assert contents.count("== Diagnostic") >= 19
assert contents.count("== Diagnostic") >= 21


@pytest.mark.parametrize("test_data", [(True, 1), (False, 0.5), (False, "")])
Expand Down Expand Up @@ -749,7 +749,7 @@ def run_cmd():

if should_succeed:
stdout = run_cmd()
assert stdout.count("== Diagnostic") >= 19
assert stdout.count("== Diagnostic") >= 21
else:
with pytest.raises(AssertionError):
stdout = run_cmd()
Expand Down

0 comments on commit 659fd91

Please sign in to comment.