dbos 0.23.0a11__py3-none-any.whl → 0.23.0a12__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/_recovery.py CHANGED
@@ -14,6 +14,16 @@ if TYPE_CHECKING:
14
14
  from ._dbos import DBOS, WorkflowHandle
15
15
 
16
16
 
17
+ def _recover_workflow(
18
+ dbos: "DBOS", workflow: GetPendingWorkflowsOutput
19
+ ) -> "WorkflowHandle[Any]":
20
+ if workflow.queue_name and workflow.queue_name != "_dbos_internal_queue":
21
+ cleared = dbos._sys_db.clear_queue_assignment(workflow.workflow_uuid)
22
+ if cleared:
23
+ return dbos.retrieve_workflow(workflow.workflow_uuid)
24
+ return execute_workflow_by_id(dbos, workflow.workflow_uuid)
25
+
26
+
17
27
  def startup_recovery_thread(
18
28
  dbos: "DBOS", pending_workflows: List[GetPendingWorkflowsOutput]
19
29
  ) -> None:
@@ -23,14 +33,7 @@ def startup_recovery_thread(
23
33
  while not stop_event.is_set() and len(pending_workflows) > 0:
24
34
  try:
25
35
  for pending_workflow in list(pending_workflows):
26
- if (
27
- pending_workflow.queue_name
28
- and pending_workflow.queue_name != "_dbos_internal_queue"
29
- ):
30
- cleared = dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
31
- if cleared:
32
- continue
33
- execute_workflow_by_id(dbos, pending_workflow.workflow_uuid)
36
+ _recover_workflow(dbos, pending_workflow)
34
37
  pending_workflows.remove(pending_workflow)
35
38
  except DBOSWorkflowFunctionNotFoundError:
36
39
  time.sleep(1)
@@ -51,26 +54,14 @@ def recover_pending_workflows(
51
54
  executor_id, GlobalParams.app_version
52
55
  )
53
56
  for pending_workflow in pending_workflows:
54
- if (
55
- pending_workflow.queue_name
56
- and pending_workflow.queue_name != "_dbos_internal_queue"
57
- ):
58
- try:
59
- cleared = dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
60
- if cleared:
61
- workflow_handles.append(
62
- dbos.retrieve_workflow(pending_workflow.workflow_uuid)
63
- )
64
- else:
65
- workflow_handles.append(
66
- execute_workflow_by_id(dbos, pending_workflow.workflow_uuid)
67
- )
68
- except Exception as e:
69
- dbos.logger.error(e)
70
- else:
71
- workflow_handles.append(
72
- execute_workflow_by_id(dbos, pending_workflow.workflow_uuid)
57
+ try:
58
+ handle = _recover_workflow(dbos, pending_workflow)
59
+ workflow_handles.append(handle)
60
+ except Exception as e:
61
+ dbos.logger.error(
62
+ f"Exception encountered when recovering workflows: {traceback.format_exc()}"
73
63
  )
64
+ raise e
74
65
  dbos.logger.info(
75
66
  f"Recovering {len(pending_workflows)} workflows for executor {executor_id} from version {GlobalParams.app_version}"
76
67
  )
dbos/_sys_db.py CHANGED
@@ -1462,7 +1462,6 @@ class SystemDatabase:
1462
1462
  .values(completed_at_epoch_ms=int(time.time() * 1000))
1463
1463
  )
1464
1464
 
1465
-
1466
1465
  def clear_queue_assignment(self, workflow_id: str) -> bool:
1467
1466
  if self._debug_mode:
1468
1467
  raise Exception("called clear_queue_assignment in debug mode")
@@ -1483,7 +1482,9 @@ class SystemDatabase:
1483
1482
  res = conn.execute(
1484
1483
  sa.update(SystemSchema.workflow_status)
1485
1484
  .where(SystemSchema.workflow_status.c.workflow_uuid == workflow_id)
1486
- .values(executor_id=None, status=WorkflowStatusString.ENQUEUED.value)
1485
+ .values(
1486
+ executor_id=None, status=WorkflowStatusString.ENQUEUED.value
1487
+ )
1487
1488
  )
1488
1489
  if res.rowcount == 0:
1489
1490
  # This should never happen
@@ -1492,6 +1493,7 @@ class SystemDatabase:
1492
1493
  )
1493
1494
  return True
