aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / crates / aien-switchboard / src / job.rs
| 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | |
| 16 | //! Jobs: what the operator wants done. |
| 17 | |
| 18 | use serde::Deserialize; |
| 19 | use std::fmt; |
| 20 | |
| 21 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Deserialize)] |
| 22 | #[serde(rename_all = "lowercase")] |
| 23 | pub enum JobKind { |
| 24 | Code, |
| 25 | Review, |
| 26 | Research, |
| 27 | } |
| 28 | |
| 29 | impl JobKind { |
| 30 | pub const ALL: [JobKind; 3] = [JobKind::Code, JobKind::Review, JobKind::Research]; |
| 31 | |
| 32 | pub fn as_str(self) -> &'static str { |
| 33 | match self { |
| 34 | JobKind::Code => "code", |
| 35 | JobKind::Review => "review", |
| 36 | JobKind::Research => "research", |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | impl fmt::Display for JobKind { |
| 42 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 43 | f.write_str(self.as_str()) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | /// Rough size of the job. v1 routing does not use it yet; it is carried so |
| 48 | /// the type is stable when size-aware rules arrive. |
| 49 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
| 50 | pub enum JobSize { |
| 51 | Small, |
| 52 | Medium, |
| 53 | Large, |
| 54 | } |
| 55 | |
| 56 | /// `needs` (what a job requires of an account) is deliberately absent: no |
| 57 | /// first-party source on this machine says what each program can or cannot |
| 58 | /// do, so adding it now would be a guess. UNKNOWN, tracked for a later cut. |
| 59 | #[derive(Debug, Clone, PartialEq, Eq)] |
| 60 | pub struct Job { |
| 61 | pub kind: JobKind, |
| 62 | pub size: JobSize, |
| 63 | } |
| 64 | |
| 65 | impl Job { |
| 66 | pub fn new(kind: JobKind, size: JobSize) -> Self { |
| 67 | Job { kind, size } |
| 68 | } |
| 69 | } |