
2026/06/25 2:20
Show HN: DBOSify - PostgreSQL に基づいて構築されたTemporalの即座に置き換え可能な代替ソリューション
RSS: https://news.ycombinator.com/rss
要約▶
Japanese Translation:
DBOSify は、別々の Temporal サーバーが不要になるようにすることで、Temporal Python SDK のより単純な代替手段を提供します。代わりに、DBOS Transact を通じて標準の PostgreSQL データベースを所有し、すべてのワークフローの状態、耐久性、および回復を担当させます。仮想イベントループ上の決定論的インタープリターを利用することで、このシステムは非決定的なアクションが Postgres 内で安全にチェックポイント化されることを保証します。シグナル、キャンセル、更新、再試行といった重要な操作は、LISTEN/NOTIFY メカニズム経由で配信される耐久メッセージとして機能し、クラッシュや再起動後もワークフローが正確に 1 回のみ実行されることを保証します。
DBOSify を採用するには、標準の
temporalio インポートを dbosify で置き換え、特定のデータベース接続文字列(DBOS_SYSTEM_DATABASE_URL)を設定する必要があります。 namespaces を個別のデータベーススキーマにマッピングすることで、Python 専用アプリケーションのインフラストラクチャ複雑性を大幅に削減しますが、現在、外部ツールとの互換性が不足しています。gRPC 接続がないため、非-Python SDK はシステムと統合できず、ワークフローは標準的な Temporal ユーティリティ(Web UI や CLI など)ではなく DBOS の内部 API を介して管理されます。
Text to translate:
DBOSify offers a streamlined alternative to the Temporal Python SDK by eliminating the need for a separate Temporal server. Instead, it leverages a standard PostgreSQL database via DBOS Transact to handle all workflow state, durability, and recovery. By utilizing deterministic interpreters on a virtual event loop, the system ensures that non-deterministic actions are safely checkpointed within Postgres. Critical operations like signals, cancellations, updates, and retries function as durable messages delivered via LISTEN/NOTIFY mechanisms, guaranteeing workflows execute exactly once even after crashes or restarts.
Adopting DBOSify requires replacing the standard
temporalio import with dbosify and configuring a specific database connection string (DBOS_SYSTEM_DATABASE_URL). While this approach significantly reduces infrastructure complexity for Python-only applications by mapping namespaces to distinct database schemas, it currently lacks compatibility with external tools. The absence of a gRPC connection means non-Python SDKs cannot integrate with the system, and workflows are managed through DBOS's internal APIs rather than standard Temporal utilities like its Web UI or CLI.本文
DBOSify:Postgres をバックエンドにした Temporal Python のドロップイン代替製品
DBOSify は、Temporal Python 向けの代替ライブラリです。Postgres データベース(DBOS Transact を経由)を Temporal サーバーの代わりに利用することで、サーバーなしで永続的なワークフローを実行可能にします。
実装と機能
以下の機能を Temporal サーバーなし で提供します:
- Everlasting ワークフロー
- アクティビティ
- シグナル
- アップデート
- リトライ
- 回復(Recovery)
インストールと接続手順
temporalio を dbosify に置き換えるだけで利用可能です。ワーカーとクライアントは Postgres データベース に直接接続します。
コード例:使用方法
以下のコードにより、Postgres への接続文字列を設定し、ワークフローを実行します。
import asyncio import os from datetime import timedelta # DBOSify のインポート from dbosify import activity, workflow from dbosify.client import Client from dbosify.worker import Worker # Postgres 接続文字列の設定 DB_URL = os.environ.get("DBOS_SYSTEM_DATABASE_URL") @activity.defn async def compose_greeting(name: str) -> str: """アクティビティ定義例""" return f"Hello, {name}!" @workflow.defn class GreetingWorkflow: """ワークフロー定義例""" @workflow.run async def run(self, name: str) -> str: return await workflow.execute_activity( compose_greeting, name, start_to_close_timeout=timedelta(seconds=10) ) async def main() -> None: # ワーカーの作成と起動 worker = Worker( DB_URL, task_queue="greetings", workflows=[GreetingWorkflow], activities=[compose_greeting], ) async with worker: async with await Client.connect(DB_URL) as client: # ワークフローの実行 result = await client.execute_workflow( GreetingWorkflow.run, "World", id="greeting-1", task_queue="greetings" ) print(result) # 出力:Hello, World! if __name__ == "__main__": asyncio.run(main())
動作原理
DBOSify は、Temporal ワークフローを Postgres をバックエンドとする DBOS ワークフロー として実行します。
- 決定論的な解釈器: イベント到着までのみ進行する仮想イベントループ上でワークフローを実行(メインコルーチン、シグナル、アップデート、クエリハンドラーを含む)。
- チェックポイント化: DBOS ステップと通信プリミティブを用いて、すべての非決定的動作はワークフローの観察前に Postgres に保存されます。
具体的な実装詳細
| コンポーネント | 実装方法 |
|---|---|
| アクティビティ | 完了時にチェックポイント化する DBOS ステップとして実装 |
| タイマー | 永続的スリープ(durable sleeps)として実装 |
| シグナル/アップデート/キャンセル | Postgres を経由した LISTEN/NOTIFY による永続メッセージング |
| 回復(Recovery) | 記録されたチェックポイントからの再実行と再生(replay)により、中断箇所から正確に再開される仕組み |
| ネームスペース | 独自の Postgres スキーマへのマッピング |
| Client / Worker | それぞれ DBOS クライアント・ランタイムをラップする構成 |
テスト戦略
Temporal のドロップイン代替製品であることを検証するため、以下の手法を採用しています:
- ユニットテストおよび統合テストの移行: 関連するすべての Temporal Python テストを Port
- 機能検証: Temporal Python サンプルアプリケーションをリポジトリ化して、真の互換性を確認
- 回復性テスト: 特に 決定論的な失敗回復 を検証するための「殺処分と回復(kill-and-recover)」テストに重点
- API 互換性: 公開 API の同一性を機械的に保証する署名対応性テスト(文書化された例外を除く)
制限事項
DBOSify が提供しない機能や、注意点です:
-
ネットワークプロトコルの互換性なし
- gRPC のワイヤーレベルでの互換性がありません。
- 他の言語の Temporal SDK は接続できません。
- Python アプリケーション向けであり、Temporal サーバー全体を置き換えるものではありません。
-
エコシステムとの非互換性
- Temporal ウェブ UI
temporal CLI
(Command Line Tool)tctl- これらは利用できず、DBOS の管理 API および Conductor を使用します。
アーキテクチャの詳細や機能互換性については、公式ドキュメントを参照してください。