isolate 0.15.0__tar.gz → 0.16.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 (88) hide show
  1. {isolate-0.15.0 → isolate-0.16.1}/PKG-INFO +3 -3
  2. {isolate-0.15.0 → isolate-0.16.1}/pyproject.toml +1 -1
  3. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/_isolate_version.py +2 -2
  4. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/common.py +1 -1
  5. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/remote.py +1 -0
  6. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/agent_pb2.py +3 -3
  7. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/agent_pb2_grpc.py +4 -40
  8. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/common_pb2.py +3 -3
  9. isolate-0.16.1/src/isolate/connections/grpc/definitions/common_pb2_grpc.py +4 -0
  10. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/logger.py +0 -3
  11. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/definitions/server.proto +1 -0
  12. isolate-0.16.1/src/isolate/server/definitions/server_pb2.py +56 -0
  13. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/definitions/server_pb2.pyi +4 -1
  14. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/definitions/server_pb2_grpc.py +20 -96
  15. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health/health_pb2.py +3 -3
  16. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health/health_pb2_grpc.py +8 -54
  17. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/server.py +22 -17
  18. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/PKG-INFO +3 -3
  19. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/requires.txt +1 -1
  20. {isolate-0.15.0 → isolate-0.16.1}/tests/test_server.py +43 -2
  21. isolate-0.15.0/src/isolate/connections/grpc/definitions/common_pb2_grpc.py +0 -29
  22. isolate-0.15.0/src/isolate/server/definitions/server_pb2.py +0 -56
  23. {isolate-0.15.0 → isolate-0.16.1}/.github/workflows/release.yml +0 -0
  24. {isolate-0.15.0 → isolate-0.16.1}/.github/workflows/test.yml +0 -0
  25. {isolate-0.15.0 → isolate-0.16.1}/.gitignore +0 -0
  26. {isolate-0.15.0 → isolate-0.16.1}/.pre-commit-config.yaml +0 -0
  27. {isolate-0.15.0 → isolate-0.16.1}/LICENSE +0 -0
  28. {isolate-0.15.0 → isolate-0.16.1}/README.md +0 -0
  29. {isolate-0.15.0 → isolate-0.16.1}/setup.cfg +0 -0
  30. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/__init__.py +0 -0
  31. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/_version.py +0 -0
  32. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/__init__.py +0 -0
  33. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/_base.py +0 -0
  34. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/conda.py +0 -0
  35. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/container.py +0 -0
  36. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/local.py +0 -0
  37. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/pyenv.py +0 -0
  38. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/settings.py +0 -0
  39. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/backends/virtualenv.py +0 -0
  40. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/common/__init__.py +0 -0
  41. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/common/timestamp.py +0 -0
  42. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/__init__.py +0 -0
  43. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/_local/__init__.py +0 -0
  44. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/_local/_base.py +0 -0
  45. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/_local/agent_startup.py +0 -0
  46. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/common.py +0 -0
  47. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/__init__.py +0 -0
  48. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/_base.py +0 -0
  49. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/agent.py +0 -0
  50. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/configuration.py +0 -0
  51. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/__init__.py +0 -0
  52. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/agent.proto +0 -0
  53. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/agent_pb2.pyi +0 -0
  54. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/common.proto +0 -0
  55. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/definitions/common_pb2.pyi +0 -0
  56. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/grpc/interface.py +0 -0
  57. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/ipc/__init__.py +0 -0
  58. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/ipc/_base.py +0 -0
  59. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/connections/ipc/agent.py +0 -0
  60. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/logs.py +0 -0
  61. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/py.typed +0 -0
  62. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/registry.py +0 -0
  63. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/__init__.py +0 -0
  64. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/definitions/__init__.py +0 -0
  65. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health/__init__.py +0 -0
  66. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health/health.proto +0 -0
  67. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health/health_pb2.pyi +0 -0
  68. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/health_server.py +0 -0
  69. {isolate-0.15.0 → isolate-0.16.1}/src/isolate/server/interface.py +0 -0
  70. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/SOURCES.txt +0 -0
  71. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/dependency_links.txt +0 -0
  72. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/entry_points.txt +0 -0
  73. {isolate-0.15.0 → isolate-0.16.1}/src/isolate.egg-info/top_level.txt +0 -0
  74. {isolate-0.15.0 → isolate-0.16.1}/tests/__init__.py +0 -0
  75. {isolate-0.15.0 → isolate-0.16.1}/tests/conftest.py +0 -0
  76. {isolate-0.15.0 → isolate-0.16.1}/tests/test_backends.py +0 -0
  77. {isolate-0.15.0 → isolate-0.16.1}/tests/test_concurrency.py +0 -0
  78. {isolate-0.15.0 → isolate-0.16.1}/tests/test_connections.py +0 -0
  79. {isolate-0.15.0 → isolate-0.16.1}/tests/test_isolate.py +0 -0
  80. {isolate-0.15.0 → isolate-0.16.1}/tests/test_log.py +0 -0
  81. {isolate-0.15.0 → isolate-0.16.1}/tests/test_logger.py +0 -0
  82. {isolate-0.15.0 → isolate-0.16.1}/tests/test_serialization.py +0 -0
  83. {isolate-0.15.0 → isolate-0.16.1}/tools/Dockerfile +0 -0
  84. {isolate-0.15.0 → isolate-0.16.1}/tools/agent_requirements.txt +0 -0
  85. {isolate-0.15.0 → isolate-0.16.1}/tools/protobuf-requirements.txt +0 -0
  86. {isolate-0.15.0 → isolate-0.16.1}/tools/regen_grpc.py +0 -0
  87. {isolate-0.15.0 → isolate-0.16.1}/tools/requirements.txt +0 -0
  88. {isolate-0.15.0 → isolate-0.16.1}/tools/test_agent_requirements.txt +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: isolate
