garage.sampler.stateful_pool module¶
Bases:
object
-
class
StatefulPool
[source]¶ Bases:
object
-
run_collect
(collect_once, threshold, args=None, show_prog_bar=True)[source]¶ Run the collector method using the worker pool. The collect_once method will receive ‘g’ as its first argument, followed by the provided args, if any. The method should return a pair of values. The first should be the object to be collected, and the second is the increment to be added. This will continue until the total increment reaches or exceeds the given threshold.
Sample script:
- def collect_once(g):
- return ‘a’, 1
stateful_pool.run_collect(collect_once, threshold=3) # should return [‘a’, ‘a’, ‘a’]
Parameters: - collector –
- threshold –
Returns:
-