Continuous Batching Admission
An inference scheduler sees waiting requests in arrival order. Each request is [id, new_tokens]. Implement admit_requests(waiting, token_budget, max_requests) and return admitted IDs. Scan in order. Admit a request if its token cost fits the remaining budget and there is an open request slot; otherwise skip it and continue. A later smaller request may fit. Token costs are nonnegative; IDs are unique; budgets are nonnegative. Stop after max_requests admissions.
Examples
A guided view of the published example, not a trace of your code.
[[["a",5],["b",9],["c",2]],7,2]["a","c"]Start with the input values shown in this example.
Input: waiting = [["a",5],["b",9],["c",2]], token_budget = 7, max_requests = 2
Output: ["a","c"]
Explanation: skip oversized
Input: waiting = [["a",1],["b",1]], token_budget = 10, max_requests = 1
Output: ["a"]
Explanation: request limit
Hint 1
Keep scanning after a request does not fit.
Hint 2
Track request slots and token capacity separately.