We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bca2d7 commit ef3cad0Copy full SHA for ef3cad0
torch_xla/__init__.py
@@ -13,9 +13,11 @@
13
14
15
def server_is_alive():
16
- return len(
17
- subprocess.Popen(['pgrep', '-f', XRT_SERVER_REGEX],
18
- stdout=subprocess.PIPE).stdout.readline()) != 0
+ # pgrep returns 0 when at least one running process matches the requested name.
+ # Otherwise, the exit code is 1. If pgrep is not availiable in the system, it
+ # will return an exit code 127.
19
+ return subprocess.getstatusoutput(
20
+ 'pgrep -f "{}"'.format(XRT_SERVER_REGEX))[0] == 0
21
22
23
def _maybe_select_tpu_version():
0 commit comments