hosting/live-stream/README.md · chapter The dashboard and publishing, file 9 · 49 lines · open in the repository
What it does
The full text is below.Source
hosting/live-stream/README.md
# Calendar Effects: the cloud streamer
The live demo of [Calendar Effects](https://calendar-effects.mintlify.app), run on GitHub's servers
instead of a team member's computer (decision 0015 in the team repository). It replays the stored
2016–2025 data through the Spark Structured Streaming job, scores the big-move model, and publishes
every micro-batch to the hosted dashboard:
**https://calendar-effects.streamlit.app** (the *Live stream* view).
"Live" means the processing is live; the data is a replay of the study period.
## Use it
On this repository's **Actions** tab, pick **Live stream** on the left.
| To | Do |
|---|---|
| Start | **Run workflow**, mode `start`, a first day, and seconds between micro-batches. Every run plays on to the end of the data (December 2025). From `2023-06-01`, each stock's 6-month baseline is built by January 2024, so the model's test years (2024–2025) are fully scored; `2016-01-04` is the whole study. |
| Stop (pause) | Open the running run and press **Cancel run**. The job stops cleanly and the run is saved. |
| Resume | **Run workflow**, mode `resume`. The last run carries on from where it stopped. |
| Restart | **Run workflow** again. A run that is streaming is stopped first: one stream at a time. |
A run also stops by itself when the replay runs out (about 15 minutes from 2023-06-01, about an hour
for the whole study), and the dashboard marks it complete. The dashboard shows each micro-batch about
15 seconds after it is processed. A run from a laptop (`scripts/demo_live.sh`) works the same way;
whichever starts first is the one the dashboard shows.
The first two to three minutes of every run are setup (Java, Python packages, the model).
## One-time setup: one secret
Under **Settings > Secrets and variables > Actions > New repository secret**, add `HF_TOKEN`: a Hugging
Face access token with write access to the `calendar-effects` organisation (huggingface.co > Settings >
Access Tokens, type *Write*). The workflow uses it only to publish the live feed,
`calendar-effects/live-feed`. It can be revoked at any time; the workflow then stops with a message.
## Where the code comes from
The `project` branch of this repository: a copy of what the demo needs (`src/`, `config/`,
`clean/master.parquet`, the demo script, `requirements.txt`, `pyproject.toml`). It is pushed after each
commit on `main` of the team repository on github.sfu.ca, from any team member's computer with the git
hooks installed (`scripts/install_git_hooks.sh`, which runs `scripts/sync_live_stream.sh`). A pull
request merged on the github.sfu.ca website reaches it at the next such commit.
## Cost
Nothing. This repository is private, so its runs count against the organisation's free 2,000 Actions
minutes a month (a demo run from 2023-06-01 is about 20 minutes). The workflow file here is a copy:
the one that counts is `hosting/workflows/live-stream.yml` in the team repository, and
`scripts/install_workflows.sh` copies it here.