Skip to content

Commit c7dc71f

Browse files
authored
Merge pull request #4320 from grondo/issue#4168
python: uri: fix intermittent failure of fallback pid resolver
2 parents 78d2cb0 + c9a379e commit c7dc71f

File tree

1 file changed

+9
-3
lines changed
  • src/bindings/python/flux/uri/resolvers

1 file changed

+9
-3
lines changed

src/bindings/python/flux/uri/resolvers/pid.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,15 @@ def _get_broker_child_fallback(broker_pid):
3737
# of a TOU-TOC race here, so just ignore all errors
3838
pass
3939
else:
40-
ppid = int(data.split()[3])
41-
if ppid == broker_pid:
42-
return pid
40+
match = re.match(r"^[0-9]+ \(.*\) \w+ ([0-9]+)", data)
41+
# Attempt to convert match to integer. On regex match failure,
42+
# or integer conversion failure, just skip this entry
43+
try:
44+
ppid = int(match.group(1))
45+
if ppid == broker_pid:
46+
return pid
47+
except (IndexError, ValueError):
48+
pass
4349
raise ValueError(f"PID {broker_pid} is a flux-broker and no child found")
4450

4551

0 commit comments

Comments
 (0)