garage.sampler.parallel_sampler module

Original parallel sampler pool backend.

close()[source]

Close the worker pool.

initialize(n_parallel)[source]

Initialize the worker pool.

populate_task(env, policy, scope=None)[source]

Set each worker’s env and policy.

sample_paths(policy_params, max_samples, max_path_length=inf, scope=None)[source]

Sample paths from each worker.

Parameters:
  • policy_params – parameters for the policy. This will be updated on each worker process
  • max_samples – desired maximum number of samples to be collected. The actual number of collected samples might be greater since all trajectories will be rolled out either until termination or until max_path_length is reached
  • max_path_length – horizon / maximum length of a single trajectory
Returns:

a list of collected paths

set_seed(seed)[source]

Set the seed in each worker.

terminate_task(scope=None)[source]

Close each worker’s env and terminate each policy.