Python gym.monitoring() Examples

The following are 3 code examples of gym.monitoring(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gym , or try the search function .
Example #1
Source File: gym_env.py    From pixelworld with MIT License 5 votes vote down vote up
def set_log_dir(self, log_dir):
        if self.env.monitor.enabled:
            self.env.monitor.close()

        if log_dir is not None:
            self.env.monitor.start(log_dir, self.video_schedule)
            self.monitoring = True
        else:
            self.monitoring = False 
Example #2
Source File: gym_env.py    From pixelworld with MIT License 5 votes vote down vote up
def terminate(self):
        if self.monitoring:
            self.env.monitor.close()
        self.env.close()  # Prevents a memory leak  

    # NB: adding a close(self) routine that also closes the env does not have any effect 
Example #3
Source File: gym_environment.py    From RL_toolbox with MIT License 5 votes vote down vote up
def __init__(self, env, pms, type="origin"):
        self.env = env
        self.type = type
        self.video_schedule = None
        self.pms = pms
        if not self.pms.record_movie:
            self.video_schedule = NoVideoSchedule()
        else:
            if self.video_schedule is not None:
                self.video_schedule = CappedCubicVideoSchedule()
            self.env.monitor.start("log/trpo" ,self.video_schedule, force=True)
            self.monitoring = True