isolate 0.12.16__tar.gz → 0.13.1__tar.gz

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.

Files changed (93) hide show
  1. {isolate-0.12.16 → isolate-0.13.1}/PKG-INFO +3 -2
  2. {isolate-0.12.16 → isolate-0.13.1}/pyproject.toml +4 -1
  3. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/_isolate_version.py +2 -2
  4. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/_base.py +3 -2
  5. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/agent.py +3 -1
  6. isolate-0.13.1/src/isolate/connections/grpc/definitions/agent_pb2.py +29 -0
  7. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/definitions/agent_pb2.pyi +8 -32
  8. isolate-0.13.1/src/isolate/connections/grpc/definitions/agent_pb2_grpc.py +104 -0
  9. isolate-0.13.1/src/isolate/connections/grpc/definitions/common_pb2.py +35 -0
  10. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/definitions/common_pb2.pyi +17 -84
  11. isolate-0.13.1/src/isolate/connections/grpc/definitions/common_pb2_grpc.py +29 -0
  12. isolate-0.13.1/src/isolate/logger.py +17 -0
  13. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/definitions/server.proto +12 -0
  14. isolate-0.13.1/src/isolate/server/definitions/server_pb2.py +36 -0
  15. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/definitions/server_pb2.pyi +44 -52
  16. isolate-0.13.1/src/isolate/server/definitions/server_pb2_grpc.py +149 -0
  17. isolate-0.13.1/src/isolate/server/health/health_pb2.py +32 -0
  18. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/health/health_pb2.pyi +6 -14
  19. isolate-0.13.1/src/isolate/server/health/health_pb2_grpc.py +145 -0
  20. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/server.py +62 -26
  21. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/PKG-INFO +3 -2
  22. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/SOURCES.txt +1 -0
  23. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/requires.txt +2 -1
  24. {isolate-0.12.16 → isolate-0.13.1}/tests/test_server.py +47 -7
  25. {isolate-0.12.16 → isolate-0.13.1}/tools/regen_grpc.py +12 -2
  26. isolate-0.12.16/src/isolate/connections/grpc/definitions/agent_pb2.py +0 -30
  27. isolate-0.12.16/src/isolate/connections/grpc/definitions/agent_pb2_grpc.py +0 -78
  28. isolate-0.12.16/src/isolate/connections/grpc/definitions/common_pb2.py +0 -38
  29. isolate-0.12.16/src/isolate/connections/grpc/definitions/common_pb2_grpc.py +0 -3
  30. isolate-0.12.16/src/isolate/server/definitions/server_pb2.py +0 -34
  31. isolate-0.12.16/src/isolate/server/definitions/server_pb2_grpc.py +0 -82
  32. isolate-0.12.16/src/isolate/server/health/health_pb2.py +0 -32
  33. isolate-0.12.16/src/isolate/server/health/health_pb2_grpc.py +0 -124
  34. {isolate-0.12.16 → isolate-0.13.1}/.github/workflows/release.yml +0 -0
  35. {isolate-0.12.16 → isolate-0.13.1}/.github/workflows/test.yml +0 -0
  36. {isolate-0.12.16 → isolate-0.13.1}/.gitignore +0 -0
  37. {isolate-0.12.16 → isolate-0.13.1}/.pre-commit-config.yaml +0 -0
  38. {isolate-0.12.16 → isolate-0.13.1}/LICENSE +0 -0
  39. {isolate-0.12.16 → isolate-0.13.1}/README.md +0 -0
  40. {isolate-0.12.16 → isolate-0.13.1}/setup.cfg +0 -0
  41. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/__init__.py +0 -0
  42. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/_version.py +0 -0
  43. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/__init__.py +0 -0
  44. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/_base.py +0 -0
  45. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/common.py +0 -0
  46. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/conda.py +0 -0
  47. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/container.py +0 -0
  48. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/local.py +0 -0
  49. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/pyenv.py +0 -0
  50. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/remote.py +0 -0
  51. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/settings.py +0 -0
  52. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/backends/virtualenv.py +0 -0
  53. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/common/__init__.py +0 -0
  54. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/common/timestamp.py +0 -0
  55. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/__init__.py +0 -0
  56. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/_local/__init__.py +0 -0
  57. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/_local/_base.py +0 -0
  58. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/_local/agent_startup.py +0 -0
  59. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/common.py +0 -0
  60. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/__init__.py +0 -0
  61. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/configuration.py +0 -0
  62. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/definitions/__init__.py +0 -0
  63. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/definitions/agent.proto +0 -0
  64. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/definitions/common.proto +0 -0
  65. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/grpc/interface.py +0 -0
  66. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/ipc/__init__.py +0 -0
  67. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/ipc/_base.py +0 -0
  68. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/connections/ipc/agent.py +0 -0
  69. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/logs.py +0 -0
  70. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/py.typed +0 -0
  71. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/registry.py +0 -0
  72. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/__init__.py +0 -0
  73. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/definitions/__init__.py +0 -0
  74. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/health/__init__.py +0 -0
  75. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/health/health.proto +0 -0
  76. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/health_server.py +0 -0
  77. {isolate-0.12.16 → isolate-0.13.1}/src/isolate/server/interface.py +0 -0
  78. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/dependency_links.txt +0 -0
  79. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/entry_points.txt +0 -0
  80. {isolate-0.12.16 → isolate-0.13.1}/src/isolate.egg-info/top_level.txt +0 -0
  81. {isolate-0.12.16 → isolate-0.13.1}/tests/__init__.py +0 -0
  82. {isolate-0.12.16 → isolate-0.13.1}/tests/conftest.py +0 -0
  83. {isolate-0.12.16 → isolate-0.13.1}/tests/test_backends.py +0 -0
  84. {isolate-0.12.16 → isolate-0.13.1}/tests/test_concurrency.py +0 -0
  85. {isolate-0.12.16 → isolate-0.13.1}/tests/test_connections.py +0 -0
  86. {isolate-0.12.16 → isolate-0.13.1}/tests/test_isolate.py +0 -0
  87. {isolate-0.12.16 → isolate-0.13.1}/tests/test_log.py +0 -0
  88. {isolate-0.12.16 → isolate-0.13.1}/tests/test_serialization.py +0 -0
  89. {isolate-0.12.16 → isolate-0.13.1}/tools/Dockerfile +0 -0
  90. {isolate-0.12.16 → isolate-0.13.1}/tools/agent_requirements.txt +0 -0
  91. {isolate-0.12.16 → isolate-0.13.1}/tools/protobuf-requirements.txt +0 -0
  92. {isolate-0.12.16 → isolate-0.13.1}/tools/requirements.txt +0 -0
  93. {isolate-0.12.16 → isolate-0.13.1}/tools/test_agent_requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isolate
