[rllib] Deprecate policy optimizers (#8345)

This commit is contained in:
Eric Liang
2020-05-21 10:16:18 -07:00
committed by GitHub
parent d27e6da1b2
commit 9a83908c46
80 changed files with 2194 additions and 1100 deletions
-8
View File
@@ -29,18 +29,10 @@ def test_metrics(ray_start_regular_shared):
it = it.gather_sync().for_each(f)
it2 = it2.gather_sync().for_each(f)
# Context cannot be accessed outside the iterator.
with pytest.raises(ValueError):
LocalIterator.get_metrics()
# Tests iterators have isolated contexts.
assert it.take(4) == [1, 3, 6, 10]
assert it2.take(4) == [1, 3, 6, 10]
# Context cannot be accessed outside the iterator.
with pytest.raises(ValueError):
LocalIterator.get_metrics()
def test_zip_with_source_actor(ray_start_regular_shared):
it = from_items([1, 2, 3, 4], num_shards=2)
+2 -9
View File
@@ -670,15 +670,8 @@ class LocalIterator(Generic[T]):
@contextmanager
def _metrics_context(self):
if hasattr(self.thread_local, "metrics"):
prev_metrics = self.thread_local.metrics
else:
prev_metrics = None
try:
self.thread_local.metrics = self.shared_metrics.get()
yield
finally:
self.thread_local.metrics = prev_metrics
self.thread_local.metrics = self.shared_metrics.get()
yield
def __iter__(self):
self._build_once()