solve
solve
¶
Hardware allocation solver.
Given a HardwareRequest and DispatchConfig, find the best allocation.
SolveResult(result: HardwareResult | None, host_name: str | None, host_config: PlainHostConfig | SlurmHostConfig | None, is_slurm: bool, partition: str | None)
dataclass
¶
Result of solving for hardware allocation.
solve(request: HardwareRequest, config: DispatchConfig, check_availability: bool = False, timeout: float = 30.0) -> SolveResult
¶
Solve for hardware allocation given a request and config.
Strategy: 1. Check all hosts in priority order (plain and SLURM equally) 2. Return first host that can satisfy the request 3. If none satisfy, fall back to SLURM with most availability
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
HardwareRequest
|
Hardware requirements (chip type, min chips, cluster preferences) |
required |
config
|
DispatchConfig
|
Dispatch configuration with hosts |
required |
check_availability
|
bool
|
If True, query SLURM for real-time availability |
False
|
timeout
|
float
|
SSH timeout for availability checks |
30.0
|
Returns:
| Type | Description |
|---|---|
SolveResult
|
SolveResult with allocation details, or None if unsatisfiable |
solve_or_raise(request: HardwareRequest, config: DispatchConfig, check_availability: bool = False, timeout: float = 30.0) -> SolveResult
¶
Like solve(), but raises if no solution found.