dbos 0.23.0a9__py3-none-any.whl → 0.23.0a10__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
@@ -27,8 +27,9 @@ def startup_recovery_thread(
27
27
  pending_workflow.queue_name
28
28
  and pending_workflow.queue_name != "_dbos_internal_queue"
29
29
  ):
30
- dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
31
- continue
30
+ cleared = dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
31
+ if cleared:
32
+ continue
32
33
  execute_workflow_by_id(dbos, pending_workflow.workflow_uuid)
33
34
  pending_workflows.remove(pending_workflow)
34
35
  except DBOSWorkflowFunctionNotFoundError:
@@ -56,10 +57,15 @@ def recover_pending_workflows(
56
57
  and pending_workflow.queue_name != "_dbos_internal_queue"
57
58
  ):
58
59
  try:
59
- dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
60
- workflow_handles.append(
61
- dbos.retrieve_workflow(pending_workflow.workflow_uuid)
62
- )
60
+ cleared = dbos._sys_db.clear_queue_assignment(pending_workflow.workflow_uuid)
61
+ if cleared:
62
+ workflow_handles.append(
63
+ dbos.retrieve_workflow(pending_workflow.workflow_uuid)
64
+ )
65
+ else:
66
+ workflow_handles.append(
67
+ execute_workflow_by_id(dbos, pending_workflow.workflow_uuid)
68
+ )
63
69
  except Exception as e:
64
70
  dbos.logger.error(e)
65
71
  else:
dbos/_sys_db.py CHANGED
@@ -1460,21 +1460,35 @@ class SystemDatabase:
1460
1460
  .values(completed_at_epoch_ms=int(time.time() * 1000))
1461
1461
  )
1462
1462
 
1463
- def clear_queue_assignment(self, workflow_id: str) -> None:
1463
+
1464
+ def clear_queue_assignment(self, workflow_id: str) -> bool:
1464
1465
  if self._debug_mode:
1465
1466
  raise Exception("called clear_queue_assignment in debug mode")
1466
- with self.engine.begin() as c:
1467
- c.execute(
1468
- sa.update(SystemSchema.workflow_queue)
1469
- .where(SystemSchema.workflow_queue.c.workflow_uuid == workflow_id)
1470
- .values(executor_id=None, started_at_epoch_ms=None)
1471
- )
1472
- c.execute(
1473
- sa.update(SystemSchema.workflow_status)
1474
- .where(SystemSchema.workflow_status.c.workflow_uuid == workflow_id)
1475
- .values(executor_id=None, status=WorkflowStatusString.ENQUEUED.value)
1476
- )
1477
1467
 
1468
+ with self.engine.connect() as conn:
1469
+ with conn.begin() as transaction:
1470
+ res = conn.execute(
1471
+ sa.update(SystemSchema.workflow_queue)
1472
+ .where(SystemSchema.workflow_queue.c.workflow_uuid == workflow_id)
1473
+ .values(executor_id=None, started_at_epoch_ms=None)
1474
+ )
1475
+
1476
+ # If no rows were affected, the workflow is not anymore in the queue
1477
+ if res.rowcount == 0:
1478
+ transaction.rollback()
1479
+ return False
1480
+
1481
+ res = conn.execute(
1482
+ sa.update(SystemSchema.workflow_status)
1483
+ .where(SystemSchema.workflow_status.c.workflow_uuid == workflow_id)
1484
+ .values(executor_id=None, status=WorkflowStatusString.ENQUEUED.value)
1485
+ )
1486
+ if res.rowcount == 0:
1487
+ # This should never happen
1488
+ raise Exception(
1489
+ f"UNREACHABLE: Workflow {workflow_id} is found in the workflow_queue table but not found in the workflow_status table"
1490
+ )
1491
+ return True
1478
1492
 
1479
1493
  def reset_system_database(config: ConfigFile) -> None:
1480
1494
  sysdb_name = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.23.0a9
3
+ Version: 0.23.0a10
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.0a9.dist-info/METADATA,sha256=KCH9_w-I-4MaqoTS0g8Zm4lAPxsWD71dOQwe4jyT3Ww,5523
2
- dbos-0.23.0a9.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
- dbos-0.23.0a9.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.23.0a9.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.23.0a10.dist-info/METADATA,sha256=ij2aQb4i-QIMqQA7NwPXx8R-pVqhJoR8d1f9jkTghy0,5524
2
+ dbos-0.23.0a10.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
3
+ dbos-0.23.0a10.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.23.0a10.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
@@ -34,7 +34,7 @@ dbos/_migrations/versions/d76646551a6c_workflow_queue.py,sha256=G942nophZ2uC2vc4
34
34
  dbos/_migrations/versions/eab0cc1d9a14_job_queue.py,sha256=uvhFOtqbBreCePhAxZfIT0qCAI7BiZTou9wt6QnbY7c,1412
35
35
  dbos/_outcome.py,sha256=FDMgWVjZ06vm9xO-38H17mTqBImUYQxgKs_bDCSIAhE,6648
36
36
  dbos/_queue.py,sha256=I2gBc7zQ4G0vyDDBnKwIFzxtqfD7DxHO2IZ41brFSOM,2927
37
- dbos/_recovery.py,sha256=Gk-ug-ppAMAFO72ZiGrxdbMx1gLmbAjciLCam_O_zV4,2847
37
+ dbos/_recovery.py,sha256=kaljwWky6Y73QnpMlY_cMSwiWf9wcyYigiUX7m3e4Jg,3137
38
38
  dbos/_registrations.py,sha256=_zy6k944Ll8QwqU12Kr3OP23ukVtm8axPNN1TS_kJRc,6717
39
39
  dbos/_request.py,sha256=cX1B3Atlh160phgS35gF1VEEV4pD126c9F3BDgBmxZU,929
40
40
  dbos/_roles.py,sha256=iOsgmIAf1XVzxs3gYWdGRe1B880YfOw5fpU7Jwx8_A8,2271
@@ -43,7 +43,7 @@ dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  dbos/_schemas/application_database.py,sha256=KeyoPrF7hy_ODXV7QNike_VFSD74QBRfQ76D7QyE9HI,966
44
44
  dbos/_schemas/system_database.py,sha256=rwp4EvCSaXcUoMaRczZCvETCxGp72k3-hvLyGUDkih0,5163
45
45
  dbos/_serialization.py,sha256=YCYv0qKAwAZ1djZisBC7khvKqG-5OcIv9t9EC5PFIog,1743
46
- dbos/_sys_db.py,sha256=NVd4OCyEfAvokyewNX35qUN8nj8L3x_j2vzA1t4BNp0,63817
46
+ dbos/_sys_db.py,sha256=lpgmCpuGfMbv18q7qjrDUw0vqjXn8aId4E3b64lSEp0,64443
47
47
  dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
48
48
  dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
49
49
  dbos/_templates/dbos-db-starter/__package/main.py,sha256=eI0SS9Nwj-fldtiuSzIlIG6dC91GXXwdRsoHxv6S_WI,2719
@@ -63,4 +63,4 @@ dbos/cli/cli.py,sha256=ohrXoRshwxOwN-gFag_RW2yoNjwcCVv6nTYQdaArwek,15506
63
63
  dbos/dbos-config.schema.json,sha256=X5TpXNcARGceX0zQs0fVgtZW_Xj9uBbY5afPt9Rz9yk,5741
64
64
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
65
65
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
66
- dbos-0.23.0a9.dist-info/RECORD,,
66
+ dbos-0.23.0a10.dist-info/RECORD,,