Struct ActorManager

Source
pub struct ActorManager<A, E, R, P>{ /* private fields */ }
Expand description

Manages Actors.

This struct handles the following requests:

  • From the AsyncTrainer for updating the latest model info, stored in this struct.
  • From the Actors for getting the latest model info.
  • From the Actors for pushing sample batch to the LearnerManager.

Implementations§

Source§

impl<A, E, R, P> ActorManager<A, E, R, P>
where A: Agent<E, R> + Configurable + SyncModel + 'static, E: Env, P: StepProcessor<E>, R: ExperienceBufferBase<Item = P::Output> + Send + 'static + ReplayBufferBase, A::Config: Send + 'static, E::Config: Send + 'static, P::Config: Send + 'static, R::Item: Send + 'static, A::ModelInfo: Send + 'static,

Source

pub fn build( config: &ActorManagerConfig, agent_configs: &Vec<A::Config>, env_config: &E::Config, step_proc_config: &P::Config, pushed_item_message_sender: Sender<PushedItemMessage<R::Item>>, model_info_receiver: Receiver<(usize, A::ModelInfo)>, stop: Arc<Mutex<bool>>, ) -> Self

Builds a ActorManager.

Source

pub fn run(&mut self, guard_init_env: Arc<Mutex<bool>>)

Runs threads for Actors and a thread for sending samples into the replay buffer.

Each thread is blocked until receiving the initial SyncModel::ModelInfo from AsyncTrainer.

Source

pub fn join(self) -> Vec<ActorStat>

Waits until all actors finish.

Source

pub fn stop(&self)

Stops actor threads.

Source

pub fn stop_and_join(self) -> Vec<ActorStat>

Stops and joins actors.

Auto Trait Implementations§

§

impl<A, E, R, P> Freeze for ActorManager<A, E, R, P>
where <E as Env>::Config: Freeze, <P as StepProcessor<E>>::Config: Freeze,

§

impl<A, E, R, P> !RefUnwindSafe for ActorManager<A, E, R, P>

§

impl<A, E, R, P> Send for ActorManager<A, E, R, P>
where <E as Env>::Config: Send, <P as StepProcessor<E>>::Config: Send, R: Send, <A as SyncModel>::ModelInfo: Send, <A as Configurable>::Config: Send, <P as StepProcessor<E>>::Output: Send,

§

impl<A, E, R, P> Sync for ActorManager<A, E, R, P>
where <E as Env>::Config: Sync, <P as StepProcessor<E>>::Config: Sync, R: Sync, <A as SyncModel>::ModelInfo: Send, <A as Configurable>::Config: Sync, <P as StepProcessor<E>>::Output: Send,

§

impl<A, E, R, P> Unpin for ActorManager<A, E, R, P>
where <E as Env>::Config: Unpin, <P as StepProcessor<E>>::Config: Unpin, R: Unpin, <A as Configurable>::Config: Unpin, <A as SyncModel>::ModelInfo: Unpin, <P as StepProcessor<E>>::Output: Unpin,

§

impl<A, E, R, P> !UnwindSafe for ActorManager<A, E, R, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V