dbos 1.8.0a8__py3-none-any.whl → 1.9.0a1__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 dbos might be problematic. Click here for more details.

dbos/_dbos.py CHANGED
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import asyncio
4
- import atexit
5
4
  import hashlib
6
5
  import inspect
7
6
  import os
@@ -1219,39 +1218,40 @@ class DBOS:
1219
1218
  return rv
1220
1219
 
1221
1220
  @classproperty
1222
- def workflow_id(cls) -> str:
1223
- """Return the workflow ID for the current context, which must be executing a workflow function."""
1224
- ctx = assert_current_dbos_context()
1225
- assert (
1226
- ctx.is_within_workflow()
1227
- ), "workflow_id is only available within a DBOS operation."
1228
- return ctx.workflow_id
1221
+ def workflow_id(cls) -> Optional[str]:
1222
+ """Return the ID of the currently executing workflow. If a workflow is not executing, return None."""
1223
+ ctx = get_local_dbos_context()
1224
+ if ctx and ctx.is_within_workflow():
1225
+ return ctx.workflow_id
1226
+ else:
1227
+ return None
1229
1228
 
1230
1229
  @classproperty
1231
- def step_id(cls) -> int:
1232
- """Return the step ID for the currently executing step. This is a unique identifier of the current step within the workflow."""
1233
- ctx = assert_current_dbos_context()
1234
- assert (
1235
- ctx.is_step() or ctx.is_transaction()
1236
- ), "step_id is only available within a DBOS step."
1237
- return ctx.function_id
1230
+ def step_id(cls) -> Optional[int]:
1231
+ """Return the step ID for the currently executing step. This is a unique identifier of the current step within the workflow. If a step is not currently executing, return None."""
1232
+ ctx = get_local_dbos_context()
1233
+ if ctx and (ctx.is_step() or ctx.is_transaction()):
1234
+ return ctx.function_id
1235
+ else:
1236
+ return None
1238
1237
 
1239
1238
  @classproperty
1240
- def step_status(cls) -> StepStatus:
1241
- """Return the status of the currently executing step."""
1242
- ctx = assert_current_dbos_context()
1243
- assert ctx.is_step(), "step_status is only available within a DBOS step."
1244
- assert ctx.step_status is not None
1245
- return ctx.step_status
1239
+ def step_status(cls) -> Optional[StepStatus]:
1240
+ """Return the status of the currently executing step. If a step is not currently executing, return None."""
1241
+ ctx = get_local_dbos_context()
1242
+ if ctx and ctx.is_step():
1243
+ return ctx.step_status
1244
+ else:
1245
+ return None
1246
1246
 
1247
1247
  @classproperty
1248
1248
  def parent_workflow_id(cls) -> str:
1249
1249
  """
1250
- Return the workflow ID for the parent workflow.
1251
-
1252
- `parent_workflow_id` must be accessed from within a workflow function.
1250
+ This method is deprecated and should not be used.
1253
1251
  """
1254
-
1252
+ dbos_logger.warning(
1253
+ "DBOS.parent_workflow_id is deprecated and should not be used"
1254
+ )
1255
1255
  ctx = assert_current_dbos_context()
1256
1256
  assert (
1257
1257
  ctx.is_within_workflow()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 1.8.0a8
3
+ Version: 1.9.0a1
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-1.8.0a8.dist-info/METADATA,sha256=NWaYUntLK64Oxmj4BnGPZNHZuQHtMtk4LfDMk_xRZ3U,13267
2
- dbos-1.8.0a8.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
- dbos-1.8.0a8.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-1.8.0a8.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-1.9.0a1.dist-info/METADATA,sha256=lm_ZZF0bWGuy1sNS_bqk5-XzNFqVlk83gpNvH5F2CMU,13267
2
+ dbos-1.9.0a1.dist-info/WHEEL,sha256=9P2ygRxDrTJz3gsagc0Z96ukrxjr-LFBGOgv3AuKlCA,90
3
+ dbos-1.9.0a1.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-1.9.0a1.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=NssPCubaBxdiKarOWa-wViz1hdJSkmBGcpLX_gQ4NeA,891
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=e8ELhcDWqR3_PNobnNgUvLGh5lzZq0yFSF6dvtzoQRI,16267
@@ -13,7 +13,7 @@ dbos/_conductor/protocol.py,sha256=q3rgLxINFtWFigdOONc-4gX4vn66UmMlJQD6Kj8LnL4,7
13
13
  dbos/_context.py,sha256=0vFtLAk3WF5BQYIYNFImDRBppKO2CTKOSy51zQC-Cu8,25723
14
14
  dbos/_core.py,sha256=kRY2PXVryfpwjbOCmgzPA_-qNsFmRMLi-CxYCnyp1V8,49495
15
15
  dbos/_croniter.py,sha256=XHAyUyibs_59sJQfSNWkP7rqQY6_XrlfuuCxk4jYqek,47559
16
- dbos/_dbos.py,sha256=ByU8F1ueT2WTjT9SW518FfRL300kpK_6y8n7WWSwtOQ,50869
16
+ dbos/_dbos.py,sha256=LqE8ej317diZ5JjrXhndLwDr40E1Aw3SK1YPxC8-t3k,50902
17
17
  dbos/_dbos_config.py,sha256=TWIbGCWl_8o3l0Y2IzrL1q9mTYl_vVeZDjYJMDXCPVU,21676
18
18
  dbos/_debug.py,sha256=99j2SChWmCPAlZoDmjsJGe77tpU2LEa8E2TtLAnnh7o,1831
19
19
  dbos/_docker_pg_helper.py,sha256=tLJXWqZ4S-ExcaPnxg_i6cVxL6ZxrYlZjaGsklY-s2I,6115
@@ -69,4 +69,4 @@ dbos/cli/cli.py,sha256=TwiaWr5zZrXOyhgv7OgkWzVA3y8znCj2L6i0sb91--0,22122
69
69
  dbos/dbos-config.schema.json,sha256=CjaspeYmOkx6Ip_pcxtmfXJTn_YGdSx_0pcPBF7KZmo,6060
70
70
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
71
71
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
72
- dbos-1.8.0a8.dist-info/RECORD,,
72
+ dbos-1.9.0a1.dist-info/RECORD,,
File without changes