isolate 0.14.1__py3-none-any.whl → 0.14.3__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.

@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.14.1'
16
- __version_tuple__ = version_tuple = (0, 14, 1)
15
+ __version__ = version = '0.14.3'
16
+ __version_tuple__ = version_tuple = (0, 14, 3)
@@ -117,6 +117,7 @@ def _io_observer(
117
117
  return # Nothing to read
118
118
 
119
119
  for line in raw_data.splitlines():
120
+ # TODO: parse the lines to include `extra={...}` added by the logger?
120
121
  hook(line)
121
122
 
122
123
  def _reader():
isolate/logger.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  import os
3
+ from datetime import datetime, timezone
3
4
  from typing import Dict
4
5
 
5
6
  from isolate.logs import LogLevel, LogSource
@@ -9,15 +10,21 @@ from isolate.logs import LogLevel, LogSource
9
10
  # but it handling `source` would be not trivial, so we are better off
10
11
  # just keeping it simple for now.
11
12
  class IsolateLogger:
13
+ extra_labels: Dict[str, str] = {}
14
+
12
15
  def __init__(self, log_labels: Dict[str, str]):
13
16
  self.log_labels = log_labels
14
17
 
15
18
  def log(self, level: LogLevel, message: str, source: LogSource) -> None:
16
19
  record = {
20
+ # Set the timestamp from source so we can be sure no buffering or
21
+ # latency is affecting the timestamp.
22
+ "logged_at": datetime.now(tz=timezone.utc).isoformat(),
17
23
  "isolate_source": source.name,
18
24
  "level": level.name,
19
25
  "message": message,
20
26
  **self.log_labels,
27
+ **self.extra_labels,
21
28
  }
22
29
  print(json.dumps(record))
23
30
 
isolate/server/server.py CHANGED
@@ -367,9 +367,7 @@ class IsolateServicer(definitions.IsolateServicer):
367
367
 
368
368
  task = self.background_tasks[request.task_id]
369
369
 
370
- task.logger = IsolateLogger.with_env_expanded(
371
- dict(request.metadata.logger_labels)
372
- )
370
+ task.logger.extra_labels = dict(request.metadata.logger_labels)
373
371
 
374
372
  return definitions.SetMetadataResponse()
375
373
 
@@ -379,13 +377,19 @@ class IsolateServicer(definitions.IsolateServicer):
379
377
  context: ServicerContext,
380
378
  ) -> Iterator[definitions.PartialRunResult]:
381
379
  try:
382
- yield from self._run_task(RunTask(request=request))
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
+ task = RunTask(request=request)
383
+ self.background_tasks["RUN"] = task
384
+ yield from self._run_task(task)
383
385
  except GRPCException as exc:
384
386
  return self.abort_with_msg(
385
387
  exc.message,
386
388
  context,
387
389
  code=exc.code,
388
390
  )
391
+ finally:
392
+ self.background_tasks.pop("RUN", None)
389
393
 
