pub struct DMSCResourcePool { /* private fields */ }Expand description
Resource pool for managing multiple similar devices
This struct manages a pool of devices of the same type, tracking their availability, allocation status, and capacity. It provides methods for adding/removing devices, allocating/releasing devices, and collecting statistics.
Implementations§
Source§impl DMSCResourcePool
impl DMSCResourcePool
Sourcepub fn new(config: DMSCResourcePoolConfig) -> Self
pub fn new(config: DMSCResourcePoolConfig) -> Self
Sourcepub fn add_device(&mut self, device: Arc<DMSCDevice>) -> bool
pub fn add_device(&mut self, device: Arc<DMSCDevice>) -> bool
Sourcepub fn remove_device(&mut self, device_id: &str) -> bool
pub fn remove_device(&mut self, device_id: &str) -> bool
Sourcepub fn get_status(&self) -> DMSCResourcePoolStatus
pub fn get_status(&self) -> DMSCResourcePoolStatus
Gets the current status of the pool
This method returns a DMSCResourcePoolStatus struct containing information about the pool’s capacity, allocation, and utilization.
§Returns
A DMSCResourcePoolStatus struct with the current pool status
Sourcepub fn device_type(&self) -> DMSCDeviceType
pub fn device_type(&self) -> DMSCDeviceType
Sourcepub fn get_devices(&self) -> Vec<Arc<DMSCDevice>>
pub fn get_devices(&self) -> Vec<Arc<DMSCDevice>>
Gets all devices in the pool
§Returns
A vector of Arc<DMSCDevice> containing all devices in the pool
Sourcepub fn get_available_devices(&self) -> Vec<Arc<DMSCDevice>>
pub fn get_available_devices(&self) -> Vec<Arc<DMSCDevice>>
Gets available devices in the pool
§Returns
A vector of Arc<DMSCDevice> containing only available devices
Sourcepub fn get_allocated_devices(&self) -> Vec<Arc<DMSCDevice>>
pub fn get_allocated_devices(&self) -> Vec<Arc<DMSCDevice>>
Gets allocated devices in the pool
§Returns
A vector of Arc<DMSCDevice> containing only allocated devices
Sourcepub fn has_available_capacity(&self) -> bool
pub fn has_available_capacity(&self) -> bool
Checks if the pool has available capacity
§Returns
true if the pool has available devices, false otherwise
Sourcepub fn utilization_rate(&self) -> f64
pub fn utilization_rate(&self) -> f64
Gets the utilization rate of the pool (0.0 - 1.0)
§Returns
The utilization rate as a floating-point number between 0.0 and 1.0
Sourcepub fn is_healthy(&self) -> bool
pub fn is_healthy(&self) -> bool
Checks if the pool is healthy
A pool is considered healthy if it has available devices or allocated devices.
§Returns
true if the pool is healthy, false otherwise
Sourcepub fn get_statistics(&self) -> DMSCResourcePoolStatistics
pub fn get_statistics(&self) -> DMSCResourcePoolStatistics
Gets comprehensive statistics for the pool
This method calculates and returns comprehensive statistics for the pool, including device counts, utilization, total compute units, memory, storage, bandwidth, and average health score.
§Returns
A DMSCResourcePoolStatistics struct with comprehensive pool statistics
Trait Implementations§
Source§impl<'py> IntoPyObject<'py> for DMSCResourcePool
impl<'py> IntoPyObject<'py> for DMSCResourcePool
Source§type Target = DMSCResourcePool
type Target = DMSCResourcePool
Source§type Output = Bound<'py, <DMSCResourcePool as IntoPyObject<'py>>::Target>
type Output = Bound<'py, <DMSCResourcePool as IntoPyObject<'py>>::Target>
Source§fn into_pyobject(
self,
py: Python<'py>,
) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>
Source§impl PyClass for DMSCResourcePool
impl PyClass for DMSCResourcePool
Source§impl PyClassImpl for DMSCResourcePool
impl PyClassImpl for DMSCResourcePool
Source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
Source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
Source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
Source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
Source§const IS_IMMUTABLE_TYPE: bool = false
const IS_IMMUTABLE_TYPE: bool = false
Source§const RAW_DOC: &'static CStr = /// allocating/releasing devices, and collecting statistics.
const RAW_DOC: &'static CStr = /// allocating/releasing devices, and collecting statistics.
Source§const DOC: &'static CStr
const DOC: &'static CStr
text_signature if a constructor is defined. Read moreSource§type ThreadChecker = SendablePyClass<DMSCResourcePool>
type ThreadChecker = SendablePyClass<DMSCResourcePool>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
Source§impl PyTypeInfo for DMSCResourcePool
impl PyTypeInfo for DMSCResourcePool
Source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.impl DerefToPyAny for DMSCResourcePool
impl ExtractPyClassWithClone for DMSCResourcePool
Auto Trait Implementations§
impl Freeze for DMSCResourcePool
impl RefUnwindSafe for DMSCResourcePool
impl Send for DMSCResourcePool
impl Sync for DMSCResourcePool
impl Unpin for DMSCResourcePool
impl UnwindSafe for DMSCResourcePool
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self into an owned Python object, dropping type information and unbinding it
from the 'py lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self into a Python object. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
§const NAME: &'static str = T::NAME
const NAME: &'static str = T::NAME
§fn type_check(object: &Bound<'_, PyAny>) -> bool
fn type_check(object: &Bound<'_, PyAny>) -> bool
§fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
fn classinfo_object(py: Python<'_>) -> Bound<'_, PyAny>
isinstance and issubclass function. Read more