fpl-solver / docs /scheduler_setup.md
AnayShukla's picture
Claude Opus 5.5
Fix inflated defcon/attacking shares; refresh xMins every 3 hours
c91d10c
|
Raw History Blame Contribute Delete
2.61 kB
# Windows Task Scheduler
Two tasks:
| Task | Runs | Command |
|---|---|---|
| `FPL xMins Refresh` | every 3 hours | `run_auto.py --xmins-only` β€” Solio β†’ Supabase, ~1 min |
| `FPL Auto Update` | every 2 days, 12:00 | `run_auto.py` β€” everything, ~25 min |
They share a lock (`logs/run_auto.lock`), so they never open the Solio Chrome
profile at the same time. The deployed app re-reads `admin_xmins` from Supabase
every 15 minutes (`XMINS_POLL_SECONDS` in main.py), so a new write shows up
without a restart.
Both should have, under Conditions/Settings: start on battery, **don't** stop
when going on battery, wake the computer to run, run as soon as possible after
a missed start. The tasks run while you are signed in (locked screen and sleep
are fine). Running them while signed out needs "Run whether user is logged on
or not", which needs an admin prompt.
## Original setup (full pipeline)
## One-time setup
1. Press **Win+R**, type `taskschd.msc`, Enter.
2. Right pane β†’ **Create Basic Task…**
3. Name: `FPL Auto Update`. Description: `Runs xMins pipeline every 3 days`.
4. Trigger: **Daily**, start today at (say) 09:00, **Recur every 3 days**.
5. Action: **Start a program**.
- Program/script:
```
C:\Users\anays\Desktop\python-repos\projections\.venv\Scripts\python.exe
```
- Add arguments:
```
run_auto.py
```
- Start in:
```
C:\Users\anays\Desktop\python-repos\projections
```
6. Finish. Then right-click the new task β†’ **Properties** β†’
- **General** tab: check **Run whether user is logged on or not** (so it fires even when the laptop is asleep-and-woken).
- **Conditions** tab: uncheck **Start the task only if the computer is on AC power** if you want it to run on battery too.
- **Settings** tab: check **Run task as soon as possible after a scheduled start is missed** (for when the laptop was off at scheduled time).
## Verifying
- Right-click the task β†’ **Run**. Then check `logs/run_auto_YYYYMMDD.log` in the repo β€” should end with `run_auto DONE` or a clear error.
- Exit codes surface in Task Scheduler's History tab:
- `0` = success
- `2` = Solio session expired β†’ run `python solio_scraper.py --login`
- `3` = Solio scrape/parse failed β†’ inspect logs, DOM may have changed
- `4` = Supabase write failed β†’ check project status, network
## When Solio session dies (~monthly)
The scheduler will log exit code 2 and stop writing until you:
```
.venv\Scripts\python.exe solio_scraper.py --login
```
Sign in with your Google account, hit ENTER, done. Next scheduled run picks up.