Skip to content

Commit

Permalink
feat: set ISOLATE_SERVER_VERSION for agent (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop authored Jun 6, 2024
1 parent 21fbea8 commit 7f4eadc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/isolate/connections/_local/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"

Expand Down
3 changes: 3 additions & 0 deletions src/isolate/connections/grpc/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"):
Expand Down

0 comments on commit 7f4eadc

Please sign in to comment.