3
- Version: 0.15.0
3
+ Version: 0.16.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
@@ -21,7 +21,7 @@ Requires-Dist: isolate[build]; extra == "test"
21
21
  Requires-Dist: pytest; extra == "test"
22
22
  Requires-Dist: cloudpickle>=2.2.0; extra == "test"
23
23
  Requires-Dist: dill>=0.3.5.1; extra == "test"
24
- Requires-Dist: pytest-rerunfailures; extra == "test"
24
+ Requires-Dist: flaky; extra == "test"
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: isolate[test]; extra == "dev"
27
27
  Requires-Dist: grpcio-tools==1.64.0; extra == "dev"
@@ -47,7 +47,7 @@ test = [
47
47
  "pytest",
48
48
  "cloudpickle>=2.2.0",
49
49
  "dill>=0.3.5.1",
50
- "pytest-rerunfailures",
50
+ "flaky",
51
51
  ]
52
52
  dev = [
53
53
  "isolate[test]",
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.15.0'
16
- __version_tuple__ = version_tuple = (0, 15, 0)
15
+ __version__ = version = '0.16.1'
16
+ __version_tuple__ = version_tuple = (0, 16, 1)
@@ -110,7 +110,7 @@ def _io_observer(
110
110
 
111
111
  def forward_lines(fd: int) -> None:
112
112
  hook = hooks[fd]
113
- with open(fd, closefd=False) as stream:
113
+ with open(fd, closefd=False, errors="backslashreplace") as stream:
114
114
  # TODO: we probably should pass the real line endings
115
115
  raw_data = stream.read()
116
116
  if not raw_data:
@@ -115,6 +115,7 @@ class IsolateServerConnection(EnvironmentConnection):
115
115
  was_it_raised=False,
116
116
  ),
117
117
  environments=self.definitions,
118
+ stream_logs=True, # Default to streaming logs
118
119
  )
119
120
 
120
121
  return_value = []
@@ -1,7 +1,7 @@
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
+ # Protobuf Python Version: 4.25.1
5
5
  """Generated protocol buffer code."""
6
6
  from google.protobuf import descriptor as _descriptor
7
7
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -20,8 +20,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0b\x61gent.proto
20
20
  _globals = globals()
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
22
22
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'agent_pb2', _globals)
23
- if not _descriptor._USE_C_DESCRIPTORS:
24
- DESCRIPTOR._loaded_options = None
23
+ if _descriptor._USE_C_DESCRIPTORS == False:
24
+ DESCRIPTOR._options = None
25
25
  _globals['_FUNCTIONCALL']._serialized_start=29
26
26
  _globals['_FUNCTIONCALL']._serialized_end=139
27
27
  _globals['_AGENT']._serialized_start=141
@@ -1,35 +1,10 @@
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
4
 
6
5
  from isolate.connections.grpc.definitions import agent_pb2 as agent__pb2
7
6
  from isolate.connections.grpc.definitions import common_pb2 as common__pb2
8
7
 
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
8
 
34
9
  class AgentStub(object):
35
10
  """Missing associated documentation comment in .proto file."""
@@ -44,7 +19,7 @@ class AgentStub(object):
44
19
  '/Agent/Run',
45
20
  request_serializer=agent__pb2.FunctionCall.SerializeToString,
46
21
  response_deserializer=common__pb2.PartialRunResult.FromString,
47
- _registered_method=True)
22
+ )
48
23
 
49
24
 
50
25
  class AgentServicer(object):
@@ -69,7 +44,6 @@ def add_AgentServicer_to_server(servicer, server):
69
44
  generic_handler = grpc.method_handlers_generic_handler(
70
45
  'Agent', rpc_method_handlers)
71
46
  server.add_generic_rpc_handlers((generic_handler,))
72
- server.add_registered_method_handlers('Agent', rpc_method_handlers)
73
47
 
74
48
 
75
49
  # This class is part of an EXPERIMENTAL API.
@@ -87,18 +61,8 @@ class Agent(object):
87
61
  wait_for_ready=None,
88
62
  timeout=None,
89
63
  metadata=None):
90
- return grpc.experimental.unary_stream(
91
- request,
92
- target,
93
- '/Agent/Run',
64
+ return grpc.experimental.unary_stream(request, target, '/Agent/Run',
94
65
  agent__pb2.FunctionCall.SerializeToString,
95
66
  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)
67
+ options, channel_credentials,
68
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -1,7 +1,7 @@
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
+ # Protobuf Python Version: 4.25.1
5
5
  """Generated protocol buffer code."""
6
6
  from google.protobuf import descriptor as _descriptor
7
7
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -20,8 +20,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0c\x63ommon.prot
20
20
  _globals = globals()
21
21
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
22
22
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'common_pb2', _globals)
23
- if not _descriptor._USE_C_DESCRIPTORS:
24
- DESCRIPTOR._loaded_options = None
23
+ if _descriptor._USE_C_DESCRIPTORS == False:
24
+ DESCRIPTOR._options = None
25
25
  _globals['_LOGSOURCE']._serialized_start=426