3
- Version: 0.12.16
3
+ Version: 0.13.1
4
4
  Summary: Managed isolated environments for Python
5
5
  Author-email: Features & Labels <hello@fal.ai>
6
6
  Project-URL: Issues, https://github.com/fal-ai/isolate/issues
@@ -8,7 +8,7 @@ Project-URL: Source, https://github.com/fal-ai/isolate
8
8
  Requires-Python: >=3.8
9
9
  Description-Content-Type: text/markdown
10
10
  License-File: LICENSE
11
- Requires-Dist: grpcio>=1.49
11
+ Requires-Dist: grpcio==1.64.0
12
12
  Requires-Dist: protobuf
13
13
  Requires-Dist: tblib>=1.7.0
14
14
  Requires-Dist: platformdirs
@@ -24,6 +24,7 @@ Requires-Dist: dill>=0.3.5.1; extra == "test"
24
24
  Requires-Dist: pytest-rerunfailures; extra == "test"
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: isolate[test]; extra == "dev"
27
+ Requires-Dist: grpcio-tools==1.64.0; extra == "dev"
27
28
 
28
29
  # Isolate
29
30
 
@@ -18,7 +18,9 @@ description = "Managed isolated environments for Python"
18
18
  authors = [{ name = "Features & Labels", email = "hello@fal.ai"}]
19
19
  requires-python = ">=3.8"
