isolate 0.12.16__py3-none-any.whl → 0.13.1__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 +3 -2
- isolate/connections/grpc/agent.py +3 -1
- isolate/connections/grpc/definitions/agent_pb2.py +11 -12
- isolate/connections/grpc/definitions/agent_pb2.pyi +8 -32
- isolate/connections/grpc/definitions/agent_pb2_grpc.py +54 -28
- isolate/connections/grpc/definitions/common_pb2.py +18 -21
- isolate/connections/grpc/definitions/common_pb2.pyi +17 -84
- isolate/connections/grpc/definitions/common_pb2_grpc.py +26 -0
- isolate/logger.py +17 -0
- isolate/server/definitions/server.proto +12 -0
- isolate/server/definitions/server_pb2.py +19 -17
- isolate/server/definitions/server_pb2.pyi +44 -52
- isolate/server/definitions/server_pb2_grpc.py +95 -28
- isolate/server/health/health_pb2.py +16 -16
- isolate/server/health/health_pb2.pyi +6 -14
- isolate/server/health/health_pb2_grpc.py +74 -53
- isolate/server/server.py +62 -26
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/METADATA +3 -2
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/RECORD +24 -23
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/LICENSE +0 -0
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/WHEEL +0 -0
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/entry_points.txt +0 -0
- {isolate-0.12.16.dist-info → isolate-0.13.1.dist-info}/top_level.txt +0 -0
isolate/_isolate_version.py
CHANGED
|
@@ -16,6 +16,7 @@ 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
|
|
19
20
|
from isolate.logs import LogLevel, LogSource
|
|
20
21
|
|
|
21
22
|
|
|
@@ -36,7 +37,7 @@ class GRPCExecutionBase(EnvironmentConnection):
|
|
|
36
37
|
def _establish_bridge(
|
|
37
38
|
self,
|
|
38
39
|
*,
|
|
39
|
-
max_wait_timeout: float =
|
|
40
|
+
max_wait_timeout: float = 20.0,
|
|
40
41
|
) -> Iterator[definitions.AgentStub]:
|
|
41
42
|
with self.start_agent() as (address, credentials):
|
|
42
43
|
with grpc.secure_channel(
|
|
@@ -148,5 +149,5 @@ class LocalPythonGRPC(PythonExecutionBase[str], GRPCExecutionBase):
|
|
|
148
149
|
]
|
|
149
150
|
|
|
150
151
|
def handle_agent_log(self, line: str, level: LogLevel, source: LogSource) -> None:
|
|
151
|
-
|
|
152
|
+
logger.log(level, line, source)
|
|
152
153
|
self.log(line, level=level, source=source)
|
|
@@ -22,6 +22,8 @@ from isolate.connections.common import SerializationError, serialize_object
|
|
|
22
22
|
from isolate.connections.grpc import definitions
|
|
23
23
|
from isolate.connections.grpc.configuration import get_default_options
|
|
24
24
|
from isolate.connections.grpc.interface import from_grpc
|
|
25
|
+
from isolate.logger import logger
|
|
26
|
+
from isolate.logs import LogLevel, LogSource
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
@dataclass
|
|
@@ -149,7 +151,7 @@ class AgentServicer(definitions.AgentServicer):
|
|
|
149
151
|
definition = serialize_object(serialization_method, result)
|
|
150
152
|
except SerializationError:
|
|
151
153
|
if stringized_tb:
|
|
152
|
-
|
|
154
|
+
logger.log(LogLevel.ERROR, stringized_tb, LogSource.BRIDGE)
|
|
153
155
|
raise AbortException(
|
|
154
156
|
"Error while serializing the execution result "
|
|
155
157
|
f"(object of type {type(result)})."
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# source: agent.proto
|
|
4
|
+
# Protobuf Python Version: 5.26.1
|
|
4
5
|
"""Generated protocol buffer code."""
|
|
5
6
|
from google.protobuf import descriptor as _descriptor
|
|
6
7
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
8
|
from google.protobuf import symbol_database as _symbol_database
|
|
8
9
|
from google.protobuf.internal import builder as _builder
|
|
9
|
-
|
|
10
10
|
# @@protoc_insertion_point(imports)
|
|
11
11
|
|
|
12
12
|
_sym_db = _symbol_database.Default()
|
|
@@ -14,17 +14,16 @@ _sym_db = _symbol_database.Default()
|
|
|
14
14
|
|
|
15
15
|
from isolate.connections.grpc.definitions import common_pb2 as common__pb2
|
|
16
16
|
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
18
|
-
b'\n\x0b\x61gent.proto\x1a\x0c\x63ommon.proto"n\n\x0c\x46unctionCall\x12#\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x02 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\r\n\x0b_setup_func24\n\x05\x41gent\x12+\n\x03Run\x12\r.FunctionCall\x1a\x11.PartialRunResult"\x00\x30\x01\x62\x06proto3'
|
|
19
|
-
)
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "agent_pb2", globals())
|
|
23
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61gent.proto\x1a\x0c\x63ommon.proto\"n\n\x0c\x46unctionCall\x12#\n\x08\x66unction\x18\x01 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x02 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\r\n\x0b_setup_func24\n\x05\x41gent\x12+\n\x03Run\x12\r.FunctionCall\x1a\x11.PartialRunResult\"\x00\x30\x01\x62\x06proto3')
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
_globals = globals()
|
|
21
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'agent_pb2', _globals)
|
|
23
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
24
|
+
DESCRIPTOR._loaded_options = None
|
|
25
|
+
_globals['_FUNCTIONCALL']._serialized_start=29
|
|
26
|
+
_globals['_FUNCTIONCALL']._serialized_end=139
|
|
27
|
+
_globals['_AGENT']._serialized_start=141
|
|
28
|
+
_globals['_AGENT']._serialized_end=193
|
|
30
29
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -2,20 +2,16 @@
|
|
|
2
2
|
@generated by mypy-protobuf. Do not edit manually!
|
|
3
3
|
isort:skip_file
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import builtins
|
|
6
7
|
from isolate.connections.grpc.definitions import common_pb2
|
|
7
8
|
import google.protobuf.descriptor
|
|
8
9
|
import google.protobuf.message
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
if sys.version_info >= (3, 8):
|
|
12
|
-
import typing as typing_extensions
|
|
13
|
-
else:
|
|
14
|
-
import typing_extensions
|
|
10
|
+
import typing
|
|
15
11
|
|
|
16
12
|
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
|
|
17
13
|
|
|
18
|
-
@
|
|
14
|
+
@typing.final
|
|
19
15
|
class FunctionCall(google.protobuf.message.Message):
|
|
20
16
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
21
17
|
|
|
@@ -24,6 +20,7 @@ class FunctionCall(google.protobuf.message.Message):
|
|
|
24
20
|
@property
|
|
25
21
|
def function(self) -> common_pb2.SerializedObject:
|
|
26
22
|
"""The function to execute and return the results to."""
|
|
23
|
+
|
|
27
24
|
@property
|
|
28
25
|
def setup_func(self) -> common_pb2.SerializedObject:
|
|
29
26
|
"""Optionally the setup function which will be passed
|
|
@@ -31,36 +28,15 @@ class FunctionCall(google.protobuf.message.Message):
|
|
|
31
28
|
has to be an idempotent step since the result for
|
|
32
29
|
this executable will be cached.
|
|
33
30
|
"""
|
|
31
|
+
|
|
34
32
|
def __init__(
|
|
35
33
|
self,
|
|
36
34
|
*,
|
|
37
35
|
function: common_pb2.SerializedObject | None = ...,
|
|
38
36
|
setup_func: common_pb2.SerializedObject | None = ...,
|
|
39
37
|
) -> None: ...
|
|
40
|
-
def HasField(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"_setup_func",
|
|
44
|
-
b"_setup_func",
|
|
45
|
-
"function",
|
|
46
|
-
b"function",
|
|
47
|
-
"setup_func",
|
|
48
|
-
b"setup_func",
|
|
49
|
-
],
|
|
50
|
-
) -> builtins.bool: ...
|
|
51
|
-
def ClearField(
|
|
52
|
-
self,
|
|
53
|
-
field_name: typing_extensions.Literal[
|
|
54
|
-
"_setup_func",
|
|
55
|
-
b"_setup_func",
|
|
56
|
-
"function",
|
|
57
|
-
b"function",
|
|
58
|
-
"setup_func",
|
|
59
|
-
b"setup_func",
|
|
60
|
-
],
|
|
61
|
-
) -> None: ...
|
|
62
|
-
def WhichOneof(
|
|
63
|
-
self, oneof_group: typing_extensions.Literal["_setup_func", b"_setup_func"]
|
|
64
|
-
) -> typing_extensions.Literal["setup_func"] | None: ...
|
|
38
|
+
def HasField(self, field_name: typing.Literal["_setup_func", b"_setup_func", "function", b"function", "setup_func", b"setup_func"]) -> builtins.bool: ...
|
|
39
|
+
def ClearField(self, field_name: typing.Literal["_setup_func", b"_setup_func", "function", b"function", "setup_func", b"setup_func"]) -> None: ...
|
|
40
|
+
def WhichOneof(self, oneof_group: typing.Literal["_setup_func", b"_setup_func"]) -> typing.Literal["setup_func"] | None: ...
|
|
65
41
|
|
|
66
42
|
global___FunctionCall = FunctionCall
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
3
|
import grpc
|
|
4
|
+
import warnings
|
|
4
5
|
|
|
5
6
|
from isolate.connections.grpc.definitions import agent_pb2 as agent__pb2
|
|
6
7
|
from isolate.connections.grpc.definitions import common_pb2 as common__pb2
|
|
7
8
|
|
|
9
|
+
GRPC_GENERATED_VERSION = '1.64.0'
|
|
10
|
+
GRPC_VERSION = grpc.__version__
|
|
11
|
+
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
12
|
+
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
13
|
+
_version_not_supported = False
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
from grpc._utilities import first_version_is_lower
|
|
17
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
18
|
+
except ImportError:
|
|
19
|
+
_version_not_supported = True
|
|
20
|
+
|
|
21
|
+
if _version_not_supported:
|
|
22
|
+
warnings.warn(
|
|
23
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
24
|
+
+ f' but the generated code in agent_pb2_grpc.py depends on'
|
|
25
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
26
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
27
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
28
|
+
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
29
|
+
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
30
|
+
RuntimeWarning
|
|
31
|
+
)
|
|
32
|
+
|
|
8
33
|
|
|
9
34
|
class AgentStub(object):
|
|
10
35
|
"""Missing associated documentation comment in .proto file."""
|
|
@@ -16,55 +41,56 @@ class AgentStub(object):
|
|
|
16
41
|
channel: A grpc.Channel.
|
|
17
42
|
"""
|
|
18
43
|
self.Run = channel.unary_stream(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
'/Agent/Run',
|
|
45
|
+
request_serializer=agent__pb2.FunctionCall.SerializeToString,
|
|
46
|
+
response_deserializer=common__pb2.PartialRunResult.FromString,
|
|
47
|
+
_registered_method=True)
|
|
23
48
|
|
|
24
49
|
|
|
25
50
|
class AgentServicer(object):
|
|
26
51
|
"""Missing associated documentation comment in .proto file."""
|
|
27
52
|
|
|
28
53
|
def Run(self, request, context):
|
|
29
|
-
"""Start running the given function, and stream results back.
|
|
54
|
+
"""Start running the given function, and stream results back.
|
|
55
|
+
"""
|
|
30
56
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
31
|
-
context.set_details(
|
|
32
|
-
raise NotImplementedError(
|
|
57
|
+
context.set_details('Method not implemented!')
|
|
58
|
+
raise NotImplementedError('Method not implemented!')
|
|
33
59
|
|
|
34
60
|
|
|
35
61
|
def add_AgentServicer_to_server(servicer, server):
|
|
36
62
|
rpc_method_handlers = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
'Run': grpc.unary_stream_rpc_method_handler(
|
|
64
|
+
servicer.Run,
|
|
65
|
+
request_deserializer=agent__pb2.FunctionCall.FromString,
|
|
66
|
+
response_serializer=common__pb2.PartialRunResult.SerializeToString,
|
|
67
|
+
),
|
|
42
68
|
}
|
|
43
|
-
generic_handler = grpc.method_handlers_generic_handler(
|
|
69
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
70
|
+
'Agent', rpc_method_handlers)
|
|
44
71
|
server.add_generic_rpc_handlers((generic_handler,))
|
|
72
|
+
server.add_registered_method_handlers('Agent', rpc_method_handlers)
|
|
45
73
|
|
|
46
74
|
|
|
47
|
-
# This class is part of an EXPERIMENTAL API.
|
|
75
|
+
# This class is part of an EXPERIMENTAL API.
|
|
48
76
|
class Agent(object):
|
|
49
77
|
"""Missing associated documentation comment in .proto file."""
|
|
50
78
|
|
|
51
79
|
@staticmethod
|
|
52
|
-
def Run(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
metadata=None,
|
|
63
|
-
):
|
|
80
|
+
def Run(request,
|
|
81
|
+
target,
|
|
82
|
+
options=(),
|
|
83
|
+
channel_credentials=None,
|
|
84
|
+
call_credentials=None,
|
|
85
|
+
insecure=False,
|
|
86
|
+
compression=None,
|
|
87
|
+
wait_for_ready=None,
|
|
88
|
+
timeout=None,
|
|
89
|
+
metadata=None):
|
|
64
90
|
return grpc.experimental.unary_stream(
|
|
65
91
|
request,
|
|
66
92
|
target,
|
|
67
|
-
|
|
93
|
+
'/Agent/Run',
|
|
68
94
|
agent__pb2.FunctionCall.SerializeToString,
|
|
69
95
|
common__pb2.PartialRunResult.FromString,
|
|
70
96
|
options,
|
|
@@ -75,4 +101,4 @@ class Agent(object):
|
|
|
75
101
|
wait_for_ready,
|
|
76
102
|
timeout,
|
|
77
103
|
metadata,
|
|
78
|
-
|
|
104
|
+
_registered_method=True)
|
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# source: common.proto
|
|
4
|
+
# Protobuf Python Version: 5.26.1
|
|
4
5
|
"""Generated protocol buffer code."""
|
|
5
6
|
from google.protobuf import descriptor as _descriptor
|
|
6
7
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
8
|
from google.protobuf import symbol_database as _symbol_database
|
|
8
9
|
from google.protobuf.internal import builder as _builder
|
|
9
|
-
|
|
10
10
|
# @@protoc_insertion_point(imports)
|
|
11
11
|
|
|
12
12
|
_sym_db = _symbol_database.Default()
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
from google.protobuf import
|
|
16
|
-
timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2,
|
|
17
|
-
)
|
|
15
|
+
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
18
16
|
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
20
|
-
b'\n\x0c\x63ommon.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x89\x01\n\x10SerializedObject\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x12\n\ndefinition\x18\x02 \x01(\x0c\x12\x15\n\rwas_it_raised\x18\x03 \x01(\x08\x12!\n\x14stringized_traceback\x18\x04 \x01(\tH\x00\x88\x01\x01\x42\x17\n\x15_stringized_traceback"n\n\x10PartialRunResult\x12\x13\n\x0bis_complete\x18\x01 \x01(\x08\x12\x12\n\x04logs\x18\x02 \x03(\x0b\x32\x04.Log\x12&\n\x06result\x18\x03 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\t\n\x07_result"{\n\x03Log\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x1a\n\x06source\x18\x02 \x01(\x0e\x32\n.LogSource\x12\x18\n\x05level\x18\x03 \x01(\x0e\x32\t.LogLevel\x12-\n\ttimestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*.\n\tLogSource\x12\x0b\n\x07\x42UILDER\x10\x00\x12\n\n\x06\x42RIDGE\x10\x01\x12\x08\n\x04USER\x10\x02*Z\n\x08LogLevel\x12\t\n\x05TRACE\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\x0b\n\x07WARNING\x10\x03\x12\t\n\x05\x45RROR\x10\x04\x12\n\n\x06STDOUT\x10\x05\x12\n\n\x06STDERR\x10\x06\x62\x06proto3'
|
|
21
|
-
)
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "common_pb2", globals())
|
|
25
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63ommon.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x89\x01\n\x10SerializedObject\x12\x0e\n\x06method\x18\x01 \x01(\t\x12\x12\n\ndefinition\x18\x02 \x01(\x0c\x12\x15\n\rwas_it_raised\x18\x03 \x01(\x08\x12!\n\x14stringized_traceback\x18\x04 \x01(\tH\x00\x88\x01\x01\x42\x17\n\x15_stringized_traceback\"n\n\x10PartialRunResult\x12\x13\n\x0bis_complete\x18\x01 \x01(\x08\x12\x12\n\x04logs\x18\x02 \x03(\x0b\x32\x04.Log\x12&\n\x06result\x18\x03 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\t\n\x07_result\"{\n\x03Log\x12\x0f\n\x07message\x18\x01 \x01(\t\x12\x1a\n\x06source\x18\x02 \x01(\x0e\x32\n.LogSource\x12\x18\n\x05level\x18\x03 \x01(\x0e\x32\t.LogLevel\x12-\n\ttimestamp\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*.\n\tLogSource\x12\x0b\n\x07\x42UILDER\x10\x00\x12\n\n\x06\x42RIDGE\x10\x01\x12\x08\n\x04USER\x10\x02*Z\n\x08LogLevel\x12\t\n\x05TRACE\x10\x00\x12\t\n\x05\x44\x45\x42UG\x10\x01\x12\x08\n\x04INFO\x10\x02\x12\x0b\n\x07WARNING\x10\x03\x12\t\n\x05\x45RROR\x10\x04\x12\n\n\x06STDOUT\x10\x05\x12\n\n\x06STDERR\x10\x06\x62\x06proto3')
|
|
26
19
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
_globals = globals()
|
|
21
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
22
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'common_pb2', _globals)
|
|
23
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
24
|
+
DESCRIPTOR._loaded_options = None
|
|
25
|
+
_globals['_LOGSOURCE']._serialized_start=426
|
|
26
|
+
_globals['_LOGSOURCE']._serialized_end=472
|
|
27
|
+
_globals['_LOGLEVEL']._serialized_start=474
|
|
28
|
+
_globals['_LOGLEVEL']._serialized_end=564
|
|
29
|
+
_globals['_SERIALIZEDOBJECT']._serialized_start=50
|
|
30
|
+
_globals['_SERIALIZEDOBJECT']._serialized_end=187
|
|
31
|
+
_globals['_PARTIALRUNRESULT']._serialized_start=189
|
|
32
|
+
_globals['_PARTIALRUNRESULT']._serialized_end=299
|
|
33
|
+
_globals['_LOG']._serialized_start=301
|
|
34
|
+
_globals['_LOG']._serialized_end=424
|
|
38
35
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@generated by mypy-protobuf. Do not edit manually!
|
|
3
3
|
isort:skip_file
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import builtins
|
|
6
7
|
import collections.abc
|
|
7
8
|
import google.protobuf.descriptor
|
|
@@ -23,10 +24,7 @@ class _LogSource:
|
|
|
23
24
|
ValueType = typing.NewType("ValueType", builtins.int)
|
|
24
25
|
V: typing_extensions.TypeAlias = ValueType
|
|
25
26
|
|
|
26
|
-
class _LogSourceEnumTypeWrapper(
|
|
27
|
-
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogSource.ValueType],
|
|
28
|
-
builtins.type,
|
|
29
|
-
):
|
|
27
|
+
class _LogSourceEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogSource.ValueType], builtins.type):
|
|
30
28
|
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
|
31
29
|
BUILDER: _LogSource.ValueType # 0
|
|
32
30
|
BRIDGE: _LogSource.ValueType # 1
|
|
@@ -43,10 +41,7 @@ class _LogLevel:
|
|
|
43
41
|
ValueType = typing.NewType("ValueType", builtins.int)
|
|
44
42
|
V: typing_extensions.TypeAlias = ValueType
|
|
45
43
|
|
|
46
|
-
class _LogLevelEnumTypeWrapper(
|
|
47
|
-
google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogLevel.ValueType],
|
|
48
|
-
builtins.type,
|
|
49
|
-
):
|
|
44
|
+
class _LogLevelEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_LogLevel.ValueType], builtins.type):
|
|
50
45
|
DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
|
|
51
46
|
TRACE: _LogLevel.ValueType # 0
|
|
52
47
|
DEBUG: _LogLevel.ValueType # 1
|
|
@@ -67,7 +62,7 @@ STDOUT: LogLevel.ValueType # 5
|
|
|
67
62
|
STDERR: LogLevel.ValueType # 6
|
|
68
63
|
global___LogLevel = LogLevel
|
|
69
64
|
|
|
70
|
-
@
|
|
65
|
+
@typing.final
|
|
71
66
|
class SerializedObject(google.protobuf.message.Message):
|
|
72
67
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
73
68
|
|
|
@@ -95,40 +90,13 @@ class SerializedObject(google.protobuf.message.Message):
|
|
|
95
90
|
was_it_raised: builtins.bool = ...,
|
|
96
91
|
stringized_traceback: builtins.str | None = ...,
|
|
97
92
|
) -> None: ...
|
|
98
|
-
def HasField(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
"_stringized_traceback",
|
|
102
|
-
b"_stringized_traceback",
|
|
103
|
-
"stringized_traceback",
|
|
104
|
-
b"stringized_traceback",
|
|
105
|
-
],
|
|
106
|
-
) -> builtins.bool: ...
|
|
107
|
-
def ClearField(
|
|
108
|
-
self,
|
|
109
|
-
field_name: typing_extensions.Literal[
|
|
110
|
-
"_stringized_traceback",
|
|
111
|
-
b"_stringized_traceback",
|
|
112
|
-
"definition",
|
|
113
|
-
b"definition",
|
|
114
|
-
"method",
|
|
115
|
-
b"method",
|
|
116
|
-
"stringized_traceback",
|
|
117
|
-
b"stringized_traceback",
|
|
118
|
-
"was_it_raised",
|
|
119
|
-
b"was_it_raised",
|
|
120
|
-
],
|
|
121
|
-
) -> None: ...
|
|
122
|
-
def WhichOneof(
|
|
123
|
-
self,
|
|
124
|
-
oneof_group: typing_extensions.Literal[
|
|
125
|
-
"_stringized_traceback", b"_stringized_traceback"
|
|
126
|
-
],
|
|
127
|
-
) -> typing_extensions.Literal["stringized_traceback"] | None: ...
|
|
93
|
+
def HasField(self, field_name: typing.Literal["_stringized_traceback", b"_stringized_traceback", "stringized_traceback", b"stringized_traceback"]) -> builtins.bool: ...
|
|
94
|
+
def ClearField(self, field_name: typing.Literal["_stringized_traceback", b"_stringized_traceback", "definition", b"definition", "method", b"method", "stringized_traceback", b"stringized_traceback", "was_it_raised", b"was_it_raised"]) -> None: ...
|
|
95
|
+
def WhichOneof(self, oneof_group: typing.Literal["_stringized_traceback", b"_stringized_traceback"]) -> typing.Literal["stringized_traceback"] | None: ...
|
|
128
96
|
|
|
129
97
|
global___SerializedObject = SerializedObject
|
|
130
98
|
|
|
131
|
-
@
|
|
99
|
+
@typing.final
|
|
132
100
|
class PartialRunResult(google.protobuf.message.Message):
|
|
133
101
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
134
102
|
|
|
@@ -138,17 +106,15 @@ class PartialRunResult(google.protobuf.message.Message):
|
|
|
138
106
|
is_complete: builtins.bool
|
|
139
107
|
"""A flag indicating whether the run has completed."""
|
|
140
108
|
@property
|
|
141
|
-
def logs(
|
|
142
|
-
self,
|
|
143
|
-
) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[
|
|
144
|
-
global___Log
|
|
145
|
-
]:
|
|
109
|
+
def logs(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Log]:
|
|
146
110
|
"""A list of logs collected during this partial execution. It does
|
|
147
111
|
not include old logs.
|
|
148
112
|
"""
|
|
113
|
+
|
|
149
114
|
@property
|
|
150
115
|
def result(self) -> global___SerializedObject:
|
|
151
116
|
"""The result of the run, if it is complete."""
|
|
117
|
+
|
|
152
118
|
def __init__(
|
|
153
119
|
self,
|
|
154
120
|
*,
|
|
@@ -156,32 +122,13 @@ class PartialRunResult(google.protobuf.message.Message):
|
|
|
156
122
|
logs: collections.abc.Iterable[global___Log] | None = ...,
|
|
157
123
|
result: global___SerializedObject | None = ...,
|
|
158
124
|
) -> None: ...
|
|
159
|
-
def HasField(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"_result", b"_result", "result", b"result"
|
|
163
|
-
],
|
|
164
|
-
) -> builtins.bool: ...
|
|
165
|
-
def ClearField(
|
|
166
|
-
self,
|
|
167
|
-
field_name: typing_extensions.Literal[
|
|
168
|
-
"_result",
|
|
169
|
-
b"_result",
|
|
170
|
-
"is_complete",
|
|
171
|
-
b"is_complete",
|
|
172
|
-
"logs",
|
|
173
|
-
b"logs",
|
|
174
|
-
"result",
|
|
175
|
-
b"result",
|
|
176
|
-
],
|
|
177
|
-
) -> None: ...
|
|
178
|
-
def WhichOneof(
|
|
179
|
-
self, oneof_group: typing_extensions.Literal["_result", b"_result"]
|
|
180
|
-
) -> typing_extensions.Literal["result"] | None: ...
|
|
125
|
+
def HasField(self, field_name: typing.Literal["_result", b"_result", "result", b"result"]) -> builtins.bool: ...
|
|
126
|
+
def ClearField(self, field_name: typing.Literal["_result", b"_result", "is_complete", b"is_complete", "logs", b"logs", "result", b"result"]) -> None: ...
|
|
127
|
+
def WhichOneof(self, oneof_group: typing.Literal["_result", b"_result"]) -> typing.Literal["result"] | None: ...
|
|
181
128
|
|
|
182
129
|
global___PartialRunResult = PartialRunResult
|
|
183
130
|
|
|
184
|
-
@
|
|
131
|
+
@typing.final
|
|
185
132
|
class Log(google.protobuf.message.Message):
|
|
186
133
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
|
187
134
|
|
|
@@ -202,21 +149,7 @@ class Log(google.protobuf.message.Message):
|
|
|
202
149
|
level: global___LogLevel.ValueType = ...,
|
|
203
150
|
timestamp: google.protobuf.timestamp_pb2.Timestamp | None = ...,
|
|
204
151
|
) -> None: ...
|
|
205
|
-
def HasField(
|
|
206
|
-
|
|
207
|
-
) -> builtins.bool: ...
|
|
208
|
-
def ClearField(
|
|
209
|
-
self,
|
|
210
|
-
field_name: typing_extensions.Literal[
|
|
211
|
-
"level",
|
|
212
|
-
b"level",
|
|
213
|
-
"message",
|
|
214
|
-
b"message",
|
|
215
|
-
"source",
|
|
216
|
-
b"source",
|
|
217
|
-
"timestamp",
|
|
218
|
-
b"timestamp",
|
|
219
|
-
],
|
|
220
|
-
) -> None: ...
|
|
152
|
+
def HasField(self, field_name: typing.Literal["timestamp", b"timestamp"]) -> builtins.bool: ...
|
|
153
|
+
def ClearField(self, field_name: typing.Literal["level", b"level", "message", b"message", "source", b"source", "timestamp", b"timestamp"]) -> None: ...
|
|
221
154
|
|
|
222
155
|
global___Log = Log
|
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
2
|
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
3
|
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
GRPC_GENERATED_VERSION = '1.64.0'
|
|
8
|
+
GRPC_VERSION = grpc.__version__
|
|
9
|
+
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
10
|
+
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
11
|
+
_version_not_supported = False
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
from grpc._utilities import first_version_is_lower
|
|
15
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
16
|
+
except ImportError:
|
|
17
|
+
_version_not_supported = True
|
|
18
|
+
|
|
19
|
+
if _version_not_supported:
|
|
20
|
+
warnings.warn(
|
|
21
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
22
|
+
+ f' but the generated code in common_pb2_grpc.py depends on'
|
|
23
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
24
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
25
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
26
|
+
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
27
|
+
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
28
|
+
RuntimeWarning
|
|
29
|
+
)
|
isolate/logger.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import json
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# NOTE: we probably should've created a proper `logging.getLogger` here,
|
|
5
|
+
# but it handling `source` would be not trivial, so we are better off
|
|
6
|
+
# just keeping it simple for now.
|
|
7
|
+
class IsolateLogger:
|
|
8
|
+
def log(self, level, message, source):
|
|
9
|
+
record = {
|
|
10
|
+
"isolate_source": source.name,
|
|
11
|
+
"level": level.name,
|
|
12
|
+
"message": message,
|
|
13
|
+
}
|
|
14
|
+
print(json.dumps(record))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
logger = IsolateLogger()
|
|
@@ -7,6 +7,9 @@ service Isolate {
|
|
|
7
7
|
// Run the given function on the specified environment. Streams logs
|
|
8
8
|
// and the result originating from that function.
|
|
9
9
|
rpc Run (BoundFunction) returns (stream PartialRunResult) {}
|
|
10
|
+
|
|
11
|
+
// Submit a function to be run without waiting for results.
|
|
12
|
+
rpc Submit (SubmitRequest) returns (SubmitResponse) {}
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
message BoundFunction {
|
|
@@ -23,3 +26,12 @@ message EnvironmentDefinition {
|
|
|
23
26
|
// Whether to force-create this environment or not.
|
|
24
27
|
bool force = 3;
|
|
25
28
|
}
|
|
29
|
+
|
|
30
|
+
message SubmitRequest {
|
|
31
|
+
// The function to run.
|
|
32
|
+
BoundFunction function = 1;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
message SubmitResponse {
|
|
36
|
+
// Reserved for future use.
|
|
37
|
+
}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
# -*- coding: utf-8 -*-
|
|
2
2
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
3
|
# source: server.proto
|
|
4
|
+
# Protobuf Python Version: 5.26.1
|
|
4
5
|
"""Generated protocol buffer code."""
|
|
5
6
|
from google.protobuf import descriptor as _descriptor
|
|
6
7
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
7
8
|
from google.protobuf import symbol_database as _symbol_database
|
|
8
9
|
from google.protobuf.internal import builder as _builder
|
|
9
|
-
|
|
10
10
|
# @@protoc_insertion_point(imports)
|
|
11
11
|
|
|
12
12
|
_sym_db = _symbol_database.Default()
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
16
|
-
|
|
17
15
|
from isolate.connections.grpc.definitions import common_pb2 as common__pb2
|
|
16
|
+
from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
|
|
18
17
|
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
|
|
20
|
-
b'\n\x0cserver.proto\x1a\x0c\x63ommon.proto\x1a\x1cgoogle/protobuf/struct.proto"\x9d\x01\n\rBoundFunction\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12#\n\x08\x66unction\x18\x02 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x03 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\r\n\x0b_setup_func"d\n\x15\x45nvironmentDefinition\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12.\n\rconfiguration\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\x32\x37\n\x07Isolate\x12,\n\x03Run\x12\x0e.BoundFunction\x1a\x11.PartialRunResult"\x00\x30\x01\x62\x06proto3'
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
|
24
|
-
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "server_pb2", globals())
|
|
25
|
-
if _descriptor._USE_C_DESCRIPTORS == False:
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cserver.proto\x1a\x0c\x63ommon.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x9d\x01\n\rBoundFunction\x12,\n\x0c\x65nvironments\x18\x01 \x03(\x0b\x32\x16.EnvironmentDefinition\x12#\n\x08\x66unction\x18\x02 \x01(\x0b\x32\x11.SerializedObject\x12*\n\nsetup_func\x18\x03 \x01(\x0b\x32\x11.SerializedObjectH\x00\x88\x01\x01\x42\r\n\x0b_setup_func\"d\n\x15\x45nvironmentDefinition\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12.\n\rconfiguration\x18\x02 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\r\n\x05\x66orce\x18\x03 \x01(\x08\"1\n\rSubmitRequest\x12 \n\x08\x66unction\x18\x01 \x01(\x0b\x32\x0e.BoundFunction\"\x10\n\x0eSubmitResponse2d\n\x07Isolate\x12,\n\x03Run\x12\x0e.BoundFunction\x1a\x11.PartialRunResult\"\x00\x30\x01\x12+\n\x06Submit\x12\x0e.SubmitRequest\x1a\x0f.SubmitResponse\"\x00\x62\x06proto3')
|
|
20
|
+
|
|
21
|
+
_globals = globals()
|
|
22
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
23
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals)
|
|
24
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
25
|
+
DESCRIPTOR._loaded_options = None
|
|
26
|
+
_globals['_BOUNDFUNCTION']._serialized_start=61
|
|
27
|
+
_globals['_BOUNDFUNCTION']._serialized_end=218
|
|
28
|
+
_globals['_ENVIRONMENTDEFINITION']._serialized_start=220
|
|
29
|
+
_globals['_ENVIRONMENTDEFINITION']._serialized_end=320
|
|
30
|
+
_globals['_SUBMITREQUEST']._serialized_start=322
|
|
31
|
+
_globals['_SUBMITREQUEST']._serialized_end=371
|
|
32
|
+
_globals['_SUBMITRESPONSE']._serialized_start=373
|
|
33
|
+
_globals['_SUBMITRESPONSE']._serialized_end=389
|
|
34
|
+
_globals['_ISOLATE']._serialized_start=391
|
|
35
|
+
_globals['_ISOLATE']._serialized_end=491
|
|
34
36
|
# @@protoc_insertion_point(module_scope)
|