26
26
  _globals['_LOGSOURCE']._serialized_end=472
27
27
  _globals['_LOGLEVEL']._serialized_start=474
@@ -0,0 +1,4 @@
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
+
@@ -51,6 +51,3 @@ class IsolateLogger:
51
51
  print("Failed to parse ISOLATE_LOG_LABELS")
52
52
 
53
53
  return cls.with_env_expanded(labels=_labels)
54
-
55
-
56
- ENV_LOGGER = IsolateLogger.from_env()
@@ -25,6 +25,7 @@ message BoundFunction {
25
25
  repeated EnvironmentDefinition environments = 1;
26
26
  SerializedObject function = 2;
27
27
  optional SerializedObject setup_func = 3;
28
+ bool stream_logs = 4;
28
29
  }
29
30
 
30
31
  message EnvironmentDefinition {
@@ -0,0 +1,56 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: server.proto
4
+ # Protobuf Python Version: 4.25.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\"\xb2\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\x12\x13\n\x0bstream_logs\x18\x04 \x01(\x08\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\"R\n\rSubmitRequest\x12 \n\x08\x66unction\x18\x01 \x01(\x0b\x32\x0e.BoundFunction\x12\x1f\n\x08metadata\x18\x02 \x01(\x0b\x32\r.TaskMetadata\"{\n\x0cTaskMetadata\x12\x36\n\rlogger_labels\x18\x01 \x03(\x0b\x32\x1f.TaskMetadata.LoggerLabelsEntry\x1a\x33\n\x11LoggerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"!\n\x0eSubmitResponse\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"F\n\x12SetMetadataRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x1f\n\x08metadata\x18\x02 \x01(\x0b\x32\r.TaskMetadata\"\x15\n\x13SetMetadataResponse\"\r\n\x0bListRequest\"\x1b\n\x08TaskInfo\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"(\n\x0cListResponse\x12\x18\n\x05tasks\x18\x01 \x03(\x0b\x32\t.TaskInfo\" \n\rCancelRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"\x10\n\x0e\x43\x61ncelResponse2\xf4\x01\n\x07Isolate\x12,\n\x03Run\x12\x0e.BoundFunction\x1a\x11.PartialRunResult\"\x00\x30\x01\x12+\n\x06Submit\x12\x0e.SubmitRequest\x1a\x0f.SubmitResponse\"\x00\x12:\n\x0bSetMetadata\x12\x13.SetMetadataRequest\x1a\x14.SetMetadataResponse\"\x00\x12%\n\x04List\x12\x0c.ListRequest\x1a\r.ListResponse\"\x00\x12+\n\x06\x43\x61ncel\x12\x0e.CancelRequest\x1a\x0f.CancelResponse\"\x00\x62\x06proto3')
20
+
21
+ _globals = globals()
22
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
23
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'server_pb2', _globals)
24
+ if _descriptor._USE_C_DESCRIPTORS == False:
25
+ DESCRIPTOR._options = None
26
+ _globals['_TASKMETADATA_LOGGERLABELSENTRY']._options = None
27
+ _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_options = b'8\001'
28
+ _globals['_BOUNDFUNCTION']._serialized_start=61
29
+ _globals['_BOUNDFUNCTION']._serialized_end=239
30
+ _globals['_ENVIRONMENTDEFINITION']._serialized_start=241
31
+ _globals['_ENVIRONMENTDEFINITION']._serialized_end=341
32
+ _globals['_SUBMITREQUEST']._serialized_start=343
33
+ _globals['_SUBMITREQUEST']._serialized_end=425
34
+ _globals['_TASKMETADATA']._serialized_start=427
35
+ _globals['_TASKMETADATA']._serialized_end=550
36
+ _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_start=499
37
+ _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_end=550
38
+ _globals['_SUBMITRESPONSE']._serialized_start=552
39
+ _globals['_SUBMITRESPONSE']._serialized_end=585
40
+ _globals['_SETMETADATAREQUEST']._serialized_start=587
41
+ _globals['_SETMETADATAREQUEST']._serialized_end=657
42
+ _globals['_SETMETADATARESPONSE']._serialized_start=659
43
+ _globals['_SETMETADATARESPONSE']._serialized_end=680
44
+ _globals['_LISTREQUEST']._serialized_start=682
45
+ _globals['_LISTREQUEST']._serialized_end=695
46
+ _globals['_TASKINFO']._serialized_start=697
47
+ _globals['_TASKINFO']._serialized_end=724
48
+ _globals['_LISTRESPONSE']._serialized_start=726
49
+ _globals['_LISTRESPONSE']._serialized_end=766
50
+ _globals['_CANCELREQUEST']._serialized_start=768
51
+ _globals['_CANCELREQUEST']._serialized_end=800
52
+ _globals['_CANCELRESPONSE']._serialized_start=802
53
+ _globals['_CANCELRESPONSE']._serialized_end=818
54
+ _globals['_ISOLATE']._serialized_start=821
55
+ _globals['_ISOLATE']._serialized_end=1065
56
+ # @@protoc_insertion_point(module_scope)
@@ -25,21 +25,24 @@ class BoundFunction(google.protobuf.message.Message):
25
25
  ENVIRONMENTS_FIELD_NUMBER: builtins.int
