|
| 1 | +/* |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * All rights reserved. |
| 4 | + * |
| 5 | + * This source code is licensed under the BSD-style license found in the |
| 6 | + * LICENSE file in the root directory of this source tree. |
| 7 | + */ |
| 8 | + |
| 9 | +#![allow(dead_code)] |
| 10 | + |
| 11 | +use hyperactor::Named; |
| 12 | +/// This module defines common types for mesh resources. Meshes are managed as |
| 13 | +/// resources, usually by a controller actor implementing the [`crate::resource`] |
| 14 | +/// behavior. |
| 15 | +/// |
| 16 | +/// The mesh controller manages all aspects of the mesh lifecycle, and the owning |
| 17 | +/// actor uses the resource behavior directly to query the state of the mesh. |
| 18 | +use ndslice::Extent; |
| 19 | +use serde::Deserialize; |
| 20 | +use serde::Serialize; |
| 21 | + |
| 22 | +use crate::resource::CreateOrUpdate; |
| 23 | +use crate::resource::GetState; |
| 24 | +use crate::resource::Status; |
| 25 | +use crate::resource::Stop; |
| 26 | +use crate::v1::ValueMesh; |
| 27 | + |
| 28 | +/// Mesh specs |
| 29 | +#[derive(Debug, Named, Serialize, Deserialize)] |
| 30 | +pub struct Spec<S> { |
| 31 | + /// All meshes have an extent |
| 32 | + extent: Extent, |
| 33 | + // supervisor: PortHandle<SupervisionEvent(?)> |
| 34 | + /// The mesh-specific spec. |
| 35 | + spec: S, |
| 36 | +} |
| 37 | + |
| 38 | +/// Mesh states |
| 39 | +#[derive(Debug, Named, Serialize, Deserialize)] |
| 40 | +pub struct State<S> { |
| 41 | + /// The current status for each rank in the mesh. |
| 42 | + statuses: ValueMesh<Status>, |
| 43 | + /// Mesh-specific state. |
| 44 | + state: S, |
| 45 | +} |
| 46 | + |
| 47 | +// The behavior of a mesh controllšr. |
| 48 | +// hyperactor::behavior!( |
| 49 | +// Controller<Sp, St>, |
| 50 | +// CreateOrUpdate<Spec<Sp>>, |
| 51 | +// GetState<State<St>>, |
| 52 | +// Stop, |
| 53 | +// ); |
0 commit comments