mirror of
https://github.com/wassname/ray.git
synced 2026-07-10 17:26:42 +08:00
[rllib] Rename ServingEnv => ExternalEnv (#3302)
This commit is contained in:
@@ -29,7 +29,7 @@ parser.add_argument(
|
||||
if __name__ == "__main__":
|
||||
args = parser.parse_args()
|
||||
env = gym.make("CartPole-v0")
|
||||
client = PolicyClient("http://localhost:8900")
|
||||
client = PolicyClient("http://localhost:9900")
|
||||
|
||||
eid = client.start_episode(training_enabled=not args.no_train)
|
||||
obs = env.reset()
|
||||
|
||||
@@ -14,19 +14,19 @@ import numpy as np
|
||||
|
||||
import ray
|
||||
from ray.rllib.agents.dqn import DQNAgent
|
||||
from ray.rllib.env.serving_env import ServingEnv
|
||||
from ray.rllib.env.external_env import ExternalEnv
|
||||
from ray.rllib.utils.policy_server import PolicyServer
|
||||
from ray.tune.logger import pretty_print
|
||||
from ray.tune.registry import register_env
|
||||
|
||||
SERVER_ADDRESS = "localhost"
|
||||
SERVER_PORT = 8900
|
||||
SERVER_PORT = 9900
|
||||
CHECKPOINT_FILE = "last_checkpoint.out"
|
||||
|
||||
|
||||
class CartpoleServing(ServingEnv):
|
||||
class CartpoleServing(ExternalEnv):
|
||||
def __init__(self):
|
||||
ServingEnv.__init__(
|
||||
ExternalEnv.__init__(
|
||||
self, spaces.Discrete(2),
|
||||
spaces.Box(low=-10, high=10, shape=(4, ), dtype=np.float32))
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ pkill -f cartpole_server.py
|
||||
(python cartpole_server.py 2>&1 | grep -v 200) &
|
||||
pid=$!
|
||||
|
||||
while ! curl localhost:8900; do
|
||||
while ! curl localhost:9900; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user