コンテンツにスキップ

BT Infrastructure

Purpose

この文書は、AEGIS の backtest / research batch lane を説明する。 焦点は、Rust BT engine を Fargate でどう起動し、ORATS 系データをどう渡し、結果をどこへ戻すかである。

Core design

  • 実行エンジン: aegis_v3/aegis-bt-rs/
  • batch 実行面: ECS RunTask on Fargate
  • image 配布: ECR aegis-bt-rust
  • config / result exchange: S3
  • dataset 配布: reference は EBS snapshot を正系としつつ、repo 上の entrypoint は S3 Files -> EBS -> S3 sync fallback の順で解決する

Execution flow

flowchart LR
    Scenario["scenario YAML"] --> Upload["launcher uploads config to S3"]
    Upload --> ECS["aws ecs run-task (Fargate)"]
    ECS --> Image["ECR: aegis-bt-rust"]
    ECS --> Data["/mnt/s3files or /mnt/data"]
    Data --> BT["Rust BT engine"]
    BT --> Logs["CloudWatch Logs"]
    BT --> Results["S3 results/<run_name>/"]

Runtime contract

Item Current contract
AWS region us-east-1
ECS cluster aegis-bt
Task family aegis-bt-rust
ECR image 677414637283.dkr.ecr.us-east-1.amazonaws.com/aegis-bt-rust:latest
Result bucket aegis-bt-data-677414637283
Log group /ecs/aegis-bt-rust

Primary launcher surface:

  • aegis_v3/scripts/fargate_bt.sh
  • aegis_v3/scripts/launch_fargate_rust_bt.py
  • aegis_v3/scripts/launch_fargate_sweep.py
  • aegis_v3/scripts/launch_fargate_cscv.py

Data plane

Intended primary path

  • REFERENCE.md では、ORATS + synthetic datasets を EBS snapshot から Fargate task へ mount する方針を採る。
  • 理由は、Fargate が FUSE ベースの S3 Mountpoint を使えず、起動時 full sync の待ち時間を減らしたいため。

Repo-observed runtime path

  • fargate_rust_entrypoint.sh は次の優先順で data root を探す:
  • S3 Files mount
  • EBS mount
  • S3 sync fallback
  • つまり code surface 上は、EBS only ではなく multi-path compatibility が残っている。

Practical reading

  • architecture doc としては「reference の intended path」と「entrypoint がまだ持っている compatibility path」を分けて理解する必要がある。
  • queue 時点の follow-up は、どれを canonical にするかを再整理すること。

Resource rules

Workload Recommended spec
ORATS 7yr production BT 16 vCPU / 122 GB / ephemeral 50 GB
Synthetic / shorter BT 8 vCPU / 60 GB

Operational guardrails:

  • production BT は Mac ではなく Fargate
  • logs は CloudWatch に送る
  • task role は S3 access を最小権限で付与する
  • Fargate 実行前に Dockerfile / entrypoint / COPY path の監査を行う
Surface Role
bt-docker/Dockerfile.fargate* Fargate image build definitions
bt-docker/fargate_rust_entrypoint.sh runtime bootstrap / data-path selection
scripts/setup_ebs_snapshot.py EBS snapshot bootstrap
scripts/setup_ebs_infra_role.py ECS volume management IAM setup
bt-docker/fargate/taskdef_ibeam_gateway.json IBKR Fargate skeleton artifact

Notes

  • CodeBuild references still exist around CSCV / legacy helper surfaces, but repo-local evidence says the day-to-day Rust BT path is ECS RunTask + ECR + S3.
  • IBKR lane also has deferred Fargate skeletons, but the current primary production concern is still BT / research batch execution.

Source references

  • .claude/REFERENCE.md
  • AEGIS/WORK_LOG/2026-04-12_codex_fargate_health.md
  • AEGIS/WORK_LOG/2026-04-04_claude_ebs_volume_mount.md