26
26
  FUNCTION_FIELD_NUMBER: builtins.int
27
27
  SETUP_FUNC_FIELD_NUMBER: builtins.int
28
+ STREAM_LOGS_FIELD_NUMBER: builtins.int
28
29
  @property
29
30
  def environments(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___EnvironmentDefinition]: ...
30
31
  @property
31
32
  def function(self) -> common_pb2.SerializedObject: ...
32
33
  @property
33
34
  def setup_func(self) -> common_pb2.SerializedObject: ...
35
+ stream_logs: builtins.bool
34
36
  def __init__(
35
37
  self,
36
38
  *,
37
39
  environments: collections.abc.Iterable[global___EnvironmentDefinition] | None = ...,
38
40
  function: common_pb2.SerializedObject | None = ...,
39
41
  setup_func: common_pb2.SerializedObject | None = ...,
42
+ stream_logs: builtins.bool = ...,
40
43
  ) -> None: ...
41
44
  def HasField(self, field_name: typing_extensions.Literal["_setup_func", b"_setup_func", "function", b"function", "setup_func", b"setup_func"]) -> builtins.bool: ...
42
- def ClearField(self, field_name: typing_extensions.Literal["_setup_func", b"_setup_func", "environments", b"environments", "function", b"function", "setup_func", b"setup_func"]) -> None: ...
45
+ def ClearField(self, field_name: typing_extensions.Literal["_setup_func", b"_setup_func", "environments", b"environments", "function", b"function", "setup_func", b"setup_func", "stream_logs", b"stream_logs"]) -> None: ...
43
46
  def WhichOneof(self, oneof_group: typing_extensions.Literal["_setup_func", b"_setup_func"]) -> typing_extensions.Literal["setup_func"] | None: ...
44
47
 
45
48
  global___BoundFunction = BoundFunction
@@ -1,35 +1,10 @@
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
4
 
6
5
  from isolate.connections.grpc.definitions import common_pb2 as common__pb2
7
6
  from isolate.server.definitions import server_pb2 as server__pb2
8
7
 
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 server_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
8
 
34
9
  class IsolateStub(object):
35
10
  """Missing associated documentation comment in .proto file."""
@@ -44,27 +19,27 @@ class IsolateStub(object):
44
19
  '/Isolate/Run',
45
20
  request_serializer=server__pb2.BoundFunction.SerializeToString,
46
21
  response_deserializer=common__pb2.PartialRunResult.FromString,
47
- _registered_method=True)
22
+ )
48
23
  self.Submit = channel.unary_unary(
49
24
  '/Isolate/Submit',
50
25
  request_serializer=server__pb2.SubmitRequest.SerializeToString,
51
26
  response_deserializer=server__pb2.SubmitResponse.FromString,
52
- _registered_method=True)
27
+ )
53
28
  self.SetMetadata = channel.unary_unary(
54
29
  '/Isolate/SetMetadata',
55
30
  request_serializer=server__pb2.SetMetadataRequest.SerializeToString,
56
31
  response_deserializer=server__pb2.SetMetadataResponse.FromString,
57
- _registered_method=True)
32
+ )
58
33
  self.List = channel.unary_unary(
59
34
  '/Isolate/List',
60
35
  request_serializer=server__pb2.ListRequest.SerializeToString,
61
36
  response_deserializer=server__pb2.ListResponse.FromString,
62
- _registered_method=True)
37
+ )
63
38
  self.Cancel = channel.unary_unary(
64
39
  '/Isolate/Cancel',
65
40
  request_serializer=server__pb2.CancelRequest.SerializeToString,
66
41
  response_deserializer=server__pb2.CancelResponse.FromString,
67
- _registered_method=True)
42
+ )
68
43
 
69
44
 
70
45
  class IsolateServicer(object):
@@ -138,7 +113,6 @@ def add_IsolateServicer_to_server(servicer, server):
138
113
  generic_handler = grpc.method_handlers_generic_handler(
139
114
  'Isolate', rpc_method_handlers)
140
115
  server.add_generic_rpc_handlers((generic_handler,))
141
- server.add_registered_method_handlers('Isolate', rpc_method_handlers)
142
116
 
143
117
 
144
118
  # This class is part of an EXPERIMENTAL API.
@@ -156,21 +130,11 @@ class Isolate(object):
156
130
  wait_for_ready=None,
157
131
  timeout=None,
158
132
  metadata=None):
