Skip to main content

Allocation Windows

AllocationWindowsComponent posts to an OEM's Slack channel when an allocation window opens. An allocation window is open when the OMS has allocated units in it. Every dealer of a market has the same current window, so any captured session can read it.

Sensors​

One sensor per OMS reads the current window. Each sensor runs during the business hours in its business_hours setting and stops its OMS requests after its deadline_seconds. It requests no materialization unless a window opens.

A dealer can have no units in the window. A sensor therefore reads the window with up to max_sessions_read sessions, freshest first, and uses the first session whose dealer has units. When none of those dealers has units, the sensor treats the window as not open. The Stellantis sensor reads the sessions one at a time and stops at the first dealer with units. The Audi sensor takes the freshest session of each user and reads those sessions in parallel.

For an open window without a partition, the sensor adds the partition and requests a materialization of that partition of allocation_windows. The materialization posts the message. When the window opened more than max_days_late days before the sensor first sees it, the sensor adds the partition and requests no materialization. The sensor counts the days in the business_hours timezone. A sensor that starts more than max_days_late days after a window opened therefore posts nothing for that window.

OEMSensorSource
Audiaudi_us_accessaudi (AccessAudiSensorComponent)allocation periods
Stellantisstellantis_us_dealerconnect (DealerConnectSensorComponent)allocation report

Asset​

<oem>/<market>/reporting/allocation_windows has one dynamic partition per window that opened.

A failed run leaves its partition unmaterialized. A sensor skips a window that has a partition, so it requests no second materialization. To retry, re-execute the failed run.

type: ai_dagster.components.AllocationWindowsComponent
attributes:
asset: <oem>/<market>/reporting/allocation_windows
label: <OEM and market name>
slack_channel: <channel ID>

The slack resource reads its bot token from the SLACK_BOT_TOKEN environment variable. When that variable is unset, it reads the Secrets Manager secret that SLACK_BOT_TOKEN_SECRET_ID names, dagster/slack/bot-token.