Dokumentation · Kom i gang: installation og drift
The daily run, the scheduler, make status and make demo (B09)
docs/architecture/phase-1.md §6.5 is the specification (with §1.2 for the times, §4.3 for what a day
that is not confirmed is, §6.2 C8 and §6.3 for access); this page says where each part is and how to use it.
The runner and the chunks it works are docs/runner.md; the merge that stores the days is
docs/readings.md; the planner that decides what to ask is docs/planner.md.
| Part | Where |
|---|---|
| The daily job: list, plan, request | elo_worker.jobs.eloverblik_daily (eloverblik-daily) |
| Its parts: step 1 (the listing), step 2 (the planning), step 3 (the request), the calls of a run | elo_worker.ingest.daily |
| Step 4 (per item), including the rule of three days of an access code | elo_worker.ingest.merge._apply_daily |
| The scheduler | elo_worker.schedule, called from the worker's loop (elo_worker.__main__) |
make status | elo_worker.status |
make demo, make demo-load | Makefile; the loader is elo_devtools.demo_load (B16a's, adopted) |
| Test tooling: a simulated organisation and mornings | elo_devtools.daily_harness |
The run
eloverblik-daily makes 2 data calls (the list and one time series request for the owner's four metering
points) and at most 1 token call (a token lasts a day and is renewed when less than 30 minutes are left). Its
result, ops.job_run.detail, says so: calls by endpoint, call_statuses by HTTP status (none: a request that
left no response), data_calls, token_calls, items by outcome, counted from raw.fetch after the run's first
call (daily.calls_since; one worker runs one Eloverblik job at a time and holds the egress (the declaration's jobs run in a lane of their own and make no call to Eloverblik, B19), so every row after the mark is
the run's). This is the lead's check with the owner's token; make status prints it.
- List (
apply_list_reconciled, in the transaction that applies the list).masterdata.apply_listwrites the tree, then, in the same transaction, step 1 of §6.5:- a root no longer listed gets status 2 (its tree with it) and is not requested; listed again, it is status 1 with current access, and the days it was away are planned by step 2 (no restoration of discovery: nothing in §6.5 asks for one);
- one listed without a relation or as moved out gets
current_access = falseand status 3: its history is loaded, its daily request is not made; - one that was so listed (status 3, its root without relation then) and is listed with a relation again is
restored to discovery (
plan.restore):current_access = true, status 1,daily_failures = 0,readable_from = NULL, the days aftermax(first_load_to, daily_ok_through)tiled as first-load chunks up to today. The "before" is read from the rows in the same transaction, so a run killed after the list cannot leave a restored flag and an MP not restored; - an unchanged listing changes no state, in particular it does not end a suspension of step 4;
- nothing is concluded from a list that failed (the run goes on with the daily request and says
list_failed), that held an entry that could not be read, that is older than the list that last updated a metering point (Applied.reconcilable, B05v-05), or that names no metering point while some are known (the run saysreconciliation_skippedwith a fixed code,list_unreadableorlist_empty: an empty list is more likely a fault of the API than the end of every access). A child is listed when its root is: the list carries no flag of a child's own (chunks.mp_states). 2. Plan (plan_chunks, in a transaction of its own, under the lockelo.ingest): the first tiling of an MP never tiled (chunks.tile_new), thenplan.plan_dailyfor every MP that may be requested: the gap of §6.5 step 2 (a purpose-1 chunk for every day between the planning watermark andtoday − 14, which is how an outage of more than 14 days is repaired) and, for an MP awaiting first data, its bootstrap chunks (§6.3). It is a pure function of the rows and of today: run twice on one day it adds nothing, and in normal operation it adds nothing (CT-12). A backfill run is queued when anything was planned and when any chunk is due, a parked one included: the backfill chain's idle check does not count a parked chunk as work (B08bv2-04), so the daily run is what retries it (detail.chunks_due). 3. Request (due,batches,Sender): for every MP with areadable_fromand current access, oneActualrequest for[max(readable_from, today − 14), tomorrow), MPs with the same window ten to a request. **Once a week** an MP whose access step 4 ended while its root is still listed with a relation is asked again (a local day a week after its last attempt;mps_reasked): a10000ends the suspension (current_access = true, status 1). Transaction A records each MP's attempted window (last_daily_requested_at,last_daily_date_from,last_daily_date_to) with theraw.fetchrow, whatever the outcome will be: a run that fails leaves the days it did not observe listed as not confirmed (§4.3, RT-11). The request key names the MPs' internal IDs (… daily mps=1,2,3), never a metering point ID. 4. Per item (the merge):10000and applied →daily_ok_throughthe local day of the request (the request's own time, so a simulated clock works),daily_failures = 0,access_failures = 0. Any other answer →daily_failures + 1,last_daily_code, stored data untouched. **This is the only place where an error code changescurrent_access** (C8, N2): an item that answered one of30018 30010 30016 20010 40014 20012adds a day toaccess_failures(migration 0160) **only if the local day of its request is later thanaccess_failure_day, the day last counted**: a second run on the same day (a retried attempt, a deferred run's successor, the scheduler's job after a failed one) is not another day (B09v-02). Any other answer sets the count to 0 and the day to NULL, a request that gave the MP no answer (a 503, a timeout, a 401) leaves both, and three days in a row setcurrent_access = falseand status 3.30017is not an access code and never changes access (CT-14, MP 2:daily_failures = 3, access kept). A 429 counts as nothing.
Failure and what is done. A run in which every time series request failed (every list request when none was
due) fails and the queue retries it by its ordinary rule; one in which some failed is done and says how many
(B07v-05). A refused refresh token makes the account invalid, once, and nothing calls until the token changes
(B08bv-03). A run never sleeps inside the queue's claim: when the pacer would hold the next call more than 5 s (a
429, five 503), or the API is not alive, the run ends without being complete and queues its successor, with the
same payload, for the instant it may call (paused_until, successor_at, B08bv-02). The run makes no isalive call
(§5.2); the client makes one itself after five 503 in a row.
The scheduler
| When (Europe/Copenhagen) | Job | Slot |
|---|---|---|
| 05:30 daily, plus up to 10 minutes | eloverblik-daily | the local date |
| Sunday 02:00 | eloverblik-weekly | the Sunday's date |
| 04:30 daily | eds-load | the local date |
| The 2nd of each month, 03:00 | eds-monthly-repull | the month |
| 14:10 daily | eds-prices | the local date |
| The 2nd of each month, 03:20 | eds-prices-monthly | the month |
| 04:45 daily | eds-mix | the local date |
| Sunday 05:15 | eds-mix-weekly | the Sunday's date |
| The 2nd of each month, 03:40 | eds-mix-monthly | the month |
| 04:35 daily | eds-tx-load | the local date |
| The 2nd of each month, 03:10 | eds-tx-monthly | the month |
| 05:00 daily | eds-tx-mix | the local date |
| Sunday 05:45 | eds-tx-mix-weekly | the Sunday's date |
| The 2nd of each month, 04:00 | eds-tx-mix-monthly | the month |
| 09:30 daily | eds-recoverage | the local date |
| The 2nd of each month, 03:15 | eds-recoverage-monthly | the month |
That a job is due is a fact of the database, and a check independent of any job queues it (B08bv-01, the
ruling in orchestration/tasks/b08bf-runner-first-load-replay-fixes.md). No timer holds the schedule: a cron
trigger in the process fires once, and a worker that is down at 05:30, a job that fails its three attempts or a
successor lost with a run that died would each end the chain silently. So at every idle tick of the worker's loop
schedule.ensure_due asks the database whether the latest slot of each job, the one whose time has come, is
covered: covered means a job of its kind with that slot in its payload ended done and its run reports itself
complete (a deferred daily run is done and complete: false). Otherwise a job is queued (dedup key kind:slot)
unless one is queued or running. A slot missed is run when the worker is next there, once; the slots before it are
not (the gap rule of step 2 repairs the days). A job that fails does not end the schedule and does not loop: the
n-th failed job of a slot is followed by the next no sooner than the n-th wait of a parked chunk, 1 hour, 6 hours,
1 day, then daily (§6.2, as the backfill chain's B08bv3-03); a new day's slot starts clean. The Eloverblik jobs are
queued only while the worker could call (it owns the egress, the account is active and the database holds no
generated readings, below), those of Energi Data Service (eds-…) always. **In the demo stack (ELO_DEMO=1) nothing is scheduled at
all**: ensure_due returns at once, and the Eloverblik runtime's can_call() is false with a reason (EloverblikRuntime.refusal, the
one place that decides, as for generated readings), so the backfill chain's check queues nothing either and a job that was queued
all the same is refused with NotReady before any request (B09f2: a due chunk in a demo-loaded database used to queue a backfill run).
A covered slot that is due again (B98). Two rules open a slot a job covered; each is a fact of the database
(schedule.Job.reopens), for the declaration lane's two jobs and no other. eds-recoverage: the municipalities the
setting and the roots want (ingest.wanted_municipalities()) are not those ingest.municipality_state holds
(recoverage.wanted_set_differs: a wanted one with no state or at state 0, a held one no longer wanted, a waiting one
while no catch-up is under way), so a changed list, a root that moved, an account added or removed and a catch-up that
has joined with a municipality still waiting are loaded at the lane's next check, not at 09:30 the next day. *Once per
difference*: the run writes the states in its first transaction, before any call, which ends the difference; a run
that fails after it leaves nothing for a second run (the catch-up it began is taken up by the next slot's run), one
that fails before it is held off by the back-off of the slot's failed jobs, 1 hour, 6 hours, a day, and the next day's
slot starts clean. eds-tx-mix: a slot covered only by runs skipped for awaiting_emission_inputs is due again when
mix.awaiting_inputs, the job's own question, says the reason is gone (the transmission factors loaded from their first
day and no wanted municipality waiting, catching up or without a state row), so the first load begins when the
municipal share has run, not at the next day's 05:00. Not the awaiting_first_load of the weekly and monthly jobs:
they reload, and a reload minutes after the first load adds nothing to it; their next slot does it. The due-again run
carries the instant its slot opened as run_after, so it goes before a chain's queued slice (the lane's fairness is
unchanged); Covered.queued, failed and retry_after count the slot's own jobs and not a chain's slice (a slice's failure belongs to its chain, slices.take_up), so a chain neither holds it off nor sets its back-off; a
running or retried run is a queued job, so nothing starts twice and a stack restarted in the middle finds it; in the
demo (demo) nothing is ever due.
The declaration lane's jobs are due from their slot's opening, and a job of Energi Data Service runs in slices
(B51, phase-2.md §2.2; B51f). The rule depends on the lane. A job of the declaration lane (eds-…) that the scheduler
queues has run_after = the instant its slot opened (never later than now); an Eloverblik job has the instant it is
queued, as before B51, so the main lane takes a backfill run, the daily run and the weekly run in the order they were
queued, the daily run before the weekly one (B51v-02). The queue takes the due job with the earliest run_after. Every
job of Energi Data Service runs in the worker's declaration lane, one at a time, and applies at most 30 windows (or about 35 minutes of calls: 7 single-call windows in a cold slice and 6 in an immediate successor at 310 s, or 3 and 2 windows when each window over 17 500 rows takes a boundary remainder); then it
queues its successor, of its own kind, with the windows still to make in the payload, under the dedup key
<kind>:<slot>:<slice> (never the scheduler's <kind>:<slot>; <kind>:job-<id>:<slice> without a slot; a job of
more than one dataset, eds-prices, puts the dataset in it, <kind>:<slot>:<dataset>:<slice>, so that its two chains
of one slot never share a key, B52; without a slot <kind>:job-<origin>:<dataset>:<slice>), due from the
instant it is queued, and ends done: the slot is covered by its first slice. Before each claim the lane makes its own
due jobs known (lane_check, B51v-03), so a daily job whose slot opened during a slice runs before that slice's
successor whatever the main loop is busy with; the lane's check is the only place a job of the lane is queued, the main
loop's check queues every other scheduled job (main_schedule, B51w-03). A chain is the dataset's: while one is queued, a job of the dataset makes
its own window only and adds any rest to it (B51v-04). The successor is queued in the claim's transaction: a slice that
fails queues nothing and is retried as it was, but **a retried attempt does not ask again a window an earlier attempt of the
same job applied** (B53: the record of the requests decides it, docs/declarations.md, "A retried attempt"; a worker
killed or stopped by make up in the middle of the mix's first load, 73 windows (171 calls across 25 slices at 310 s at lag 1–2, 170 from lag 3+, or 151 across 5 slices at 60 s; 431 windows before B95f), resumes with the next window). A successor that fails its three attempts is taken up again within a day:
a first load or a repair by the next daily job, from what was loaded; the rest of a re-pull by the lane's check, from
its own windows, after 1 hour, 6 hours, 1 day, then daily, at most 8 times and never once a later re-pull has ended
(B51v-06, B51w-02; docs/declarations.md, elo_worker.eds.slices).
make status counts a queued job as waiting from the later of its run_after and its queueing, so a job queued for a slot
that opened earlier is not flagged as "not taken" the moment it is queued.
The stack therefore makes no call to Eloverblik or Energi Data Service whatever the worker holds. The stack check starts a worker with a well-formed token that is not the owner's and ELO_DEMO=1, and
proves it: after the worker's idle check has run (it waits for two ping jobs, the second not due until 3 s after
the first, which puts a tick between them), raw.fetch is empty and ops.job holds no job of an Eloverblik or
declaration kind (deploy/smoke.py, check_nothing_called). Without ELO_DEMO, that worker would send one request,
GET /token, to the base URL it was built with (the live API), which refuses it; the account is then invalid and
nothing else is sent (test_b09v_01_without_elo_demo_…). The next slot that make status prints is the day, week or
month after the current one by each job's own rule (Job.after), not a step of 24 hours from now (B09v-07). The daily run's jitter is a function of the date, so every check agrees on when
the slot opens.
Deviation from §1.2: the specification names APScheduler. Its in-memory triggers are exactly what B08bv-01
found wrong, so it is not used; the dependency stays in services/worker/pyproject.toml (no other change to
the lock). The times are those of §1.2.
The facts lane's job is no scheduled job (B132). facts-refresh has no slot: the worker's facts lane, a third thread beside the
declaration lane, queues it when fact.status() reports a due mark and none is queued or running (elo_worker.__main__.facts_check,
elo_worker.jobs.facts_refresh). It is not in schedule.JOBS, so the scheduler never queues it and make status's "due:" lists
do not name it; the stored facts: block of the runs section does (docs/facts.md, "The facts lane"). The main loop's queue and the
declaration lane's leave the kind alone.
Several accounts (B76)
docs/architecture/phase-2.md §6.3 ("Pace", "Runs", "A point two accounts list") on top of the above. An account is
one refresh token: the first is .env's (env), every further one a file data/state/tokens/<label>.token (B72,
make token-add, docs/operations.md §7.7).
| Rule | Where |
|---|---|
| One pace for all accounts: one request in flight, one spacing (1 s), one token-call spacing (60 s), one cooldown | One PostgresPaceStore and one egress for every account's client (EloverblikRuntime.credentials); the first account's client starts the egress, every further one joins it (EloverblikClient.join). A 429 or a 503 to any account's call cools the service for all (one address, one service); a cooldown never makes an account invalid (a token call answered 429 or 503 is a deferral) |
| An access token per account | data/state/eloverblik-access-token for env (phase 1's), data/state/tokens/<label>.access-token for a further account, beside its refresh token's file, 0600, by the private atomic replacement; a secret of the start check (B72). A request goes out with the access token of the account whose points it asks for: the backfill's AccountSender takes the client of plan.Request.account_id (a batch holds chunks of one account, phase-1.md §6.1) |
| An account's runs are its own | The scheduler queues one daily and one weekly run per account that may call, in the order of account_id (schedule.ensure_due(…, accounts=runtime.callable_labels())). env's keeps phase 1's payload {"slot": …} and key kind:slot; a further account's is {"slot": …, "account": "<label>"}, key kind:slot:<label>. Each covers its own slot and backs off its own failures (schedule.covered(…, account=)). A run lists with its account's token, reconciles (step 1) and plans (step 2) its account's points, and asks (step 3) the points its account owns |
| An invalid account stops its own jobs only | /token answering 401, 403 or 50001, or a second 401 on a data call, marks that account invalid (EloverblikRuntime._invalid(account_id)); its runs are no longer queued, its queued jobs are refused (NotReady), and its points' chunks are not requestable (chunks.REQUESTABLE); a backfill run that meets the refusal goes on with the other accounts' chunks. The other accounts' runs go on |
| The backfill | One chain for all accounts: due chunks of any account, newest window first (plan.next_request), ten to a request of one account and one window |
| A point two accounts list | It belongs to the account that listed it first (core.metering_point.account_id); the other's list writes its row of ingest.account_mp and nothing else (masterdata.Tree.register, Registered.foreign): no flag, no version, no reconciliation, no request. It is fetched with its owner's token only; while its owner is invalid it waits, and make status says so. Moving it to the other account is make account-remove of the owner and the other's next run (B75), never a silent switch |
| An account the worker holds no token for in this run | A token file refused at the start (B72f), a known account whose token file is gone, an access-token file that cannot be read: one row of ingest.token_notice each (rewritten at every start), a log line, a line of make status; its points wait, as an invalid account's do |
A day with three accounts, call by call. Accounts env (id 1), acme (2) and home (3), each with at most ten
points of one window (a private person's tree, a small company's), every token valid, the access tokens a day old
(an access token lasts 24 hours, so each account's daily run begins with a token call). At 05:30 plus the day's jitter
the scheduler queues three eloverblik-daily jobs, in that order; the main lane runs them one after another:
| t (s) | Account | Call | Why it is at t |
|---|---|---|---|
| 0 | env | GET /token | the first call of the day |
| 1 | env | GET meteringpoints (the list) | one spacing after the token call's completion |
| 2 | env | POST gettimeseries/[today−14, tomorrow)/Actual | one spacing later |
| 60 | acme | GET /token | the token-call spacing: 60 s after env's token call |
| 61 | acme | list | |
| 62 | acme | time series | |
| 120 | home | GET /token | 60 s after acme's |
| 121 | home | list | |
| 122 | home | time series |
Nine calls, six of them data calls, in about two minutes: the token-call spacing, not the data, sets the length.
With more points an account asks one time series request per ten points of a window, each a spacing after the last;
with tokens still valid (a run repeated the same day) the three runs are six calls in six seconds. A backfill run
queued meanwhile waits behind the daily jobs in the queue; on Sundays at 02:00 three eloverblik-weekly jobs ask
getdetails for each account's own points, ten to a request. If acme's token call answers 401, acme becomes
invalid at t = 60, its run fails (its slot's failure, counted for it alone) and home's token call is at t = 120 as
before; nothing more is asked with acme's token, and make status flags it and the points it owns, which wait. A
429 to any call cools the service: the next call of whichever account is not before the cooldown's end.
make status
make status runs python -m elo_worker.status in the running worker's container (the database is not published,
§12.1); it reads, writes nothing and makes no call. It prints counts, dates and codes only: no reading, no name,
no address, no metering point ID but the database's own number, nothing that can hold a token (a job's result passes a
filter that lets numbers, booleans and dates through and nothing else; test_status.py checks the output against
every name, address and ID in the database).
| Section | What it says |
|---|---|
| account | per account (B76): its ID, label, company and party kind, the state (! invalid), what of tokens/ it could not use in the worker's run (!, ingest.token_notice), the refresh token's expiry date and days left, whole local days as the pages count them (! at 60 or fewer, the page's threshold, §10.4, B19; ! when the expiry is not known), the credential generation, the last data call that answered 200, its last daily run, the points it owns and the points it also lists (owned by another account, fetched with that one's token only), and for an account that may not call, ! the points that wait (those another account lists, by mp_id). Then ! each token file refused and each stray of tokens/ (by its name alone, token.stray_sentence). No token and no fingerprint |
| egress | the owner (worker, capture, or none; ! when a token is configured and nobody owns it), the pacer's cooldown and the 503s in a row |
| runs | per job (daily, weekly, declaration, monthly re-pull, price run, price monthly re-pull, mix run, mix weekly run, mix monthly re-pull, transmission mix run, weekly run and monthly re-pull, backfill) when it last succeeded, its result, jobs failed since, queued jobs (! one that was due more than three polls ago and has no attempt open, with its age); the calls of the latest daily and weekly slot, all attempts together (calls of slot S: n attempt(s), data N, token M, from raw.fetch between the first attempt's start and the last's end: the lead's check with the owner's token reads this line); what is due and when: each scheduled job's latest slot, covered or not, and when the next opens; then the block stored facts: (B132; in this section, so that the count of sections stays what it was): first, when ELO_FACTS_LIVE is on, "the stored facts are switched off: every figure is computed from the readings (ELO_FACTS_LIVE)"; the root-days stored and the version; the stale ones, with the age of the oldest mark that has not failed (! when it is older than a day: the facts lane has not made it); those due now; each failed root-day by mp_id, day and SQLSTATE, with the words "computed from the readings on every request until it can be made" (!); the last run's root-days, seconds, rate and batches; ! for facts-refresh jobs failed since the last that succeeded |
| metering points | per mp_id: type, status, the readable range or "awaiting first data", the latest day with data (and overall), days stored, chunks by state, daily_failures and the last code, the days not confirmed by the latest daily attempt with their reason (verification failed, the code; not delivered), days observed absent, holes (days inside the readable range, older than 14 days, without a day row), and a price area that is missing |
| chunks | pending, no data (due, waiting), an ANALYZE owed, parked chunks with their code and next try, the windows in unresolved, invalid, outside, not_available, empty with their code |
| energi data service | the service's one pace (ingest.service_pace: no cooldown, or no call before …, !), and its spacing (B95: the configured spacing, the one the worker learned from the service's 429s and since when, the calls refused in the last day; ! only when the service refuses although the learned spacing is at its cap of 900 s); the declaration: its origin (generated or Energinet's), the latest hour, pending hours, notices, unknown columns, ! when it is not loaded outside the demo; the transmission factors (DeclarationTransmissionEmission, B80): the same lines under their own name, from the rows of fx.factor_hour dataset 2; the transmission mix (DeclarationTransmissionGridmix, B82): the grid mix's lines under its own name from the rows of fx.mix_hour dataset 2, and while eds-tx-mix is held back by the rule of the first load a plain line "awaiting the emission's inputs"; each price dataset (Elspotprices, DayAheadPrices, B52): the origin, what is loaded and its newest interval, stopped or not, unknown columns, the expected intervals without a price in the range that is loaded, up to the midnight that began today (an hour before 1 October 2025, a quarter from it; ! when there are any, by price area; the demo stops at its last price), and a failed last run of Elspotprices (!), the history rows by cause; the grid's mix (DeclarationGridmix, B53): the origin, what is loaded and its newest hour, the newest complete hour, stopped or not, unknown columns, the hours that are not complete by version and price area (plain lines: the newest hours are incomplete by nature), the hours without a row, the hours after the newest one that the service has not declared yet, and ! for a report group code ref.mix_code does not know, a connected area ref.code does not know, a row with a negative share and a row with no share or no version (each with its count and its first and last hour); a re-pull chain that failed (which dataset, how many times it was taken up, when the next is due; ! once given up after 8 take-ups, until a later re-pull of the dataset has ended) |
| unknown fields | the names (paths) of fields the allowlist does not know, with counts |
| partitions | the months of ts.reading left (! below 12) |
What is flagged ! although the run was done (B09v-03; each makes the exit code 3 and keeps "nothing needs attention" from
being printed): a latest daily run whose list request failed (list_failed), whose step 1 reconciled nothing (printed as the code
list_unreadable or list_empty, never as free text), or in which time series requests failed (and a weekly run's failed
requests); an expiry of the refresh token that is not known; an active account and no metering point; a declaration not loaded
outside the demo; the mix not loaded outside the demo, stopped, with an unknown column, with a code, a connected area, a share or a missing share or version the reference does not know (B53); a price dataset not loaded outside the demo, stopped, with an unknown column, with an expected interval
without a price (an hour before 1 October 2025, a quarter from it, in the range that is loaded up to today), whose last run
failed (Elspotprices, which ended: it never holds DayAheadPrices back) or a re-pull given up after 8 take-ups; the
service's pace in a cooldown; no egress owner while a token is configured; a database that holds generated readings (requests of source 9)
and is not the demo stack, with the way out (a clean database: make purge).
A result is printed through a filter: integers of at most nine digits, booleans, dates and times, and containers under keys that
are names ([a-z_]+) or HTTP status codes (three digits, call_statuses); every other string, number and key is dropped. The
egress owner record's mode and since go through the same kind of filter.
It never says "all is well" over something it could not look at. Every section is read on a connection of its
own; one that cannot be read is printed NOT LOOKED AT (<class name of the error>) and counted. The last line says
how many sections were looked at of how many, which were not, how many things need attention (each marked !
where it is printed and listed again), and only when every section was looked at and nothing needs attention, which
sections they were. Exit status of the program: 0 every section looked at and nothing needs attention; 3 every section looked at
and something does; 1 a section could not be looked at; 2 no database. make does not pass the code on: when the program ends
with 3, make prints make: *** [status] Error 3 and itself exits 2, as GNU make does for any failed recipe, so a script
cannot tell the three apart from make status's own exit code. The number in make's Error N line is the program's. A script
reads the exit code of the command the recipe runs, $(COMPOSE) exec -T worker python -m elo_worker.status (make -n status
prints it with the Compose files filled in; set COMPOSE_PROJECT_NAME as for make up). The demo stack (ELO_DEMO=1) says that
nothing is scheduled there, which is what the scheduler does (it queues nothing); a worker without a refresh token says so.
make demo
make demo is make up DEMO=1 and make demo-load DEMO=1: the generated organisation of elo_devtools.synth and the
frozen factor extract of §8 (fixtures/factors/) in a stack that **makes no call to Energi Data Service or
Eloverblik**: it never reads the owner's .env, blanks the token, has no Eloverblik runtime, and ELO_DEMO=1
(Compose passes it to the worker) keeps the scheduler from queueing any job (§8: in the demo stack nothing is scheduled). It has a Compose project (elo-demo) and a state directory (data/state-demo) of its own unless the
environment names others, so the owner's stack, its volume and its token files are not touched. The loader refuses a
database that holds a request of another source than the demo's (9), or an account whose credential is not the demo
token's: a database holds the demo's data or the owner's, never both; make purge starts the owner's stack
clean. The mirror of that refusal is the worker's: with a request of source 9 in raw.fetch the Eloverblik runtime does not
call (can_call() is false, so the scheduler and the backfill chain queue no Eloverblik job, and a job queued all the same is
refused with NotReady before any request; B09v-10), and make status flags it. It is decided when the worker builds its
runtime, so a database loaded after the worker started is seen at its next start; use make demo, never make up then
make demo-load, for the demo. Every generated reading and factor says so: raw.fetch.source = 9, fx.factor_hour.generated.
Two companies (B76). make demo-load (demo_load.main, which calls load_companies) loads the generator's two
accounts (elo_devtools.synth.DEMO_ACCOUNTS): env, "Egen konto", listing the municipal sites 1 to 5, and idraet-nord,
"Idrætsforeningen Nord" (a company's), listing the hall of site 6 and the workshop of site 5, which env lists first and
owns; each account's list, master data and readings are recorded under it. The demo has no token file: the demo
source needs no token, the demo stack's worker has none and never opens tokens/ (B72), and the second account's row
is written by the loader from a generated refresh token held in memory for its fingerprint (demo_load.demo_token),
never written to a file. load (one account listing every site) stays what phase 1's demo and the API's fixtures load.
The pages of the two-company demo offer the dimension "Selskab" and name a company whose account needs attention (B74, docs/queries.md "The accounts").
The stored facts (B132). The loader's last write is the removal of one root's price area, which marks that root's
days (every reading and factor it wrote marked its root-days before that). make demo-load then **waits until
fact.status() reports no due mark**, the running worker's facts lane (ELO_DEMO=1 does not stop it: it calls nobody)
having made them, and says how many root-days are stored (the stored facts are made: N root-days stored, S stale (F failed), no mark due). make demo therefore ends with every fact made and no call made: raw.fetch holds requests of
source 9 only, and ops.job no job of an Eloverblik or declaration kind. With no worker running the wait ends after 30
minutes with a sentence, not a hang. The demo's first load is a few seconds of the lane's work (B132's report has the
measure).
make demo-load is B16a's, adopted, with one change that follows from B09: the loader sends its quarters as daily
requests, and a quarter in which a root is not yet readable answers an access code, which step 4 now counts; the
loader therefore sets last the state it promises (every root with current access, status 1).
What is not here
- The lead's check with the owner's token (the run's calls, the latest day advancing) is the lead's; the counting is
built and tested on the demo source and on the replay server (
test_daily_live.py). - A daily run's crash after transaction A leaves a
raw.fetchrow without a response, as the specification says (http_statusNULL); the days of the window are then listed as not confirmed, with no code. Nothing recovers it as the chunk requests are recovered: the next day's run asks again.
Tests
services/worker/tests/test_daily.py (the daily run over simulated weeks on the demo source: CT-12, CT-14, AT-10,
RT-11, the 20-day outage, the correction applied once, the restored MP, step 1), test_daily_live.py (the same job
through the Customer API client, the PostgreSQL pace store and WorkerObserver), test_schedule.py,
test_status.py, test_worker_main.py (the loop queues the day's jobs by itself, once), tools/tests/test_demo_load.py.
Several accounts (B76): test_b76_accounts_running.py (two accounts load side by side through the worker's loop; PT-02
and PT-13 with two accounts; a 429 and a 503 cool both; the second account's invalid token; a point whose owner is
invalid waits; the runs per account), test_b76_status.py, tools/tests/test_b76_demo.py; the stand-in is
elo_devtools.accounts_harness.TwoAccounts.
A first load is made once for a module and copied for each test (daily_harness.loaded); a morning is
Simulation.morning(day), which sets the clock, never sleeps.
Kilde: docs/daily-run.md i løsningens
repository.