# Path: osim/redis/messages.py
# class OSIM_RL:
#     PING = "OSIM_RL.PING"
#     PONG = "OSIM_RL.PONG"
#     ENV_CREATE = "OSIM_RL.ENV_CREATE"
#     ENV_CREATE_RESPONSE = "OSIM_RL.ENV_CREATE_RESPONSE"
#     ENV_RESET = "OSIM_RL.ENV_RESET"
#     ENV_RESET_RESPONSE = "OSIM_RL.ENV_RESET_RESPONSE"
#     ENV_STEP = "OSIM_RL.ENV_STEP"
#     ENV_STEP_RESPONSE = "OSIM_RL.ENV_STEP_RESPONSE"
#     ENV_SUBMIT = "OSIM_RL.ENV_SUBMIT"
#     ENV_SUBMIT_RESPONSE = "OSIM_RL.ENV_SUBMIT_RESPONSE"
#     ERROR = "OSIM_RL.ERROR"


import redis
import json
import numpy as np
import msgpack
import msgpack_numpy as m
import osim
import os
import timeout_decorator
import time
    import argparse
from osim.redis import messages
from osim.env import *
        self.report = report
        self.max_steps = max_steps
        self.initalize_seed_map(seed_map)

    def initalize_seed_map(self, seed_map_string):
        if seed_map_string:
            assert type(seed_map_string) == type("")
            seed_map = seed_map_string.split(",")
            seed_map = [int(x) for x in seed_map]
            self.seed_map = seed_map
        else:
            self.seed_map = [np.random.randint(0,10**10)]

    def get_redis_connection(self):
        redis_conn = redis.Redis(connection_pool=self.redis_pool)
        try:
            redis_conn.ping()
        except:
            raise Exception(
                    "Unable to connect to redis server at {}:{} ."
                    "Are you sure there is a redis-server running at the "
                    "specified location ?".format(
                        self.remote_host,
                        self.remote_port
                        )
                    )
        return redis_conn

    def _error_template(self, payload):
        _response = {}

# Path: osim/redis/messages.py
# class OSIM_RL:
#     PING = "OSIM_RL.PING"
#     PONG = "OSIM_RL.PONG"
#     ENV_CREATE = "OSIM_RL.ENV_CREATE"
#     ENV_CREATE_RESPONSE = "OSIM_RL.ENV_CREATE_RESPONSE"
#     ENV_RESET = "OSIM_RL.ENV_RESET"
#     ENV_RESET_RESPONSE = "OSIM_RL.ENV_RESET_RESPONSE"
#     ENV_STEP = "OSIM_RL.ENV_STEP"
#     ENV_STEP_RESPONSE = "OSIM_RL.ENV_STEP_RESPONSE"
#     ENV_SUBMIT = "OSIM_RL.ENV_SUBMIT"
#     ENV_SUBMIT_RESPONSE = "OSIM_RL.ENV_SUBMIT_RESPONSE"
#     ERROR = "OSIM_RL.ERROR"


# Path: osim/redis/service.py
import redis
import json
import numpy as np
import msgpack
import msgpack_numpy as m
import osim
import os
import timeout_decorator
import time
    import argparse
from osim.redis import messages
from osim.env import *

        self.report = report
        self.max_steps = max_steps
        self.initalize_seed_map(seed_map)

    def initalize_seed_map(self, seed_map_string):
        if seed_map_string:
            assert type(seed_map_string) == type("")
            seed_map = seed_map_string.split(",")
            seed_map = [int(x) for x in seed_map]
            self.seed_map = seed_map
        else:
            self.seed_map = [np.random.randint(0,10**10)]

    def get_redis_connection(self):
        redis_conn = redis.Redis(connection_pool=self.redis_pool)
        try:
            redis_conn.ping()
        except:
            raise Exception(
                    "Unable to connect to redis server at {}:{} ."
                    "Are you sure there is a redis-server running at the "
                    "specified location ?".format(
                        self.remote_host,
                        self.remote_port
                        )
                    )
        return redis_conn

    def _error_template(self, payload):
        _response = {}

        _response['type'] = messages.OSIM_RL.ERROR