dbos 0.27.1__py3-none-any.whl → 0.27.2__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/_sys_db.py CHANGED
@@ -1739,15 +1739,30 @@ class SystemDatabase:
1739
1739
  available_tasks = max(0, queue.concurrency - total_running_tasks)
1740
1740
  max_tasks = min(max_tasks, available_tasks)
1741
1741
 
1742
- # Lookup unstarted/uncompleted tasks (not running)
1742
+ # Retrieve the first max_tasks workflows in the queue.
1743
+ # Only retrieve workflows of the appropriate version (or without version set)
1743
1744
  query = (
1744
1745
  sa.select(
1745
1746
  SystemSchema.workflow_queue.c.workflow_uuid,
1746
1747
  )
1748
+ .select_from(
1749
+ SystemSchema.workflow_queue.join(
1750
+ SystemSchema.workflow_status,
1751
+ SystemSchema.workflow_queue.c.workflow_uuid
1752
+ == SystemSchema.workflow_status.c.workflow_uuid,
1753
+ )
1754
+ )
1747
1755
  .where(SystemSchema.workflow_queue.c.queue_name == queue.name)
1748
1756
  .where(SystemSchema.workflow_queue.c.started_at_epoch_ms == None)
1749
1757
  .where(SystemSchema.workflow_queue.c.completed_at_epoch_ms == None)
1750
1758
  .order_by(SystemSchema.workflow_queue.c.created_at_epoch_ms.asc())
1759
+ .where(
1760
+ sa.or_(
1761
+ SystemSchema.workflow_status.c.application_version
1762
+ == app_version,
1763
+ SystemSchema.workflow_status.c.application_version.is_(None),
1764
+ )
1765
+ )
1751
1766
  .with_for_update(nowait=True) # Error out early
1752
1767
  )
1753
1768
  # Apply limit only if max_tasks is finite
@@ -1779,15 +1794,6 @@ class SystemDatabase:
1779
1794
  SystemSchema.workflow_status.c.status
1780
1795
  == WorkflowStatusString.ENQUEUED.value
1781
1796
  )
1782
- .where(
1783
- sa.or_(
1784
- SystemSchema.workflow_status.c.application_version
1785
- == app_version,
1786
- SystemSchema.workflow_status.c.application_version.is_(
1787
- None
1788
- ),
1789
- )
1790
- )
1791
1797
  .values(
1792
1798
  status=WorkflowStatusString.PENDING.value,
1793
1799
  application_version=app_version,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbos
3
- Version: 0.27.1
3
+ Version: 0.27.2
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.27.1.dist-info/METADATA,sha256=wKicsi_27L1ILS4hNRfiLMToG59MKgfaWkIcEFFoHIE,5551
2
- dbos-0.27.1.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- dbos-0.27.1.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
- dbos-0.27.1.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
1
+ dbos-0.27.2.dist-info/METADATA,sha256=dcP6roctqOhbbCanELEd5IEtHMymFkSl1gc3YC6a1Cs,5551
2
+ dbos-0.27.2.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ dbos-0.27.2.dist-info/entry_points.txt,sha256=_QOQ3tVfEjtjBlr1jS4sHqHya9lI2aIEIWkz8dqYp14,58
4
+ dbos-0.27.2.dist-info/licenses/LICENSE,sha256=VGZit_a5-kdw9WT6fY5jxAWVwGQzgLFyPWrcVVUhVNU,1067
5
5
  dbos/__init__.py,sha256=-FdBlOlr-f2tY__C23J4v22MoCAXqcDN_-zXsJXdoZ0,1005
6
6
  dbos/__main__.py,sha256=G7Exn-MhGrVJVDbgNlpzhfh8WMX_72t3_oJaFT9Lmt8,653
7
7
  dbos/_admin_server.py,sha256=CM02jyC9H21fM7Pjn1BhPxNwAOV7CXmMJd0SdaNq8dQ,9062
@@ -47,7 +47,7 @@ dbos/_schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  dbos/_schemas/application_database.py,sha256=SypAS9l9EsaBHFn9FR8jmnqt01M74d9AF1AMa4m2hhI,1040
48
48
  dbos/_schemas/system_database.py,sha256=wLqrhApNqrwZC1SdUxi_ca0y_66WzKaaBOxvND4_bdg,5738
49
49
  dbos/_serialization.py,sha256=bWuwhXSQcGmiazvhJHA5gwhrRWxtmFmcCFQSDJnqqkU,3666
50
- dbos/_sys_db.py,sha256=caIbhOwAnfugGzhnJ5rOG2V_bXphD9tJ4Un37gnG47A,82281
50
+ dbos/_sys_db.py,sha256=07X0bypLwCBwHjzygMqQpmvYMII7rjedKCJmfikVThk,82604
51
51
  dbos/_templates/dbos-db-starter/README.md,sha256=GhxhBj42wjTt1fWEtwNriHbJuKb66Vzu89G4pxNHw2g,930
52
52
  dbos/_templates/dbos-db-starter/__package/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  dbos/_templates/dbos-db-starter/__package/main.py,sha256=nJMN3ZD2lmwg4Dcgmiwqc-tQGuCJuJal2Xl85iA277U,2453
@@ -67,4 +67,4 @@ dbos/cli/cli.py,sha256=a3rUrHog5-e22KjjUPOuTjH20PmUgSP0amRpMd6LVJE,18882
67
67
  dbos/dbos-config.schema.json,sha256=8KcwJb_sQc4-6tQG2TLmjE_nratfrQa0qVLl9XPsvWE,6367
68
68
  dbos/py.typed,sha256=QfzXT1Ktfk3Rj84akygc7_42z0lRpCq0Ilh8OXI6Zas,44
69
69
  version/__init__.py,sha256=L4sNxecRuqdtSFdpUGX3TtBi9KL3k7YsZVIvv-fv9-A,1678
70
- dbos-0.27.1.dist-info/RECORD,,
70
+ dbos-0.27.2.dist-info/RECORD,,
File without changes