Fairness header for executor dispatches. Structure-tool dispatches are workflow-execution work — both ETL and API workflows route through here. ``NON_API`` is the safe default (API traffic preempting is a strictly weaker mistake than the inverse). TODO(UN-3504): propagate the c
(
organization_id: str,
)
| 41 | |
| 42 | |
| 43 | def _fairness_headers( |
| 44 | organization_id: str, |
| 45 | ) -> dict[str, dict[str, str | int | None]]: |
| 46 | """Fairness header for executor dispatches. |
| 47 | |
| 48 | Structure-tool dispatches are workflow-execution work — both ETL |
| 49 | and API workflows route through here. ``NON_API`` is the safe |
| 50 | default (API traffic preempting is a strictly weaker mistake than |
| 51 | the inverse). |
| 52 | |
| 53 | TODO(UN-3504): propagate the caller's WorkloadType (API vs ETL) |
| 54 | instead of hard-coding ``NON_API``. Requires the chord-lift work |
| 55 | so the workflow type flows from the chord caller down to here. |
| 56 | """ |
| 57 | return FairnessKey( |
| 58 | org_id=organization_id, |
| 59 | workload_type=WorkloadType.NON_API, |
| 60 | ).as_header() |
| 61 | |
| 62 | |
| 63 | # ----------------------------------------------------------------------- |