source .venv/bin/activate).
Spark 4 needs Java 17 or 21, not a newer default such as 26:
run_everything.shandscripts/demo_live.shfind Java 21 by themselves;- before any other command that starts Spark (
job.py,train.py), set it in that terminal:
1. Set up a computer (once)
2. Reproduce the results
clean/. In order, it:
- rebuilds the master table;
- replays it through the streaming job;
- checks the stream against a direct computation;
- runs the batch event study (the answer key) and compares the two;
- trains the big-move model.
Model scores in the stream. The model is trained last, so this run’s stream has no model scores. The dashboard’s recording needs them. Either:
- download the trained model before
run_everything.sh: - or stream once more after it:
job.py --fresh with its default folders deletes data/stream/, the full run that the results and the recording come from. For anything else, use other folders (--out, --checkpoint), or scripts/demo_live.sh, which uses data/demo/.
The steps one at a time (local files):
etl/prices_download.py, etl/prices_clean.py, etl/pageviews_download.py, etl/pageviews_clean.py, etl/retail_clean.py, then etl/join_master.py. Retail sales need the FRED files in raw/census/ (see docs/etl-guide.md).
3. Refresh what is published (after a full run)
In this order:- The dashboard’s recording:
It writes
hosting/snapshot/, the Replay and Event history views, fromdata/stream/, the batch results and the model. - The results pack:
It writes
docs/results/, the tables, charts and checks behind the report. Add--cluster-stream DIRto include a cluster run copied back. - Commit, then
git push. The pre-commit hook rebuildsdocs-site/. The post-commit hook pushes:- the docs site, which Mintlify redeploys;
- the hosted dashboard, which Streamlit Community Cloud redeploys;
- the cloud streamer’s copy.
- Hugging Face:
Without
--uploadit only builds the folders indata/publish/for you to check. Add--only dataset(ormodel,space) to upload just one.
4. Watch and demo
The dashboard: calendar-effects.streamlit.app, always on (if nobody has opened it for 12 hours, one click wakes it). The same app on your computer:- Replay: plays back a recording of a full run, made earlier: pick the years, pause, jump, change the speed. Nothing else needs to run.
- Live stream: a streaming job running right now, each micro-batch about 15 seconds after it is processed. Start one of these two ways.
- Event history & forecast and About.
Calendar-Effects/live-stream > Actions > Live stream > Run workflow. The same from a terminal:
Every run plays on to the end of the data and then stops by itself: about 15 minutes from 2023-06-01, about an hour from 2016-01-04. It needs the repository secret
HF_TOKEN (hosting/live-stream/README.md).
A live run from your computer:
Ctrl-C stops it cleanly. It needs
hf auth login to publish.
Only one run shows on the hosted dashboard at a time: whichever started first. Another run keeps uploading and appears once the first ends.
“Live” means the processing is live; the data is a replay of 2016–2025, not today’s market.
A run’s last day is 17 December 2025, not the data’s last day, 31 December: the job releases a day only once its 7-day watermark has passed it, and at the end of a replay nothing newer arrives to move the watermark. The batch study covers those days.
5. On the SFU cluster
On the SFU VPN:ssh cluster.cs.sfu.ca, and run long jobs inside tmux. The cluster’s python3 has no pyspark, so the job goes through spark-submit with the Kafka connector:
- The two paths:
--outand--checkpointare HDFS paths. Clear them withhdfs dfs -rm -rbefore a rerun. - Topics: the team topic is
calendar-effects-master; use your own topic for experiments. - Late data: add
--late-fraction 0.02to the producer to send some rows late. - Checking a topic:
python3 scripts/peek_topic.py --topic <topic>prints its first messages. - Reports: to put a cluster run in the reports, copy its output folder back to your computer, then run
scripts/export_results.py --cluster-stream DIR.