Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rllib] Add timeout to filter synchronization #25959

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Sven's comments
  • Loading branch information
ArturNiederfahrenhorst committed Jun 23, 2022
commit 62d6b7df7477069b96286901c8309808dbd63bd1
4 changes: 3 additions & 1 deletion rllib/algorithms/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,9 @@ def _is_multi_agent(self):
'(e.g., YourEnvCls) or a registered env id (e.g., "your_env").'
)

def _sync_filters_if_needed(self, workers: WorkerSet, timeout_seconds: int = None):
def _sync_filters_if_needed(
self, workers: WorkerSet, timeout_seconds: Optional[float] = None
):
if self.config.get("observation_filter", "NoFilter") != "NoFilter":
FilterManager.synchronize(
workers.local_worker().filters,
Expand Down
2 changes: 1 addition & 1 deletion rllib/algorithms/algorithm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def __init__(self, algo_class=None):
# TODO: Set this flag still in the config or - much better - in the
# RolloutWorker as a property.
self.in_evaluation = False
self.sync_filters_on_rollout_workers_timeout_s = 60
self.sync_filters_on_rollout_workers_timeout_s = 60.0

# `self.reporting()`
self.keep_per_episode_custom_metrics = False
Expand Down
6 changes: 5 additions & 1 deletion rllib/utils/filter_manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from typing import Optional

import ray
from ray.rllib.utils.annotations import DeveloperAPI
Expand All @@ -16,7 +17,10 @@ class FilterManager:
@staticmethod
@DeveloperAPI
def synchronize(
local_filters, remotes, update_remote=True, timeout_seconds: int = None
local_filters,
remotes,
update_remote=True,
timeout_seconds: Optional[float] = None,
):
"""Aggregates all filters from remote evaluators.

Expand Down