Skip to content

Commit

Permalink
Merge pull request berkeleyflow#47 from berkeleyflow/port_fix3
Browse files Browse the repository at this point in the history
moved port method
  • Loading branch information
eugenevinitsky authored Jun 9, 2018
2 parents 7928af1 + 37e3081 commit 89945a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 3 additions & 0 deletions flow/envs/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def __init__(self, env_params, sumo_params, scenario):
self.env_params = env_params
self.scenario = scenario
self.sumo_params = sumo_params
time_stamp = ''.join(str(time.time()).split('.'))
time.sleep(8.0 * int(time_stamp[-6:]) / 1e6)
self.sumo_params.port = sumolib.miscutils.getFreeSocketPort()
self.vehicles = scenario.vehicles
self.traffic_lights = scenario.traffic_lights
# time_counter: number of steps taken since the start of a rollout
Expand Down
4 changes: 0 additions & 4 deletions flow/utils/rllib.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ def create_env(*_):
)

sumo_params = deepcopy(params['sumo'])
if sumo_params.port is None:
time_stamp = ''.join(str(time.time()).split('.'))
time.sleep(2.0 * int(time_stamp[-6:]) / 1e6)
sumo_params.port = sumolib.miscutils.getFreeSocketPort()

register(
id=env_name,
Expand Down

0 comments on commit 89945a6

Please sign in to comment.