Store DAG plan to IPFS and track plan_cid in run_cache

- Add plan_cid column to run_cache schema
- Store DAG JSON to IPFS during execute_dag task
- Return plan_cid in run status and list APIs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-12 18:43:48 +00:00
parent 5b05dbd31e
commit 2e3d3a5c6d
3 changed files with 26 additions and 7 deletions

View File

@@ -382,6 +382,17 @@ def execute_dag(self, dag_json: str, run_id: str = None) -> dict:
import asyncio
import database
# Store plan (DAG) to IPFS
plan_cid = None
try:
import ipfs_client
dag_dict = json.loads(dag_json)
plan_cid = ipfs_client.add_json(dag_dict)
if plan_cid:
logger.info(f"Stored plan to IPFS: {plan_cid}")
except Exception as e:
logger.warning(f"Failed to store plan to IPFS: {e}")
async def save_to_db():
if database.pool is None:
await database.init_db()
@@ -409,6 +420,7 @@ def execute_dag(self, dag_json: str, run_id: str = None) -> dict:
inputs=input_hashes_for_db,
ipfs_cid=output_ipfs_cid,
actor_id=actor_id,
plan_cid=plan_cid,
)
# Save output as media for the user