390
394
  def List(
391
395
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isolate
3
- Version: 0.14.1
3
+ Version: 0.14.3
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
@@ -1,13 +1,13 @@
1
1
  isolate/__init__.py,sha256=uXOKnONs7sXgARNgElwr4_A1sKoA6ACHVEvs3IDiX1M,127
2
- isolate/_isolate_version.py,sha256=2Ctgubb5b_lxFG2ixV07ZYKw5eto45wRlKsBIObkGsg,413
2
+ isolate/_isolate_version.py,sha256=3mnQHEW9gizHocB0ULApMUw7E4CZd4qai5GsjMH_Vo4,413
3
3
  isolate/_version.py,sha256=05pXvy-yr5t3I1m9JMn42Ilzpg7fa8IB2J8a3G7t1cU,274
4
- isolate/logger.py,sha256=d9mZyTOtplMZeQSNgRNiXhOPwJ0be2B1nGGaQx09C3g,1450
4
+ isolate/logger.py,sha256=Z4a03kjFg54H3RDVVp4nQeut0xlxq0PIbbEczCT9ImU,1758
5
5
  isolate/logs.py,sha256=R_AHUVYD18z_PhtK_mDWi9Gch79CxmwHY09hUDShtwg,2079
6
6
  isolate/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  isolate/registry.py,sha256=hpzv4HI7iihG5I7i5r8Pb257ibhEKY18xQcG-w1-BgI,1590
8
8
  isolate/backends/__init__.py,sha256=LLrSM7UnDFW8tIT5oYlE1wVJrxKcaj_v7cFwvTjQTlc,119
9
9
  isolate/backends/_base.py,sha256=Kt5pkhDzXZblq4vxaM3DQTo-Bj-7pIRZFlqJR7OfejY,4112
10
- isolate/backends/common.py,sha256=Zx0HXnBX_jlOLpFNJzY4ue8NcW-kktqo_WZOJmPSjvI,8481
10
+ isolate/backends/common.py,sha256=GzmgzIkCY90elMH_7lpj-LwRNu-GLia2j4PrS6zNHwA,8567
11
11
  isolate/backends/conda.py,sha256=S5q5bdY787AMTck2iMGtwu-LHMH4a1qCIjNHDKTkqok,7649
12
12
  isolate/backends/container.py,sha256=MCQJbcmQvRUS-tTgTW_pKYBMKwSJO2KZsLeaBMXpPC0,1645
13
13
  isolate/backends/local.py,sha256=woxe4dmXuEHxWKsGNndoRA1_sP6yG-dg6tlFZni0mZc,1360
@@ -42,7 +42,7 @@ isolate/connections/ipc/agent.py,sha256=hGlL4x78FhRvMZ4DkVh3dk-EmWQqxHW4LIipgyOk
42
42
  isolate/server/__init__.py,sha256=7R3GuWmxuqe0q28rVqETJN9OCrP_-Svjv9h0NR1GFL0,79
43
43
  isolate/server/health_server.py,sha256=yN7F1Q28DdX8-Zk3gef7XcQEE25XwlHwzV5GBM75aQM,1249
44
44
  isolate/server/interface.py,sha256=nGbjdxrN0p9m1LNdeds8NIoJOwPYW2NM6ktmbhfG4_s,687
45
- isolate/server/server.py,sha256=q0g0dL8hOosogGWpZMpXOOohTV55itp6f4K5yenvtBg,23233
45
+ isolate/server/server.py,sha256=41Y_3dtUmeJR8RuQF2VMC5x_kM_k0w1hyzPFl5uW5Do,23477
46
46
  isolate/server/definitions/__init__.py,sha256=f_Q3pdjMuZrjgNlbM60btFKiB1Vg8cnVyKEbp0RmU0A,572
47
47
  isolate/server/definitions/server.proto,sha256=UihlFbYG8fbwm0IUfKDRH1vNkopzP3C-wplXXcAO1c8,1761
48
48
  isolate/server/definitions/server_pb2.py,sha256=TYBJC_z_dNf2J6FgHukY9mDyc3WBt9EPQOVFd_ayQNc,4304
@@ -53,9 +53,9 @@ isolate/server/health/health.proto,sha256=wE2_QD0OQAblKkEBG7sALLXEOj1mOLKG-FbC4t
53
53
  isolate/server/health/health_pb2.py,sha256=onOdP3M4Tpqhqs2PlGcyfoKe2VVKUEDx5ALeRcObb9A,1899
54
54
  isolate/server/health/health_pb2.pyi,sha256=AK-DPCpJzoYhU6DydD856c0Ywx84x6k-Cs4m6HpNv5A,2459
55
55
  isolate/server/health/health_pb2_grpc.py,sha256=XgsULrnRBmYIqvKr8eI7bqs6NIea5A0kkqdOOc2JHBY,5303
56
- isolate-0.14.1.dist-info/LICENSE,sha256=427vuyirL5scgBLqA9UWcdnxKrtSGc0u_JfUupk6lAA,11359
57
- isolate-0.14.1.dist-info/METADATA,sha256=_B69rNK-IJtBqsUjNwPXijhI_uLVcBTSLJ3jcbfl8Dk,3191
58
- isolate-0.14.1.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
59
- isolate-0.14.1.dist-info/entry_points.txt,sha256=s3prh2EERaVCbL8R45tfY5WFPZ1TsYOsz305YR7s-Pc,360
60
- isolate-0.14.1.dist-info/top_level.txt,sha256=W9QJBHcq5WXRkbOXf25bvftzFsOZZN4n1DAatdroZrs,8
61
- isolate-0.14.1.dist-info/RECORD,,
56
+ isolate-0.14.3.dist-info/LICENSE,sha256=427vuyirL5scgBLqA9UWcdnxKrtSGc0u_JfUupk6lAA,11359
57
+ isolate-0.14.3.dist-info/METADATA,sha256=LxlsStQM06vUMmDzW2XsnmdrVvm1mgPgBslNnC22W4Q,3191
58
+ isolate-0.14.3.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
59
+ isolate-0.14.3.dist-info/entry_points.txt,sha256=s3prh2EERaVCbL8R45tfY5WFPZ1TsYOsz305YR7s-Pc,360
60
+ isolate-0.14.3.dist-info/top_level.txt,sha256=W9QJBHcq5WXRkbOXf25bvftzFsOZZN4n1DAatdroZrs,8
61
+ isolate-0.14.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5