From 7f4eadce13dd0ed4204d2abd28f97056d5ad0ab0 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Thu, 6 Jun 2024 17:24:21 +0300 Subject: [PATCH] feat: set ISOLATE_SERVER_VERSION for agent (#143) --- src/isolate/connections/_local/_base.py | 2 ++ src/isolate/connections/grpc/agent.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/isolate/connections/_local/_base.py b/src/isolate/connections/_local/_base.py index 275c77e..ffe7a84 100644 --- a/src/isolate/connections/_local/_base.py +++ b/src/isolate/connections/_local/_base.py @@ -15,6 +15,7 @@ TypeVar, ) +from isolate import __version__ as isolate_version from isolate.backends.common import get_executable_path, logged_io from isolate.connections.common import AGENT_SIGNATURE from isolate.logs import LogLevel, LogSource @@ -138,6 +139,7 @@ def get_env_vars(self) -> dict[str, str]: immediately (so that we can seamlessly transfer logs).""" custom_vars = {} + custom_vars["ISOLATE_SERVER_VERSION"] = isolate_version custom_vars[AGENT_SIGNATURE] = "1" custom_vars["PYTHONUNBUFFERED"] = "1" diff --git a/src/isolate/connections/grpc/agent.py b/src/isolate/connections/grpc/agent.py index c45f17c..44dfef4 100644 --- a/src/isolate/connections/grpc/agent.py +++ b/src/isolate/connections/grpc/agent.py @@ -17,6 +17,7 @@ import grpc from grpc import ServicerContext, StatusCode +from isolate import __version__ as agent_version from isolate.backends.common import sha256_digest_of from isolate.connections.common import SerializationError, serialize_object from isolate.connections.grpc import definitions @@ -44,6 +45,8 @@ def Run( context: ServicerContext, ) -> Iterator[definitions.PartialRunResult]: self.log(f"A connection has been established: {context.peer()}!") + server_version = os.getenv("ISOLATE_SERVER_VERSION") or "unknown" + self.log(f"Isolate info: server {server_version}, agent {agent_version}") extra_args = [] if request.HasField("setup_func"):