mirror of
https://github.com/vale981/ray
synced 2025-03-06 02:21:39 -05:00
[tune/rllib] Only disable ipython in remote actors (#18789)
This commit is contained in:
parent
f71cfca439
commit
e39b0f785e
1 changed files with 10 additions and 1 deletions
|
@ -76,7 +76,8 @@ class Trainable:
|
|||
self.config = config or {}
|
||||
trial_info = self.config.pop(TRIAL_INFO, None)
|
||||
|
||||
disable_ipython()
|
||||
if self.is_actor():
|
||||
disable_ipython()
|
||||
|
||||
self._result_logger = self._logdir = None
|
||||
self._create_logger(self.config, logger_creator)
|
||||
|
@ -153,6 +154,14 @@ class Trainable:
|
|||
self._local_ip = ray.util.get_node_ip_address()
|
||||
return self._local_ip
|
||||
|
||||
def is_actor(self):
|
||||
try:
|
||||
actor_id = ray.worker.global_worker.actor_id
|
||||
return actor_id != actor_id.nil()
|
||||
except Exception:
|
||||
# If global_worker is not instantiated, we're not in an actor
|
||||
return False
|
||||
|
||||
def train_buffered(self,
|
||||
buffer_time_s: float,
|
||||
max_buffer_length: int = 1000):
|
||||
|
|
Loading…
Add table
Reference in a new issue