1494
1495
 
1496
+
1495
1497
  def reset_system_database(config: ConfigFile) -> None:
1496
1498
  sysdb_name = (
1497
1499
  config["database"]["sys_db_name"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.23.0a11
3
+ Version: 0.23.0a12
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.23.0a11.dist-info/METADATA,sha256=pm213i_FtTxsXr1cfO0_iP5bcU0E60Dzmq9GWXYtFMQ,5556
2
- dbos-0.23.0a11.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.23.0a11.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.23.0a11.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.23.0a12.dist-info/METADATA,sha256=vaytGbqIq4czcptlNoggkKmYz6LWFxDuysPkAZ0o4M0,5556
2
+ dbos-0.23.0a12.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ dbos-0.23.0a12.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.23.0a12.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=CxRHBHEthPL4PZoLbZhp3rdm44-KkRTT2-7DkK9d4QQ,724
6
6
  dbos/__main__.py,sha256=P7jAr-7L9XE5mrsQ7i4b-bLr2ap1tCQfhMByLCRWDj0,568
7
7
  dbos/_admin_server.py,sha256=YiVn5lywz2Vg8_juyNHOYl0HVEy48--7b4phwK7r92o,5732
@@ -36,7 +36,7 @@ dbos/_migrations/versions/d76646551a6c_workflow_queue.py,sha256=G942nophZ2uC2vc4
36
36
  dbos/_migrations/versions/eab0cc1d9a14_job_queue.py,sha256=uvhFOtqbBreCePhAxZfIT0qCAI7BiZTou9wt6QnbY7c,1412
37
37
  dbos/_outcome.py,sha256=FDMgWVjZ06vm9xO-38H17mTqBImUYQxgKs_bDCSIAhE,6648
38
38
  dbos/_queue.py,sha256=I2gBc7zQ4G0vyDDBnKwIFzxtqfD7DxHO2IZ41brFSOM,2927
39
- dbos/_recovery.py,sha256=QIi0xQToYOpUlAzwTsuDonsWbGrI9HZBR2qVyOS2IJU,3077
39
+ dbos/_recovery.py,sha256=4KyZb0XJEUGH7ekYT1kpx38i6y5vygPeH75Ta7RZjYo,2596
40
40
  dbos/_registrations.py,sha256=_zy6k944Ll8QwqU12Kr3OP23ukVtm8axPNN1TS_kJRc,6717
41
41
  dbos/_request.py,sha256=cX1B3Atlh160phgS35gF1VEEV4pD126c9F3BDgBmxZU,929
42
42
  dbos/_roles.py,sha256=iOsgmIAf1XVzxs3gYWdGRe1B880YfOw5fpU7Jwx8_A8,2271
@@ -45,7 +45,7 @@ dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
45
  dbos/_schemas/application_database.py,sha256=KeyoPrF7hy_ODXV7QNike_VFSD74QBRfQ76D7QyE9HI,966
46
46
  dbos/_schemas/system_database.py,sha256=rwp4EvCSaXcUoMaRczZCvETCxGp72k3-hvLyGUDkih0,5163
47
47
  dbos/_serialization.py,sha256=YCYv0qKAwAZ1djZisBC7khvKqG-5OcIv9t9EC5PFIog,1743
48
- dbos/_sys_db.py,sha256=nJVosEwdc_mkP9cJQb0uFpOOLOX8KxkOs-pij0vu83c,64467
48
+ dbos/_sys_db.py,sha256=05kxY9YY9iUZ1jQmfpymJuZS8Oi69ju_mF_M6lJi8qU,64513
49
49
  dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
50
50
  dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  dbos/_templates/dbos-db-starter/__package/main.py,sha256=eI0SS9Nwj-fldtiuSzIlIG6dC91GXXwdRsoHxv6S_WI,2719
@@ -65,4 +65,4 @@ dbos/cli/cli.py,sha256=ThomRytw7EP5iOcrjEgwnpaWgXNTLfnFEBBvCGHxtJs,15590
65
65
  dbos/dbos-config.schema.json,sha256=X5TpXNcARGceX0zQs0fVgtZW_Xj9uBbY5afPt9Rz9yk,5741
66
66
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
67
67
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
68
- dbos-0.23.0a11.dist-info/RECORD,,
68
+ dbos-0.23.0a12.dist-info/RECORD,,