mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
siso: have siso.py control if collector creates socket file.
Bug: b/455433899 Change-Id: Ic02cd97ef3db59263859eeab5cd70f986a6a6964 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7231248 Reviewed-by: Fumitoshi Ukai <ukai@google.com> Commit-Queue: Alex Ovsienko <ovsienko@google.com>
This commit is contained in:
11
siso.py
11
siso.py
@@ -139,8 +139,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
|
||||
class Status(Enum):
|
||||
HEALTHY = 1
|
||||
WRONG_ENDPOINT = 2
|
||||
UNHEALTHY = 3
|
||||
DEAD = 4
|
||||
NO_SOCKETS = 3
|
||||
UNHEALTHY = 4
|
||||
DEAD = 5
|
||||
|
||||
def collector_status() -> Status:
|
||||
conn = http.client.HTTPConnection(f"localhost:{_OTLP_HEALTH_PORT}")
|
||||
@@ -161,6 +162,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
|
||||
expected_endpoint = sockets_file or _OTLP_DEFAULT_TCP_ENDPOINT
|
||||
if endpoint != expected_endpoint:
|
||||
return Status.WRONG_ENDPOINT
|
||||
if sockets_file:
|
||||
if not os.path.exists(sockets_file):
|
||||
return Status.NO_SOCKETS
|
||||
|
||||
return Status.HEALTHY
|
||||
|
||||
@@ -215,6 +219,9 @@ def _start_collector(siso_path: str, sockets_file: Optional[str],
|
||||
status = collector_status()
|
||||
if status == Status.HEALTHY:
|
||||
return True
|
||||
# Non retriable error.
|
||||
if status == Status.WRONG_ENDPOINT:
|
||||
return False
|
||||
time.sleep(0.05)
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user