refactor: unify data preparations and research input snapshots
Deploy production / deploy (push) Successful in 53s
Deploy production / deploy (push) Successful in 53s
This commit is contained in:
@@ -118,6 +118,17 @@ class ResearchAccess:
|
||||
return {"job_id": job.id, "status": job.status, "action": job.kind,
|
||||
"read_with": "get_worldquant_connection", "web_url": f"{self.public_origin}/"}
|
||||
|
||||
async def preparations(self, args):
|
||||
from ..preparations.service import Preparations
|
||||
return await Preparations(self.db).list(args.q, args.scope_key, args.limit, args.offset)
|
||||
|
||||
async def preparation(self, args):
|
||||
from ..preparations.service import Preparations
|
||||
service = Preparations(self.db)
|
||||
row = await service.get(args.id, args.version, lock=True)
|
||||
return {"collection": await service.output(row),
|
||||
"fields": await service.members(row.id, args.q, None, args.limit, args.offset)}
|
||||
|
||||
async def catalog(self, args):
|
||||
data = await Catalog(self.db).search(args.filters, args.dataset_id)
|
||||
return {**data, "scope": args.filters.model_dump(include={"region", "universe", "delay", "instrument_type"}),
|
||||
@@ -298,7 +309,8 @@ class ResearchAccess:
|
||||
# preserve_source prevents the Chatbox-specific generating context rewriting MCP provenance.
|
||||
backtests = Backtests(self.db, provenance)
|
||||
preview = await backtests.preview(PreviewInput(inline=DraftInput(
|
||||
name=args.name, source=source, candidates=args.candidates)), preserve_source=True)
|
||||
name=args.name, source=source, candidates=args.candidates,
|
||||
preparation_refs=args.preparation_refs)), preserve_source=True)
|
||||
result = await backtests.start(StartInput(preview_id=preview["preview_id"],
|
||||
idempotency_key="mcp-" + str(uuid4())))
|
||||
result = {**result, "input_digest": digest, "batch_count": preview["batch_count"],
|
||||
|
||||
Reference in New Issue
Block a user