isolate 0.12.0__py3-none-any.whl → 0.12.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/backends/conda.py CHANGED
@@ -42,6 +42,7 @@ class CondaEnvironment(BaseEnvironment[Path]):
42
42
 
43
43
  environment_definition: Dict[str, Any] = field(default_factory=dict)
44
44
  python_version: Optional[str] = None
45
+ tags: List[str] = field(default_factory=list)
45
46
 
46
47
  @classmethod
47
48
  def from_config(
@@ -106,7 +107,11 @@ class CondaEnvironment(BaseEnvironment[Path]):
106
107
 
107
108
  @property
108
109
  def key(self) -> str:
109
- return sha256_digest_of(repr(self.environment_definition))
110
+ return sha256_digest_of(
111
+ repr(self.environment_definition),
112
+ self.python_version,
113
+ *sorted(self.tags),
114
+ )
110
115
 
111
116
  def create(self, *, force: bool = False) -> Path:
112
117
  env_path = self.settings.cache_dir_for(self)
@@ -29,6 +29,7 @@ class VirtualPythonEnvironment(BaseEnvironment[Path]):
29
29
  constraints_file: Optional[os.PathLike] = None
30
30
  python_version: Optional[str] = None
31
31
  extra_index_urls: List[str] = field(default_factory=list)
32
+ tags: List[str] = field(default_factory=list)
32
33
 
33
34
  @classmethod
34
35
  def from_config(
@@ -54,6 +55,7 @@ class VirtualPythonEnvironment(BaseEnvironment[Path]):
54
55
  *self.requirements,
55
56
  *constraints,
56
57
  *self.extra_index_urls,
58
+ *sorted(self.tags),
57
59
  )
58
60
 
59
61
  def install_requirements(self, path: Path) -> None:
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import importlib
4
4
  import os
5
+ from dataclasses import dataclass
5
6
  from contextlib import contextmanager
6
7
  from typing import TYPE_CHECKING, Any, Iterator, Optional, cast
7
8
 
@@ -21,9 +22,12 @@ if TYPE_CHECKING:
21
22
  AGENT_SIGNATURE = "IS_ISOLATE_AGENT"
22
23
 
23
24
 
25
+ @dataclass
24
26
  class SerializationError(Exception):
25
27
  """An error that happened during the serialization process."""
26
28
 
29
+ message: str
30
+
27
31
 
28
32
  @contextmanager
29
33
  def _step(message: str) -> Iterator[None]:
@@ -142,14 +142,17 @@ class AgentServicer(definitions.AgentServicer):
142
142
  serialization_method: str,
143
143
  result: object,
144
144
  was_it_raised: bool,
145
- stringized_tb: str,
145
+ stringized_tb: str | None,
146
146
  ) -> Generator[definitions.PartialRunResult, None, Any]:
147
147
  try:
148
148
  definition = serialize_object(serialization_method, result)
149
149
  except SerializationError:
150
- yield from self.log(traceback.format_exc(), level=LogLevel.ERROR)
150
+ if stringized_tb:
151
+ yield from self.log(
152
+ stringized_tb, source=LogSource.USER, level=LogLevel.STDERR
153
+ )
151
154
  raise AbortException(
152
- "The result of the input function could not be serialized."
155
+ f"Error while serializing the execution result (object of type {type(result)})."
153
156
  )
154
157
  except BaseException:
155
158
  yield from self.log(traceback.format_exc(), level=LogLevel.ERROR)
isolate/server/server.py CHANGED
@@ -261,6 +261,17 @@ class IsolateServicer(definitions.IsolateServicer):
261
261
  # during the execution, and handle them accordingly.
262
262
  exception = future.exception(timeout=0.1)
263
263
  if exception is not None:
264
+ # If this is an RPC error, propagate it as is without any
265
+ # further processing.
266
+ if isinstance(exception, grpc.RpcError):
267
+ return self.abort_with_msg(
268
+ exception.details(),
269
+ context,
270
+ code=exception.code(),
271
+ )
272
+
273
+ # Otherwise this is a bug in the agent itself, so needs
274
+ # to be propagated with more details.
264
275
  for line in traceback.format_exception(
265
276
  type(exception), exception, exception.__traceback__
266
277
  ):
