Struct border_async_trainer::ActorManager
source · pub struct ActorManager<A, E, R, P>where
A: Agent<E, R> + SyncModel,
E: Env,
P: StepProcessorBase<E>,
R: ReplayBufferBase<PushedItem = P::Output>,{ /* private fields */ }
Expand description
Manages Actor
s.
This struct handles the following requests:
- From the LearnerManager for updating the latest model info, stored in this struct.
- From the
Actor
s for getting the latest model info. - From the
Actor
s for pushing sample batch to theLearnerManager
.
Implementations§
source§impl<A, E, R, P> ActorManager<A, E, R, P>where
A: Agent<E, R> + SyncModel,
E: Env,
P: StepProcessorBase<E>,
R: ReplayBufferBase<PushedItem = P::Output> + Send + 'static,
A::Config: Send + 'static,
E::Config: Send + 'static,
P::Config: Send + 'static,
R::PushedItem: Send + 'static,
A::ModelInfo: Send + 'static,
impl<A, E, R, P> ActorManager<A, E, R, P>where A: Agent<E, R> + SyncModel, E: Env, P: StepProcessorBase<E>, R: ReplayBufferBase<PushedItem = P::Output> + Send + 'static, A::Config: Send + 'static, E::Config: Send + 'static, P::Config: Send + 'static, R::PushedItem: Send + 'static, A::ModelInfo: Send + 'static,
sourcepub 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::PushedItem>>,
model_info_receiver: Receiver<(usize, A::ModelInfo)>,
stop: Arc<Mutex<bool>>
) -> Self
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::PushedItem>>, model_info_receiver: Receiver<(usize, A::ModelInfo)>, stop: Arc<Mutex<bool>> ) -> Self
Builds a ActorManager.
sourcepub fn run(&mut self, guard_init_env: Arc<Mutex<bool>>)
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.
A thread will wait for the initial SyncModel::ModelInfo from AsyncTrainer, which blocks execution of Actor threads.
sourcepub fn stop_and_join(self) -> Vec<ActorStat>
pub fn stop_and_join(self) -> Vec<ActorStat>
Stops and joins actors.
Auto Trait Implementations§
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 R: Send, <A as Policy<E>>::Config: Send, <E as Env>::Config: Send, <P as StepProcessorBase<E>>::Config: Send, <A as SyncModel>::ModelInfo: Send, <P as StepProcessorBase<E>>::Output: Send,
impl<A, E, R, P> Sync for ActorManager<A, E, R, P>where R: Sync, <A as Policy<E>>::Config: Sync, <E as Env>::Config: Sync, <P as StepProcessorBase<E>>::Config: Sync, <A as SyncModel>::ModelInfo: Send, <P as StepProcessorBase<E>>::Output: Send,
impl<A, E, R, P> Unpin for ActorManager<A, E, R, P>where R: Unpin, <A as Policy<E>>::Config: Unpin, <E as Env>::Config: Unpin, <P as StepProcessorBase<E>>::Config: Unpin, <A as SyncModel>::ModelInfo: Unpin, <P as StepProcessorBase<E>>::Output: Unpin,
impl<A, E, R, P> !UnwindSafe for ActorManager<A, E, R, P>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more