159
- return grpc.experimental.unary_stream(
160
- request,
161
- target,
162
- '/Isolate/Run',
133
+ return grpc.experimental.unary_stream(request, target, '/Isolate/Run',
163
134
  server__pb2.BoundFunction.SerializeToString,
164
135
  common__pb2.PartialRunResult.FromString,
165
- options,
166
- channel_credentials,
167
- insecure,
168
- call_credentials,
169
- compression,
170
- wait_for_ready,
171
- timeout,
172
- metadata,
173
- _registered_method=True)
136
+ options, channel_credentials,
137
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
174
138
 
175
139
  @staticmethod
176
140
  def Submit(request,
@@ -183,21 +147,11 @@ class Isolate(object):
183
147
  wait_for_ready=None,
184
148
  timeout=None,
185
149
  metadata=None):
186
- return grpc.experimental.unary_unary(
187
- request,
188
- target,
189
- '/Isolate/Submit',
150
+ return grpc.experimental.unary_unary(request, target, '/Isolate/Submit',
190
151
  server__pb2.SubmitRequest.SerializeToString,
191
152
  server__pb2.SubmitResponse.FromString,
192
- options,
193
- channel_credentials,
194
- insecure,
195
- call_credentials,
196
- compression,
197
- wait_for_ready,
198
- timeout,
199
- metadata,
200
- _registered_method=True)
153
+ options, channel_credentials,
154
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
201
155
 
202
156
  @staticmethod
203
157
  def SetMetadata(request,
@@ -210,21 +164,11 @@ class Isolate(object):
210
164
  wait_for_ready=None,
211
165
  timeout=None,
212
166
  metadata=None):
213
- return grpc.experimental.unary_unary(
214
- request,
215
- target,
216
- '/Isolate/SetMetadata',
167
+ return grpc.experimental.unary_unary(request, target, '/Isolate/SetMetadata',
217
168
  server__pb2.SetMetadataRequest.SerializeToString,
218
169
  server__pb2.SetMetadataResponse.FromString,
219
- options,
220
- channel_credentials,
221
- insecure,
222
- call_credentials,
223
- compression,
224
- wait_for_ready,
225
- timeout,
226
- metadata,
227
- _registered_method=True)
170
+ options, channel_credentials,
171
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
228
172
 
229
173
  @staticmethod
230
174
  def List(request,
@@ -237,21 +181,11 @@ class Isolate(object):
237
181
  wait_for_ready=None,
238
182
  timeout=None,
239
183
  metadata=None):
240
- return grpc.experimental.unary_unary(
241
- request,
242
- target,
243
- '/Isolate/List',
184
+ return grpc.experimental.unary_unary(request, target, '/Isolate/List',
244
185
  server__pb2.ListRequest.SerializeToString,
245
186
  server__pb2.ListResponse.FromString,
246
- options,
247
- channel_credentials,
248
- insecure,
249
- call_credentials,
250
- compression,
251
- wait_for_ready,
252
- timeout,
253
- metadata,
254
- _registered_method=True)
187
+ options, channel_credentials,
188
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
255
189
 
256
190
  @staticmethod
257
191
  def Cancel(request,
@@ -264,18 +198,8 @@ class Isolate(object):
264
198
  wait_for_ready=None,
265
199
  timeout=None,
266
200
  metadata=None):
267
- return grpc.experimental.unary_unary(
268
- request,
269
- target,
270
- '/Isolate/Cancel',
201
+ return grpc.experimental.unary_unary(request, target, '/Isolate/Cancel',
271
202
  server__pb2.CancelRequest.SerializeToString,
272
203
  server__pb2.CancelResponse.FromString,
273
- options,
274
- channel_credentials,
275
- insecure,
276
- call_credentials,
277
- compression,
278
- wait_for_ready,
279
- timeout,
280
- metadata,
281
- _registered_method=True)
204
+ options, channel_credentials,
205
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
3
3
  # source: health.proto
4
- # Protobuf Python Version: 5.26.1
4
+ # Protobuf Python Version: 4.25.1
5
5
  """Generated protocol buffer code."""
6
6
  from google.protobuf import descriptor as _descriptor
7
7
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -19,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0chealth.proto\x
19
19
  _globals = globals()
20
20
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
21
  _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'health_pb2', _globals)
22
- if not _descriptor._USE_C_DESCRIPTORS:
23
- DESCRIPTOR._loaded_options = None
22
+ if _descriptor._USE_C_DESCRIPTORS == False:
23
+ DESCRIPTOR._options = None
24
24
  _globals['_HEALTHCHECKREQUEST']._serialized_start=32
25
25
  _globals['_HEALTHCHECKREQUEST']._serialized_end=69
26
26
  _globals['_HEALTHCHECKRESPONSE']._serialized_start=72
@@ -1,34 +1,9 @@
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
4
 
6
5
  from isolate.server.health import health_pb2 as health__pb2
7
6
 
8
- GRPC_GENERATED_VERSION = '1.64.0'
9
- GRPC_VERSION = grpc.__version__
10
- EXPECTED_ERROR_RELEASE = '1.65.0'
11
- SCHEDULED_RELEASE_DATE = 'June 25, 2024'
12
- _version_not_supported = False
13
-
14
- try:
15
- from grpc._utilities import first_version_is_lower
16
- _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
17
- except ImportError:
18
- _version_not_supported = True
19
-
20
- if _version_not_supported:
21
- warnings.warn(
22
- f'The grpc package installed is at version {GRPC_VERSION},'
23
- + f' but the generated code in health_pb2_grpc.py depends on'
24
- + f' grpcio>={GRPC_GENERATED_VERSION}.'
25
- + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
26
- + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
27
- + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
28
- + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
29
- RuntimeWarning
30
- )
31
-
32
7
 
33
8
  class HealthStub(object):
34
9
  """Missing associated documentation comment in .proto file."""
@@ -43,12 +18,12 @@ class HealthStub(object):
43
18
  '/grpc.health.v1.Health/Check',
44
19
  request_serializer=health__pb2.HealthCheckRequest.SerializeToString,
45
20
  response_deserializer=health__pb2.HealthCheckResponse.FromString,
46
- _registered_method=True)
21
+ )
47
22
  self.Watch = channel.unary_stream(
48
23
  '/grpc.health.v1.Health/Watch',
49
24
  request_serializer=health__pb2.HealthCheckRequest.SerializeToString,
50
25
  response_deserializer=health__pb2.HealthCheckResponse.FromString,
51
- _registered_method=True)
26
+ )
52
27
 
53
28
 
54
29
  class HealthServicer(object):
@@ -83,7 +58,6 @@ def add_HealthServicer_to_server(servicer, server):
83
58
  generic_handler = grpc.method_handlers_generic_handler(
84
59
  'grpc.health.v1.Health', rpc_method_handlers)
85
60
  server.add_generic_rpc_handlers((generic_handler,))
86
- server.add_registered_method_handlers('grpc.health.v1.Health', rpc_method_handlers)
87
61
 
88
62
 
89
63
  # This class is part of an EXPERIMENTAL API.
@@ -101,21 +75,11 @@ class Health(object):
101
75
  wait_for_ready=None,
102
76
  timeout=None,
103
77
  metadata=None):