@@ -282,7 +293,8 @@ class IsolateServicer(definitions.IsolateServicer):
282
293
  self, queue: Queue, is_completed: Callable[[], bool]
283
294
  ) -> Iterator[definitions.PartialRunResult]:
284
295
  """Watch the given queue until the is_completed function returns True. Note that even
285
- if the function is completed, this function might not finish until the queue is empty."""
296
+ if the function is completed, this function might not finish until the queue is empty.
297
+ """
286
298
  while not is_completed():
287
299
  try:
288
300
  yield queue.get(timeout=_Q_WAIT_DELAY)
@@ -1,25 +1,26 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isolate
3
- Version: 0.12.0
3
+ Version: 0.12.1
4
4
  Summary: Managed isolated environments for Python
5
5
  Author: Features & Labels
6
6
  Author-email: hello@fal.ai
7
7
  Requires-Python: >=3.7,<4.0
8
8
  Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
9
  Classifier: Programming Language :: Python :: 3.7
11
10
  Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
13
14
  Provides-Extra: build
14
15
  Provides-Extra: grpc
15
16
  Provides-Extra: server
16
- Requires-Dist: PyYAML (>=6.0); extra == "build"
17
+ Requires-Dist: PyYAML (>=6.0) ; extra == "build"
17
18
  Requires-Dist: grpcio (>=1.49)
18
- Requires-Dist: importlib-metadata (>=4.4); python_version < "3.10"
19
+ Requires-Dist: importlib-metadata (>=4.4) ; python_version < "3.10"
19
20
  Requires-Dist: platformdirs
20
21
  Requires-Dist: protobuf
21
22
  Requires-Dist: tblib (>=1.7.0)
22
- Requires-Dist: virtualenv (>=20.4); extra == "build"
23
+ Requires-Dist: virtualenv (>=20.4) ; extra == "build"
23
24
  Description-Content-Type: text/markdown
24
25
 
25
26
  # Isolate
@@ -2,22 +2,22 @@ isolate/__init__.py,sha256=zTNX62myAQBEKk3BUQ9_-eYryNzEVPpuWRbqkVyCsCo,49
2
2
  isolate/backends/__init__.py,sha256=_Z92FgH02UYPlF5azuzb2MZUJcmSzLOO0Ry__VX2CWE,91
3
3
  isolate/backends/_base.py,sha256=WicmqNs1N5Tof4XAjveyt3FxR2qe-9ymE5J_B3-xqpY,4131
4
4
  isolate/backends/common.py,sha256=TR3sLs_AzWA70IMPHpInxHc9pAqVhNWgpqCJhMfiKKE,7779
5
- isolate/backends/conda.py,sha256=sqtwfSki7EkTfADWkXGjy995dm8x7fzir4DtpJ3C950,7117
5
+ isolate/backends/conda.py,sha256=Hvb9C6jMkvTqwdi_a7mWxwdnFqxCqBWPY-uMgSXLDU0,7255
6
6
  isolate/backends/local.py,sha256=n_RKUHsEEUo1oyLlRw0PzUAbwDC9qMjp9SvnDFeDFE0,1366
7
7
  isolate/backends/pyenv.py,sha256=AoWbphdZpxpoo704J2tS4l-gfzMrPcUD1gm1ORMhUek,5404
8
8
  isolate/backends/remote.py,sha256=2JA5RZISb4Qa_8a8aYnQrinpDZG89dtUnSRvJeTAx78,4208
9
9
  isolate/backends/settings.py,sha256=IT32xZuT3S2FbxfY1EdC6f0DbE0TKlhfPMWgoe4jBSI,3084
10
- isolate/backends/virtualenv.py,sha256=EJnjeUW3GvkIYX3FLJNmhNcVxDWJUBG0wXZ1oOpz-1o,5520
10
+ isolate/backends/virtualenv.py,sha256=M6p-E8P5I7ed_k3lfUPiPhnE3k02o1B9-N0XFkix5FE,5602
11
11
  isolate/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
12
  isolate/common/timestamp.py,sha256=seh7FrMRH4i1SCQavA8d-7z8qi0pP8lYYhd29gTPMwE,367
13
13
  isolate/connections/__init__.py,sha256=6BKY7P23ZZ2au0Efc2RO7Pt-kVqYF-Qprrz-rLIfyXc,722
14
14
  isolate/connections/_local/__init__.py,sha256=Zklry8jiqMw6-MTfS1L6pqmCCqRzOOGCyZgVLGRpDVY,118
15
15
  isolate/connections/_local/_base.py,sha256=2R5uenG-OAOOTmgVoADs7xoSCemwTlWsIpYRKVNYFu0,6251
16
16
  isolate/connections/_local/agent_startup.py,sha256=swCs6Q0yVkDw7w-RftizHSMyJDM7DQwuP3TB0qI1ucg,1552
17
- isolate/connections/common.py,sha256=gKvafqwZmGLhVbm-vlMJD2hOQUL7GJYOUwk3KTa0HMU,3475
17
+ isolate/connections/common.py,sha256=dZzQrDpECQgj8xTuqmkv62BY6QSSumwrM-hWlWHadyE,3538
18
18
  isolate/connections/grpc/__init__.py,sha256=jQ9oN8X2o64pm0lSwc1fin_45ZJkFe1-i5zq8PdX2CU,71
19
19
  isolate/connections/grpc/_base.py,sha256=f2OpaeEaHCTnLPA3jcWHYDLPEuqX14otPd82UT5hdz8,5529
20
- isolate/connections/grpc/agent.py,sha256=L4_WVcyIdFeMDZNPQhweoYKJ3nIdsUfIJgxlZW7qHf4,7677
20
+ isolate/connections/grpc/agent.py,sha256=KpAyt4p6glfiJaCJKElm3JT5uZcvHauNphabMYKIJek,7792
21
21
  isolate/connections/grpc/configuration.py,sha256=50YvGGHA9uyKg74xU_gc73j7bsFk973uIpMhmw2HhxY,788
22
22
  isolate/connections/grpc/definitions/__init__.py,sha256=-A4fhg-y-IuXTMsZsa8Eyg1V0mvctoh1s4Igv8Fexa0,389
23
23
  isolate/connections/grpc/definitions/agent.proto,sha256=Hx11hHc8PKwhWzyasViLeq7JL33KsRex2-iibfWruTw,568
@@ -47,8 +47,8 @@ isolate/server/health/health_pb2.pyi,sha256=boMRHMlX770EuccQCFTeRgf_KA_VMgW7l9GZ
47
47
  isolate/server/health/health_pb2_grpc.py,sha256=JRluct2W4af83OYxwmcCn0vRc78zf04Num0vBApuPEo,4005
48
48
  isolate/server/health_server.py,sha256=yN7F1Q28DdX8-Zk3gef7XcQEE25XwlHwzV5GBM75aQM,1249
49
49
  isolate/server/interface.py,sha256=nGbjdxrN0p9m1LNdeds8NIoJOwPYW2NM6ktmbhfG4_s,687
50
- isolate/server/server.py,sha256=bUxU_iohlBaBVYPvh-QDQOtEVAYCUP1IyeC9byzPuuY,12414
51
- isolate-0.12.0.dist-info/entry_points.txt,sha256=QXWwDC7bzMidCWvv7WrIKvlWneFKA21c3SDMVvgHpT4,281
52
- isolate-0.12.0.dist-info/WHEEL,sha256=DA86_h4QwwzGeRoz62o1svYt5kGEXpoUTuTtwzoTb30,83
53
- isolate-0.12.0.dist-info/METADATA,sha256=8Ou44xJde0uJqYKP1tww5O5xnTE0UCMNxA8iHDWvCBY,2771
54
- isolate-0.12.0.dist-info/RECORD,,
50
+ isolate/server/server.py,sha256=XemBO-cdWNquM3cW5Sh-uc5h_sLgipo-x4DExpAfEzs,12954
51
+ isolate-0.12.1.dist-info/METADATA,sha256=vXkwKv9COm7Ca-9oxB7qX7g_jvtdEIFcYM5OCKz72i8,2825
52
+ isolate-0.12.1.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
53
+ isolate-0.12.1.dist-info/entry_points.txt,sha256=QXWwDC7bzMidCWvv7WrIKvlWneFKA21c3SDMVvgHpT4,281
54
+ isolate-0.12.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry 1.0.8
2
+ Generator: poetry-core 1.5.2
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any