20
20
  dependencies = [
21
- "grpcio>=1.49",
21
+ # NOTE: make sure you re-generate python bindings (see tools/regen_grpc.py)
22
+ # when updating grpcio version.
23
+ "grpcio==1.64.0",
22
24
  "protobuf",
23
25
  # These are non-intrusive packages with no transitive dependencies.
24
26
  # They are also used in the agents themselves.
@@ -49,6 +51,7 @@ test = [
49
51
  ]
50
52
  dev = [
51
53
  "isolate[test]",
54
+ "grpcio-tools==1.64.0",
52
55
  ]
53
56
 
54
57
 
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.12.16'
16
- __version_tuple__ = version_tuple = (0, 12, 16)
15
+ __version__ = version = '0.13.1'
16
+ __version_tuple__ = version_tuple = (0, 13, 1)
@@ -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 = 10.0,
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
- print(f"[{source}] [{level}] {line}")
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
- print(stringized_tb, file=sys.stderr)
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)})."
@@ -0,0 +1,29 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: agent.proto
4
+ # Protobuf Python Version: 5.26.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+ from isolate.connections.grpc.definitions import common_pb2 as common__pb2
16
+
17
+
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')
19
+
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
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 sys
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
- @typing_extensions.final
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
- self,
42
- field_name: typing_extensions.Literal[
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
@@ -0,0 +1,104 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from isolate.connections.grpc.definitions import agent_pb2 as agent__pb2
7
+ from isolate.connections.grpc.definitions import common_pb2 as common__pb2
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
+
33
+
34
+ class AgentStub(object):
35
+ """Missing associated documentation comment in .proto file."""
36
+
37
+ def __init__(self, channel):
38
+ """Constructor.
39
+
40
+ Args:
41
+ channel: A grpc.Channel.
42
+ """
43
+ self.Run = channel.unary_stream(
44
+ '/Agent/Run',
45
+ request_serializer=agent__pb2.FunctionCall.SerializeToString,
46
+ response_deserializer=common__pb2.PartialRunResult.FromString,
47
+ _registered_method=True)
48
+
49
+
50
+ class AgentServicer(object):
51
+ """Missing associated documentation comment in .proto file."""
52
+
53
+ def Run(self, request, context):
54
+ """Start running the given function, and stream results back.
55
+ """
56
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
57
+ context.set_details('Method not implemented!')
58
+ raise NotImplementedError('Method not implemented!')
59
+
60
+
61
+ def add_AgentServicer_to_server(servicer, server):
62
+ rpc_method_handlers = {
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
+ ),
68
+ }
69
+ generic_handler = grpc.method_handlers_generic_handler(
70
+ 'Agent', rpc_method_handlers)
71
+ server.add_generic_rpc_handlers((generic_handler,))
72
+ server.add_registered_method_handlers('Agent', rpc_method_handlers)
73
+
74
+
75
+ # This class is part of an EXPERIMENTAL API.
76
+ class Agent(object):
77
+ """Missing associated documentation comment in .proto file."""
78
+
79
+ @staticmethod
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):
90
+ return grpc.experimental.unary_stream(
91
+ request,
92
+ target,
93
+ '/Agent/Run',
94
+ agent__pb2.FunctionCall.SerializeToString,
95
+ common__pb2.PartialRunResult.FromString,
96
+ options,
97
+ channel_credentials,
98
+ insecure,
99
+ call_credentials,
100
+ compression,
101
+ wait_for_ready,
102
+ timeout,
103
+ metadata,
104
+ _registered_method=True)
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: common.proto
4
+ # Protobuf Python Version: 5.26.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
16
+
17
+
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')
19
+
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
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
- @typing_extensions.final
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
- self,
100
- field_name: typing_extensions.Literal[
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
- @typing_extensions.final
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
- self,
161
- field_name: typing_extensions.Literal[
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
- @typing_extensions.final
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
- self, field_name: typing_extensions.Literal["timestamp", b"timestamp"]
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
@@ -0,0 +1,29 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
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
+ )
@@ -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
+ }
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: server.proto
4
+ # Protobuf Python Version: 5.26.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
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
17
+
18
+
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
36
+ # @@protoc_insertion_point(module_scope)