104
- return grpc.experimental.unary_unary(
105
- request,
106
- target,
107
- '/grpc.health.v1.Health/Check',
78
+ return grpc.experimental.unary_unary(request, target, '/grpc.health.v1.Health/Check',
108
79
  health__pb2.HealthCheckRequest.SerializeToString,
109
80
  health__pb2.HealthCheckResponse.FromString,
110
- options,
111
- channel_credentials,
112
- insecure,
113
- call_credentials,
114
- compression,
115
- wait_for_ready,
116
- timeout,
117
- metadata,
118
- _registered_method=True)
81
+ options, channel_credentials,
82
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
119
83
 
120
84
  @staticmethod
121
85
  def Watch(request,
@@ -128,18 +92,8 @@ class Health(object):
128
92
  wait_for_ready=None,
129
93
  timeout=None,
130
94
  metadata=None):
131
- return grpc.experimental.unary_stream(
132
- request,
133
- target,
134
- '/grpc.health.v1.Health/Watch',
95
+ return grpc.experimental.unary_stream(request, target, '/grpc.health.v1.Health/Watch',
135
96
  health__pb2.HealthCheckRequest.SerializeToString,
136
97
  health__pb2.HealthCheckResponse.FromString,
137
- options,
138
- channel_credentials,
139
- insecure,
140
- call_credentials,
141
- compression,
142
- wait_for_ready,
143
- timeout,
144
- metadata,
145
- _registered_method=True)
98
+ options, channel_credentials,
99
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@@ -29,7 +29,7 @@ from isolate.backends.local import LocalPythonEnvironment
29
29
  from isolate.backends.virtualenv import VirtualPythonEnvironment
30
30
  from isolate.connections.grpc import AgentError, LocalPythonGRPC
31
31
  from isolate.connections.grpc.configuration import get_default_options
32
- from isolate.logger import ENV_LOGGER, IsolateLogger
32
+ from isolate.logger import IsolateLogger
33
33
  from isolate.logs import Log, LogLevel, LogSource
34
34
  from isolate.server import definitions, health
35
35
  from isolate.server.health_server import HealthServicer
@@ -72,7 +72,7 @@ class GRPCException(Exception):
72
72
  @dataclass
73
73
  class RunnerAgent:
74
74
  stub: definitions.AgentStub
75
- message_queue: Queue
75
+ message_queue: Queue[definitions.PartialRunResult]
76
76
  _bound_context: ExitStack
77
77
  _channel_state_history: list[grpc.ChannelConnectivity] = field(default_factory=list)
78
78
 
@@ -175,7 +175,7 @@ class RunTask:
175
175
  request: definitions.BoundFunction
176
176
  future: futures.Future | None = None
177
177
  agent: RunnerAgent | None = None
178
- logger: IsolateLogger = ENV_LOGGER
178
+ logger: IsolateLogger = field(default_factory=IsolateLogger.from_env)
179
179
 
180
180
  def cancel(self):
181
181
  while True:
@@ -188,6 +188,10 @@ class RunTask:
188
188
  except futures.TimeoutError:
189
189
  pass
190
190
 
191
+ @property
192
+ def stream_logs(self) -> bool:
193
+ return self.request.stream_logs
194
+
191
195
 
192
196
  @dataclass
193
197
  class IsolateServicer(definitions.IsolateServicer):
@@ -277,6 +281,7 @@ class IsolateServicer(definitions.IsolateServicer):
277
281
 
278
282
  future = local_pool.submit(
279
283
  _proxy_to_queue,
284
+ # The agent may have been cached, so use the agent's message queue
280
285
  queue=agent.message_queue,
281
286
  bridge=agent.stub,
282
287
  input=function_call,
@@ -324,16 +329,9 @@ class IsolateServicer(definitions.IsolateServicer):
324
329
  request: definitions.SubmitRequest,
325
330
  context: ServicerContext,
326
331
  ) -> definitions.SubmitResponse:
327
- logger = ENV_LOGGER
328
- if request.metadata.logger_labels:
329
- logger_labels_dict = dict(request.metadata.logger_labels)
330
- try:
331
- logger = IsolateLogger.with_env_expanded(logger_labels_dict)
332
- except BaseException:
333
- # Ignore the error if the logger couldn't be created.
334
- pass
332
+ task = RunTask(request=request.function)
333
+ self.set_metadata(task, request.metadata)
335
334
 
336
- task = RunTask(request=request.function, logger=logger)
337
335
  task.future = RUNNER_THREAD_POOL.submit(self._run_task_in_background, task)
338
336
  task_id = str(uuid.uuid4())
339
337
 
@@ -365,21 +363,23 @@ class IsolateServicer(definitions.IsolateServicer):
365
363
  StatusCode.NOT_FOUND,
366
364
  )
367
365
 
368
- task = self.background_tasks[request.task_id]
369
-
370
- task.logger.extra_labels = dict(request.metadata.logger_labels)
366
+ self.set_metadata(self.background_tasks[request.task_id], request.metadata)
371
367
 
372
368
  return definitions.SetMetadataResponse()
373
369
 
370
+ def set_metadata(self, task: RunTask, metadata: definitions.TaskMetadata) -> None:
371
+ task.logger.extra_labels = dict(metadata.logger_labels)
372
+
374
373
  def Run(
375
374
  self,
376
375
  request: definitions.BoundFunction,
377
376
  context: ServicerContext,
378
377
  ) -> Iterator[definitions.PartialRunResult]:
379
378
  try:
380
- # HACK: we can support only one task at a time for Run
381
- # TODO: move away from this when we use submit for env-aware tasks
382
379
  task = RunTask(request=request)
380
+
381
+ # HACK: we can support only one task at a time
382
+ # TODO: move away from this when we use submit for env-aware tasks
383
383
  self.background_tasks["RUN"] = task
384
384
  yield from self._run_task(task)
385
385
  except GRPCException as exc:
@@ -495,6 +495,11 @@ class LogHandler:
495
495
  self._add_log_to_queue(log)
496
496
 
497
497
  def _add_log_to_queue(self, log: Log) -> None:
498
+ if not self.task.stream_logs:
499
+ # We do not queue the logs if the stream_logs is disabled
500
+ # but still log them to the logger.
501
+ return
502
+
498
503
  grpc_log = cast(definitions.Log, to_grpc(log))
499
504
  grpc_result = definitions.PartialRunResult(
500
505
  is_complete=False,
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: isolate
3
- Version: 0.15.0
3
+ Version: 0.16.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
@@ -21,7 +21,7 @@ Requires-Dist: isolate[build]; extra == "test"
21
21
  Requires-Dist: pytest; extra == "test"
22
22
  Requires-Dist: cloudpickle>=2.2.0; extra == "test"
23
23
  Requires-Dist: dill>=0.3.5.1; extra == "test"
24
- Requires-Dist: pytest-rerunfailures; extra == "test"
24
+ Requires-Dist: flaky; extra == "test"
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: isolate[test]; extra == "dev"
27
27
  Requires-Dist: grpcio-tools==1.64.0; extra == "dev"
@@ -19,4 +19,4 @@ isolate[build]
19
19
  pytest
20
20
  cloudpickle>=2.2.0
21
21
  dill>=0.3.5.1
22
- pytest-rerunfailures
22
+ flaky
@@ -120,6 +120,7 @@ def run_request(
120
120
  stub: definitions.IsolateStub,
121
121
  request: definitions.BoundFunction,
122
122
  *,
123
+ stream_logs: bool = True,
123
124
  build_logs: Optional[List[Log]] = None,
124
125
  bridge_logs: Optional[List[Log]] = None,
125
126
  user_logs: Optional[List[Log]] = None,
@@ -130,6 +131,8 @@ def run_request(
130
131
  LogSource.USER: user_logs if user_logs is not None else [],
131
132
  }
132
133
 
134
+ request.stream_logs = stream_logs
135
+
133
136
  return_value = _NOT_SET
134
137
  for result in stub.Run(request):
135
138
  for _log in result.logs:
@@ -272,6 +275,44 @@ def test_user_logs_immediate(stub: definitions.IsolateStub, monkeypatch: Any) ->
272
275
  assert by_stream[LogLevel.DEBUG] == "[debug] error!"
273
276
 
274
277
 
278
+ def test_no_stream_logs(stub: definitions.IsolateStub, monkeypatch: Any) -> None:
279
+ inherit_from_local(monkeypatch)
280
+
281
+ env_definition = define_environment("virtualenv", requirements=["pyjokes==0.6.0"])
282
+ request = definitions.BoundFunction(
283
+ function=to_serialized_object(
284
+ partial(
285
+ exec,
286
+ textwrap.dedent(
287
+ """
288
+ import sys, pyjokes
289
+ print(pyjokes.__version__)
290
+ print("error error!", file=sys.stderr)
291
+ """
292
+ ),
293
+ ),
294
+ method="dill",
295
+ ),
296
+ environments=[env_definition],
297
+ )
298
+
299
+ user_logs: List[Log] = []
300
+ build_logs: List[Log] = []
301
+ bridge_logs: List[Log] = []
302
+ run_request(
303
+ stub,
304
+ request,
305
+ user_logs=user_logs,
306
+ build_logs=build_logs,
307
+ bridge_logs=bridge_logs,
308
+ stream_logs=False,
309
+ )
310
+
311
+ assert len(user_logs) == 0
312
+ assert len(build_logs) == 0
313
+ assert len(bridge_logs) == 0
314
+
315
+
275
316
  def test_unknown_environment(stub: definitions.IsolateStub, monkeypatch: Any) -> None:
276
317
  inherit_from_local(monkeypatch)
277
318
 
@@ -469,7 +510,7 @@ def test_bridge_connection_reuse(
469
510
  assert fourth_process_pid == third_process_pid
470
511
 
471
512
 
472
- @pytest.mark.flaky(reruns=3)
513
+ @pytest.mark.flaky(max_runs=3)
473
514
  def test_bridge_connection_reuse_logs(
474
515
  stub: definitions.IsolateStub, monkeypatch: Any
475
516
  ) -> None:
@@ -514,7 +555,7 @@ def print_logs_no_delay(num_lines, should_flush):
514
555
 
515
556
  @pytest.mark.parametrize("num_lines", [0, 1, 10, 100, 1000])
516
557
  @pytest.mark.parametrize("should_flush", [True, False])
517
- @pytest.mark.flaky(reruns=3)
558
+ @pytest.mark.flaky(max_runs=5)
518
559
  def test_receive_complete_logs(
519
560
  stub: definitions.IsolateStub,
520
561
  monkeypatch: Any,
@@ -1,29 +0,0 @@
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
- )
@@ -1,56 +0,0 @@
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\"R\n\rSubmitRequest\x12 \n\x08\x66unction\x18\x01 \x01(\x0b\x32\x0e.BoundFunction\x12\x1f\n\x08metadata\x18\x02 \x01(\x0b\x32\r.TaskMetadata\"{\n\x0cTaskMetadata\x12\x36\n\rlogger_labels\x18\x01 \x03(\x0b\x32\x1f.TaskMetadata.LoggerLabelsEntry\x1a\x33\n\x11LoggerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"!\n\x0eSubmitResponse\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"F\n\x12SetMetadataRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\x12\x1f\n\x08metadata\x18\x02 \x01(\x0b\x32\r.TaskMetadata\"\x15\n\x13SetMetadataResponse\"\r\n\x0bListRequest\"\x1b\n\x08TaskInfo\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"(\n\x0cListResponse\x12\x18\n\x05tasks\x18\x01 \x03(\x0b\x32\t.TaskInfo\" \n\rCancelRequest\x12\x0f\n\x07task_id\x18\x01 \x01(\t\"\x10\n\x0e\x43\x61ncelResponse2\xf4\x01\n\x07Isolate\x12,\n\x03Run\x12\x0e.BoundFunction\x1a\x11.PartialRunResult\"\x00\x30\x01\x12+\n\x06Submit\x12\x0e.SubmitRequest\x1a\x0f.SubmitResponse\"\x00\x12:\n\x0bSetMetadata\x12\x13.SetMetadataRequest\x1a\x14.SetMetadataResponse\"\x00\x12%\n\x04List\x12\x0c.ListRequest\x1a\r.ListResponse\"\x00\x12+\n\x06\x43\x61ncel\x12\x0e.CancelRequest\x1a\x0f.CancelResponse\"\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['_TASKMETADATA_LOGGERLABELSENTRY']._loaded_options = None
27
- _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_options = b'8\001'
28
- _globals['_BOUNDFUNCTION']._serialized_start=61
29
- _globals['_BOUNDFUNCTION']._serialized_end=218
30
- _globals['_ENVIRONMENTDEFINITION']._serialized_start=220
31
- _globals['_ENVIRONMENTDEFINITION']._serialized_end=320
32
- _globals['_SUBMITREQUEST']._serialized_start=322
33
- _globals['_SUBMITREQUEST']._serialized_end=404
34
- _globals['_TASKMETADATA']._serialized_start=406
35
- _globals['_TASKMETADATA']._serialized_end=529
36
- _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_start=478
37
- _globals['_TASKMETADATA_LOGGERLABELSENTRY']._serialized_end=529
38
- _globals['_SUBMITRESPONSE']._serialized_start=531
39
- _globals['_SUBMITRESPONSE']._serialized_end=564
40
- _globals['_SETMETADATAREQUEST']._serialized_start=566
41
- _globals['_SETMETADATAREQUEST']._serialized_end=636
42
- _globals['_SETMETADATARESPONSE']._serialized_start=638
43
- _globals['_SETMETADATARESPONSE']._serialized_end=659
44
- _globals['_LISTREQUEST']._serialized_start=661
45
- _globals['_LISTREQUEST']._serialized_end=674
46
- _globals['_TASKINFO']._serialized_start=676
47
- _globals['_TASKINFO']._serialized_end=703
48
- _globals['_LISTRESPONSE']._serialized_start=705
49
- _globals['_LISTRESPONSE']._serialized_end=745
50
- _globals['_CANCELREQUEST']._serialized_start=747
51
- _globals['_CANCELREQUEST']._serialized_end=779
52
- _globals['_CANCELRESPONSE']._serialized_start=781
53
- _globals['_CANCELRESPONSE']._serialized_end=797
54
- _globals['_ISOLATE']._serialized_start=800
55
- _globals['_ISOLATE']._serialized_end=1044
56
- # @@protoc_insertion_point(module_scope)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes