Skip to content

Move health_checker + trading_calendar from alpha-engine-data#18

Merged
cipher813 merged 1 commit into
mainfrom
feat/add-health-checker-from-data-repo
Apr 16, 2026
Merged

Move health_checker + trading_calendar from alpha-engine-data#18
cipher813 merged 1 commit into
mainfrom
feat/add-health-checker-from-data-repo

Conversation

@cipher813
Copy link
Copy Markdown
Owner

Summary

Part 1/3 of the ae-dashboard de-bloat. Copies `health_checker.py` and `trading_calendar.py` from `alpha-engine-data` into this repo so ae-dashboard can eventually drop its `alpha-engine-data` clone entirely.

Why move

  • Both scripts are observability / gating code that runs on ae-dashboard (via crontab + Step Function SSM steps)
  • Neither does data production — they read S3, emit alerts, and gate the pipeline on market-day checks
  • Meanwhile ae-dashboard is a t3.micro with 1 GB RAM where today's OOM incident surfaced the cost of bloat
  • Keeping them in alpha-engine-data forces the micro to clone the whole data-production repo just to execute two files

Semantic seam: `alpha-engine-data` = data producer; `alpha-engine-dashboard` = observability consumer. These two files belong on the consumer side.

Changes

  • `health_checker.py` — identical copy from `alpha-engine-data/health_checker.py`
  • `trading_calendar.py` — identical copy from `alpha-engine-data/trading_calendar.py`
  • `tests/test_health_checker.py` — identical copy
  • `tests/test_trading_calendar.py` — identical copy

No existing code touched. No dependency changes (both scripts are stdlib + boto3 which is already in requirements.txt).

Test plan

  • `pytest` — 246/246 passed (+13 new from copied tests)
  • Post-merge: ae-dashboard's next daily `boot-pull.timer` run pulls the new files; operator manually verifies `python health_checker.py --alert` and `python trading_calendar.py` produce identical output to the old locations

Sequencing

  1. This PR (dashboard) — copies files into place
  2. Next: alpha-engine PR — updates Step Function `CheckTradingDay` + `HealthCheck` SSM commands to run from `/home/ec2-user/alpha-engine-dashboard` instead of `/home/ec2-user/alpha-engine-data`
  3. Then: alpha-engine-data PR — deletes the two original files + crontab update on ae-dashboard + remove `alpha-engine-data` from `boot-pull.sh` REPOS + delete the clone

One note for the user: I confirmed earlier that ae-dashboard has the `boot-pull.timer` infrastructure in the repo (`infrastructure/boot-pull.sh`, `install-boot-pull.sh`, `systemd/boot-pull.timer`) but the installer was never run on the instance — `systemctl list-timers` shows nothing. Running `sudo bash install-boot-pull.sh` once will activate daily 12:00 UTC auto-pulls, covering the "24h code freshness" ask without a new PR.

🤖 Generated with Claude Code

Part 1 of 3 in the ae-dashboard de-bloat split. Both scripts are
observability/gating code that executes on the dashboard instance
via cron and Step Function SSM steps — their semantic home is here,
not in the data-production repo (alpha-engine-data).

Rationale for the split:
  alpha-engine-data = data producer (writes S3: daily_closes, features,
                      slim cache, manifests)
  alpha-engine-dashboard = observability consumer (reads S3, emits alerts,
                           gates Step Function on market-day check)

Today ae-dashboard (t3.micro, 1GB) clones the full alpha-engine-data
repo just to execute these two Python files. Moving them here lets
us drop the clone entirely once the Step Function cuts over (PR 2)
and the originals are deleted (PR 3).

Files (identical copies from alpha-engine-data):
  health_checker.py           — data staleness checker + SNS alerter
  trading_calendar.py         — NYSE holiday-aware trading-day check
  tests/test_health_checker.py
  tests/test_trading_calendar.py

Test plan: full suite 246 passed (was 233 before this PR).

Sequencing:
  1. This PR merges → ae-dashboard pulls via boot-pull.timer (already
     installed? TBC — user to verify / install via install-boot-pull.sh)
  2. alpha-engine PR (Step Function IaC) updates CheckTradingDay +
     HealthCheck SSM commands to new paths
  3. alpha-engine-data PR deletes the two moved files; remove
     alpha-engine-data from boot-pull REPOS list; delete
     /home/ec2-user/alpha-engine-data on ae-dashboard

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cipher813 added a commit to cipher813/alpha-engine-data that referenced this pull request Apr 16, 2026
…board

Part 2/3 of ae-dashboard de-bloat. Once this deploys, the Step Function
invokes trading_calendar.py and health_checker.py from
/home/ec2-user/alpha-engine-dashboard instead of /home/ec2-user/
alpha-engine-data. Both scripts were copied to the dashboard repo in
cipher813/alpha-engine-dashboard#18 — identical content, same CLI
contract (TRADING DAY / MARKET_CLOSED stdout markers, --alert flag).

Pre-merge requirements:
  1. cipher813/alpha-engine-dashboard#18 must be merged
  2. ae-dashboard must have pulled the new dashboard repo files
     (daily boot-pull.timer or manual pull)

No other SF states touched. No CloudFormation or deploy-script
changes needed — operator runs the existing
infrastructure/deploy_step_function_daily.sh after merge to apply
the updated definition.

Part 3/3 (file deletion + alpha-engine-data removal from ae-dashboard's
boot-pull REPOS list + clone removal) follows after next weekday run
verifies the new paths work.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cipher813 cipher813 merged commit 1be40b7 into main Apr 16, 2026
1 check passed
@cipher813 cipher813 deleted the feat/add-health-checker-from-data-repo branch April 16, 2026 16:32
cipher813 added a commit to cipher813/alpha-engine-data that referenced this pull request Apr 16, 2026
…board (#42)

Part 2/3 of ae-dashboard de-bloat. Once this deploys, the Step Function
invokes trading_calendar.py and health_checker.py from
/home/ec2-user/alpha-engine-dashboard instead of /home/ec2-user/
alpha-engine-data. Both scripts were copied to the dashboard repo in
cipher813/alpha-engine-dashboard#18 — identical content, same CLI
contract (TRADING DAY / MARKET_CLOSED stdout markers, --alert flag).

Pre-merge requirements:
  1. cipher813/alpha-engine-dashboard#18 must be merged
  2. ae-dashboard must have pulled the new dashboard repo files
     (daily boot-pull.timer or manual pull)

No other SF states touched. No CloudFormation or deploy-script
changes needed — operator runs the existing
infrastructure/deploy_step_function_daily.sh after merge to apply
the updated definition.

Part 3/3 (file deletion + alpha-engine-data removal from ae-dashboard's
boot-pull REPOS list + clone removal) follows after next weekday run
verifies the new paths work.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cipher813 added a commit to cipher813/alpha-engine-data that referenced this pull request Apr 16, 2026
…oard)

Part 3/3 of ae-dashboard de-bloat. Both scripts were copied verbatim
to alpha-engine-dashboard in cipher813/alpha-engine-dashboard#18, and
the Step Function SSM commands were repointed in
#42 (merged 2026-04-16) to run from
/home/ec2-user/alpha-engine-dashboard.

This PR removes the original copies from alpha-engine-data now that
nothing in the weekday Step Function or Saturday pipeline references
them anymore. The data repo is now scoped purely to data-production
code (collectors, builders, features, weekly_collector) — matches the
producer-vs-observability seam documented in the earlier commits.

Pre-merge requirements (MERGE ORDER IS IMPORTANT):
  1. Friday 2026-04-17 weekday Step Function run must complete
     successfully using the new dashboard paths (verify CheckTradingDay
     logs `cd /home/ec2-user/alpha-engine-dashboard`, HealthCheck writes
     /var/log/health-check.log normally)
  2. Update ae-dashboard crontab — there's a
     `0 */6 * * *` entry still running `cd /home/ec2-user/alpha-engine-data
     && .venv/bin/python health_checker.py --alert`. Operator must
     crontab -e on ae-dashboard and swap the path to
     /home/ec2-user/alpha-engine-dashboard before this PR merges, else
     the cron breaks until that edit happens

Pairs with cipher813/alpha-engine-dashboard#19 (removes
alpha-engine-data from the dashboard's boot-pull.sh REPOS list).

Tests: full suite 49 passed (was 71 before moves — the 22 delta is
26 tests deleted with the moved files + 5 new test_module_health
tests added earlier + others).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cipher813 added a commit that referenced this pull request Apr 16, 2026
Part of the ae-dashboard de-bloat split. After
cipher813/alpha-engine-data#43 merges (deletes trading_calendar.py +
health_checker.py from the data repo), ae-dashboard no longer has
any runtime dependency on alpha-engine-data — both files moved to
this repo in #18 and the Step
Function's CheckTradingDay + HealthCheck commands now run from here.

Removing alpha-engine-data from the REPOS array stops the daily
12:00 UTC boot-pull from refreshing the now-unused clone. Existing
clone at /home/ec2-user/alpha-engine-data on ae-dashboard can be
rm'd manually post-merge.

Pre-merge requirements:
  - cipher813/alpha-engine-data#43 merged (or mergeable in same batch)
  - ae-dashboard crontab updated so the `0 */6 * * *` health_checker
    cron no longer references /home/ec2-user/alpha-engine-data

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cipher813 added a commit to cipher813/alpha-engine-data that referenced this pull request Apr 16, 2026
…oard) (#43)

Part 3/3 of ae-dashboard de-bloat. Both scripts were copied verbatim
to alpha-engine-dashboard in cipher813/alpha-engine-dashboard#18, and
the Step Function SSM commands were repointed in
#42 (merged 2026-04-16) to run from
/home/ec2-user/alpha-engine-dashboard.

This PR removes the original copies from alpha-engine-data now that
nothing in the weekday Step Function or Saturday pipeline references
them anymore. The data repo is now scoped purely to data-production
code (collectors, builders, features, weekly_collector) — matches the
producer-vs-observability seam documented in the earlier commits.

Pre-merge requirements (MERGE ORDER IS IMPORTANT):
  1. Friday 2026-04-17 weekday Step Function run must complete
     successfully using the new dashboard paths (verify CheckTradingDay
     logs `cd /home/ec2-user/alpha-engine-dashboard`, HealthCheck writes
     /var/log/health-check.log normally)
  2. Update ae-dashboard crontab — there's a
     `0 */6 * * *` entry still running `cd /home/ec2-user/alpha-engine-data
     && .venv/bin/python health_checker.py --alert`. Operator must
     crontab -e on ae-dashboard and swap the path to
     /home/ec2-user/alpha-engine-dashboard before this PR merges, else
     the cron breaks until that edit happens

Pairs with cipher813/alpha-engine-dashboard#19 (removes
alpha-engine-data from the dashboard's boot-pull.sh REPOS list).

Tests: full suite 49 passed (was 71 before moves — the 22 delta is
26 tests deleted with the moved files + 5 new test_module_health
tests added earlier + others).

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant