isolate 0.13.4__py3-none-any.whl → 0.13.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of isolate might be problematic. Click here for more details.
- isolate/_isolate_version.py +2 -2
- isolate/connections/grpc/_base.py +0 -2
- isolate/connections/grpc/agent.py +13 -1
- isolate/server/server.py +19 -10
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/METADATA +1 -1
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/RECORD +10 -10
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/WHEEL +1 -1
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/LICENSE +0 -0
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/entry_points.txt +0 -0
- {isolate-0.13.4.dist-info → isolate-0.13.5.dist-info}/top_level.txt +0 -0
isolate/_isolate_version.py
CHANGED
|
@@ -16,7 +16,6 @@ from isolate.connections.common import serialize_object
|
|
|
16
16
|
from isolate.connections.grpc import agent, definitions
|
|
17
17
|
from isolate.connections.grpc.configuration import get_default_options
|
|
18
18
|
from isolate.connections.grpc.interface import from_grpc
|
|
19
|
-
from isolate.logger import logger
|
|
20
19
|
from isolate.logs import LogLevel, LogSource
|
|
21
20
|
|
|
22
21
|
|
|
@@ -149,5 +148,4 @@ class LocalPythonGRPC(PythonExecutionBase[str], GRPCExecutionBase):
|
|
|
149
148
|
]
|
|
150
149
|
|
|
151
150
|
def handle_agent_log(self, line: str, level: LogLevel, source: LogSource) -> None:
|
|
152
|
-
logger.log(level, line, source)
|
|
153
151
|
self.log(line, level=level, source=source)
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
# agent-requires: isolate[server]
|
|
2
|
+
"""
|
|
3
|
+
This file contains the implementation of the gRPC agent. The agent is a
|
|
4
|
+
separate process that is responsible for running the user code in a
|
|
5
|
+
sandboxed environment.
|
|
6
|
+
|
|
7
|
+
This file is referenced by the latest version of the `isolate` package
|
|
8
|
+
but then runs it in the context of the frozen agent built environment.
|
|
9
|
+
"""
|
|
2
10
|
|
|
3
11
|
from __future__ import annotations
|
|
4
12
|
|
|
@@ -17,7 +25,11 @@ from typing import (
|
|
|
17
25
|
import grpc
|
|
18
26
|
from grpc import ServicerContext, StatusCode
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
try:
|
|
29
|
+
from isolate import __version__ as agent_version
|
|
30
|
+
except ImportError:
|
|
31
|
+
agent_version = "UNKNOWN"
|
|
32
|
+
|
|
21
33
|
from isolate.backends.common import sha256_digest_of
|
|
22
34
|
from isolate.connections.common import SerializationError, serialize_object
|
|
23
35
|
from isolate.connections.grpc import definitions
|
isolate/server/server.py
CHANGED
|
@@ -9,7 +9,6 @@ from concurrent import futures
|
|
|
9
9
|
from concurrent.futures import ThreadPoolExecutor
|
|
10
10
|
from contextlib import ExitStack, contextmanager
|
|
11
11
|
from dataclasses import dataclass, field, replace
|
|
12
|
-
from functools import partial
|
|
13
12
|
from queue import Empty as QueueEmpty
|
|
14
13
|
from queue import Queue
|
|
15
14
|
from typing import Any, Callable, Iterator, cast
|
|
@@ -26,6 +25,7 @@ from isolate.backends.local import LocalPythonEnvironment
|
|
|
26
25
|
from isolate.backends.virtualenv import VirtualPythonEnvironment
|
|
27
26
|
from isolate.connections.grpc import AgentError, LocalPythonGRPC
|
|
28
27
|
from isolate.connections.grpc.configuration import get_default_options
|
|
28
|
+
from isolate.logger import logger
|
|
29
29
|
from isolate.logs import Log, LogLevel, LogSource
|
|
30
30
|
from isolate.server import definitions, health
|
|
31
31
|
from isolate.server.health_server import HealthServicer
|
|
@@ -191,9 +191,10 @@ class IsolateServicer(definitions.IsolateServicer):
|
|
|
191
191
|
StatusCode.INVALID_ARGUMENT,
|
|
192
192
|
)
|
|
193
193
|
|
|
194
|
+
log_handler = LogHandler(messages)
|
|
194
195
|
run_settings = replace(
|
|
195
196
|
self.default_settings,
|
|
196
|
-
log_hook=
|
|
197
|
+
log_hook=log_handler.handle,
|
|
197
198
|
serialization_method=request.function.method,
|
|
198
199
|
)
|
|
199
200
|
|
|
@@ -390,14 +391,22 @@ def _proxy_to_queue(
|
|
|
390
391
|
queue.put_nowait(message)
|
|
391
392
|
|
|
392
393
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
394
|
+
@dataclass
|
|
395
|
+
class LogHandler:
|
|
396
|
+
messages: Queue
|
|
397
|
+
|
|
398
|
+
def handle(self, log: Log) -> None:
|
|
399
|
+
logger.log(log.level, log.message, source=log.source)
|
|
400
|
+
self._add_log_to_queue(log)
|
|
401
|
+
|
|
402
|
+
def _add_log_to_queue(self, log: Log) -> None:
|
|
403
|
+
grpc_log = cast(definitions.Log, to_grpc(log))
|
|
404
|
+
grpc_result = definitions.PartialRunResult(
|
|
405
|
+
is_complete=False,
|
|
406
|
+
logs=[grpc_log],
|
|
407
|
+
result=None,
|
|
408
|
+
)
|
|
409
|
+
self.messages.put_nowait(grpc_result)
|
|
401
410
|
|
|
402
411
|
|
|
403
412
|
def main() -> None:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
isolate/__init__.py,sha256=uXOKnONs7sXgARNgElwr4_A1sKoA6ACHVEvs3IDiX1M,127
|
|
2
|
-
isolate/_isolate_version.py,sha256=
|
|
2
|
+
isolate/_isolate_version.py,sha256=nyWjzUs9M1XFc5MLonkyorh4rhe5dHRCj707gnafzf4,413
|
|
3
3
|
isolate/_version.py,sha256=05pXvy-yr5t3I1m9JMn42Ilzpg7fa8IB2J8a3G7t1cU,274
|
|
4
4
|
isolate/logger.py,sha256=SehnK6rPx-HDqQHJ3sKWqhDGmD3fTDGBIkjnNQYnFJU,453
|
|
5
5
|
isolate/logs.py,sha256=R_AHUVYD18z_PhtK_mDWi9Gch79CxmwHY09hUDShtwg,2079
|
|
@@ -23,8 +23,8 @@ isolate/connections/_local/__init__.py,sha256=6FtCKRSFBvTvjm5LNlNA-mieKEq3J7DZZR
|
|
|
23
23
|
isolate/connections/_local/_base.py,sha256=YGf141VgXErrXYNyRN7sXcts2SemlFEEocZsKmLQfVM,6659
|
|
24
24
|
isolate/connections/_local/agent_startup.py,sha256=swCs6Q0yVkDw7w-RftizHSMyJDM7DQwuP3TB0qI1ucg,1552
|
|
25
25
|
isolate/connections/grpc/__init__.py,sha256=tcesLxlC36P6wSg2lBcO2egsJWMbSKwc8zFXhWac3YU,85
|
|
26
|
-
isolate/connections/grpc/_base.py,sha256=
|
|
27
|
-
isolate/connections/grpc/agent.py,sha256=
|
|
26
|
+
isolate/connections/grpc/_base.py,sha256=6cBlJRoKDoJFQudLgkEeUcGVxcIyaAzkB-Zec14hm8k,5639
|
|
27
|
+
isolate/connections/grpc/agent.py,sha256=fZF4-v8WN1qPzFp17UxOX_A3Jq8bXD8Wss-7eNgNoYg,8071
|
|
28
28
|
isolate/connections/grpc/configuration.py,sha256=50YvGGHA9uyKg74xU_gc73j7bsFk973uIpMhmw2HhxY,788
|
|
29
29
|
isolate/connections/grpc/interface.py,sha256=yt63kytgXRXrTnjePGJVdXz4LJJVSSrNkJCF1yz6FIE,2270
|
|
30
30
|
isolate/connections/grpc/definitions/__init__.py,sha256=Z0453Bbjoq-Oxm2Wfi9fae-BFf8YsZwmuh88strmvxo,459
|
|
@@ -42,7 +42,7 @@ isolate/connections/ipc/agent.py,sha256=hGlL4x78FhRvMZ4DkVh3dk-EmWQqxHW4LIipgyOk
|
|
|
42
42
|
isolate/server/__init__.py,sha256=7R3GuWmxuqe0q28rVqETJN9OCrP_-Svjv9h0NR1GFL0,79
|
|
43
43
|
isolate/server/health_server.py,sha256=yN7F1Q28DdX8-Zk3gef7XcQEE25XwlHwzV5GBM75aQM,1249
|
|
44
44
|
isolate/server/interface.py,sha256=nGbjdxrN0p9m1LNdeds8NIoJOwPYW2NM6ktmbhfG4_s,687
|
|
45
|
-
isolate/server/server.py,sha256=
|
|
45
|
+
isolate/server/server.py,sha256=rDTiZCGPTgJ5cdrgl6l6xaoV-0twBNm8PzZRsAdii5U,14883
|
|
46
46
|
isolate/server/definitions/__init__.py,sha256=f_Q3pdjMuZrjgNlbM60btFKiB1Vg8cnVyKEbp0RmU0A,572
|
|
47
47
|
isolate/server/definitions/server.proto,sha256=-Wv0LAexj2GXfR3TSyGEcd3qkKgpvvQHQBEp7y3f-9Y,1002
|
|
48
48
|
isolate/server/definitions/server_pb2.py,sha256=tOYlfoh2C5j1PGxAVBuKEtT5s-qeAK7iDaP9sIvOyqw,2293
|
|
@@ -53,9 +53,9 @@ isolate/server/health/health.proto,sha256=wE2_QD0OQAblKkEBG7sALLXEOj1mOLKG-FbC4t
|
|
|
53
53
|
isolate/server/health/health_pb2.py,sha256=onOdP3M4Tpqhqs2PlGcyfoKe2VVKUEDx5ALeRcObb9A,1899
|
|
54
54
|
isolate/server/health/health_pb2.pyi,sha256=CPyvxvDzra-1d-mBsukaJnscMUDBaqSACvo9LiXlFzo,2416
|
|
55
55
|
isolate/server/health/health_pb2_grpc.py,sha256=XgsULrnRBmYIqvKr8eI7bqs6NIea5A0kkqdOOc2JHBY,5303
|
|
56
|
-
isolate-0.13.
|
|
57
|
-
isolate-0.13.
|
|
58
|
-
isolate-0.13.
|
|
59
|
-
isolate-0.13.
|
|
60
|
-
isolate-0.13.
|
|
61
|
-
isolate-0.13.
|
|
56
|
+
isolate-0.13.5.dist-info/LICENSE,sha256=427vuyirL5scgBLqA9UWcdnxKrtSGc0u_JfUupk6lAA,11359
|
|
57
|
+
isolate-0.13.5.dist-info/METADATA,sha256=4HUFRzvXN8INQYJHZbOk8Ry8xrrIyOmcrfiWhoW4itE,3209
|
|
58
|
+
isolate-0.13.5.dist-info/WHEEL,sha256=cpQTJ5IWu9CdaPViMhC9YzF8gZuS5-vlfoFihTBC86A,91
|
|
59
|
+
isolate-0.13.5.dist-info/entry_points.txt,sha256=s3prh2EERaVCbL8R45tfY5WFPZ1TsYOsz305YR7s-Pc,360
|
|
60
|
+
isolate-0.13.5.dist-info/top_level.txt,sha256=W9QJBHcq5WXRkbOXf25bvftzFsOZZN4n1DAatdroZrs,8
|
|
61
|
+
isolate-0.13.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|