Handle_data loop control

#1

I was wondering if anyone would be able to point me in the right direction with regards to how the handle_data function loops. I’ll explain what I’m trying to achieve, there may be a simpler solution but after a couple days on this I may be over-complicating it.

I was hoping to use it like a gym environment with following format:

import gym
from gym import spaces

class CustomEnv(gym.Env):
  """Custom Environment that follows gym interface"""
  metadata = {'render.modes': ['human']}

  def __init__(self, arg1, arg2, ...):
    super(CustomEnv, self).__init__()

  def step(self, action):
        #returns observation, reward, done, info{}
    ...
  def reset(self):

    ...
  def render(self, mode='human', close=False):
    ...

Using step in place of handle_data, can anyone suggest a way in which (while keeping the session running) I can externalise control of the next run. Open to alternative suggestions too, I may be well be missing something really obvious.

Any help would be really appreciated!

0 Likes