dbos 0.25.0a16__py3-none-any.whl → 0.25.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.
dbos/_context.py CHANGED
@@ -195,8 +195,10 @@ class DBOSContext:
195
195
  def end_handler(self, exc_value: Optional[BaseException]) -> None:
196
196
  self._end_span(exc_value)
197
197
 
198
- def get_current_span(self) -> Span:
199
- return self.spans[-1]
198
+ def get_current_span(self) -> Optional[Span]:
199
+ if len(self.spans):
200
+ return self.spans[-1]
201
+ return None
200
202
 
201
203
  def _start_span(self, attributes: TracedAttributes) -> None:
202
204
  attributes["operationUUID"] = (
dbos/_core.py CHANGED
@@ -892,10 +892,12 @@ def decorate_transaction(
892
892
  except DBAPIError as dbapi_error:
893
893
  if dbapi_error.orig.sqlstate == "40001": # type: ignore
894
894
  # Retry on serialization failure
895
- ctx.get_current_span().add_event(
896
- "Transaction Serialization Failure",
897
- {"retry_wait_seconds": retry_wait_seconds},
898
- )
895
+ span = ctx.get_current_span()
896
+ if span:
897
+ span.add_event(
898
+ "Transaction Serialization Failure",
899
+ {"retry_wait_seconds": retry_wait_seconds},
900
+ )
899
901
  time.sleep(retry_wait_seconds)
900
902
  retry_wait_seconds = min(
901
903
  retry_wait_seconds * backoff_factor,
@@ -1004,13 +1006,15 @@ def decorate_step(
1004
1006
  f"Step being automatically retried. (attempt {attempt + 1} of {attempts}). {traceback.format_exc()}"
1005
1007
  )
1006
1008
  ctx = assert_current_dbos_context()
1007
- ctx.get_current_span().add_event(
1008
- f"Step attempt {attempt} failed",
1009
- {
1010
- "error": str(error),
1011
- "retryIntervalSeconds": interval_seconds,
1012
- },
1013
- )
1009
+ span = ctx.get_current_span()
1010
+ if span:
1011
+ span.add_event(
1012
+ f"Step attempt {attempt} failed",
1013
+ {
1014
+ "error": str(error),
1015
+ "retryIntervalSeconds": interval_seconds,
1016
+ },
1017
+ )
1014
1018
  return min(
1015
1019
  interval_seconds * (backoff_rate**attempt),
1016
1020
  max_retry_interval_seconds,
dbos/_dbos.py CHANGED
@@ -1083,7 +1083,9 @@ class DBOS:
1083
1083
  def span(cls) -> Span:
1084
1084
  """Return the tracing `Span` associated with the current context."""
1085
1085
  ctx = assert_current_dbos_context()
1086
- return ctx.get_current_span()
1086
+ span = ctx.get_current_span()
1087
+ assert span
1088
+ return span
1087
1089
 
1088
1090
  @classproperty
1089
1091
  def request(cls) -> Optional["Request"]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.25.0a16
3
+ Version: 0.25.1
4
4
  Summary: Ultra-lightweight durable execution in Python
5
5
  Author-Email: "DBOS, Inc." <contact@dbos.dev>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- dbos-0.25.0a16.dist-info/METADATA,sha256=D0y5Vi7WtgVlpaBzrj3JhirxVna3o-zhQQiOu_Kb1Mc,5554
2
- dbos-0.25.0a16.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.25.0a16.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.25.0a16.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.25.1.dist-info/METADATA,sha256=3GVbyRFGPrczQCJ_F7f4y678bsTfeQ7c5gyLMBfbFFw,5551
2
+ dbos-0.25.1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dbos-0.25.1.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.25.1.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=3NQfGlBiiUSM_v88STdVP3rNZvGkUL_9WbSotKb8Voo,873
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=FLUacm9WGIPjB5s3QhdpMCilc8JHJOF0KMNStF82qs0,6625
@@ -13,11 +13,11 @@ dbos/_cloudutils/cloudutils.py,sha256=YC7jGsIopT0KveLsqbRpQk2KlRBk-nIRC_UCgep4f3
13
13
  dbos/_cloudutils/databases.py,sha256=_shqaqSvhY4n2ScgQ8IP5PDZvzvcx3YBKV8fj-cxhSY,8543
14
14
  dbos/_conductor/conductor.py,sha256=7elKINsgl4s1Tg5DwrU-K7xQ5vQvmDAIfAvUgfwpGN0,16784
15
15
  dbos/_conductor/protocol.py,sha256=xN7pmooyF1pqbH1b6WhllU5718P7zSb_b0KCwA6bzcs,6716
16
- dbos/_context.py,sha256=3He4w46OTFbR7h8U1MLcdaU10wNyIPBSRqzLkdggv7U,19368
17
- dbos/_core.py,sha256=kIj_4wlIff8ptlACJKXAPSNoyJIt2h44swjMKxfwv0k,45789
16
+ dbos/_context.py,sha256=I8sLkdKTTkZEz7wG-MjynaQB6XEF2bLXuwNksiauP7w,19430
17
+ dbos/_core.py,sha256=gNkoocDKjycgUD9HxRL8bktCPe98kyBFefD8_-dHUBs,45971
18
18
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
19
19
  dbos/_db_wizard.py,sha256=VnMa6OL87Lc-XPDD1RnXp8NjsJE8YgiQLj3wtWAXp-8,8252
20
- dbos/_dbos.py,sha256=AKfB61vvz5shPoEpKxqrqoiDemintKMqyBxhESRRJE8,45231
20
+ dbos/_dbos.py,sha256=RSSgUYc1m84g1bRFXheePLeqSXO0jM-A-72UGVzIGIg,45271
21
21
  dbos/_dbos_config.py,sha256=7Qm3FARP3lTKZS0gSxDHLbpaDCT30GzfyERxfCde4bc,21566
22
22
  dbos/_debug.py,sha256=mmgvLkqlrljMBBow9wk01PPur9kUf2rI_11dTJXY4gw,1822
23
23
  dbos/_error.py,sha256=B6Y9XLS1f6yrawxB2uAEYFMxFwk9BHhdxPNddKco-Fw,5399
@@ -67,4 +67,4 @@ dbos/cli/cli.py,sha256=G55sZJxfmvUGvWr0hoIWwVZBy-fJdpCsTsZmuHT1CjA,16049
67
67
  dbos/dbos-config.schema.json,sha256=HtF_njVTGHLdzBGZ4OrGQz3qbPPT0Go-iwd1PgFVTNg,5847
68
68
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
69
69
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
70
- dbos-0.25.0a16.dist-info/RECORD,,
70
+ dbos-0.25.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: pdm-backend (2.4.3)
2
+ Generator: pdm-backend (2.4.4)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any