Skip to content

Commit

Permalink
Merge pull request berkeleyflow#48 from berkeleyflow/test_speedup
Browse files Browse the repository at this point in the history
don't do the backoff stuff when testing
  • Loading branch information
AboudyKreidieh authored Jun 9, 2018
2 parents 89945a6 + e7a1d5c commit a204280
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions flow/envs/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ def start_sumo(self):
if self.sumo_params.port is not None:
port = self.sumo_params.port
else:
# backoff to decrease likelihood of race condition
time_stamp = ''.join(str(time.time()).split('.'))
time.sleep(2.0 * int(time_stamp[-6:]) / 1e6)
port = sumolib.miscutils.getFreeSocketPort()
# Don't do backoff when testing
if os.environ.get("TEST_FLAG", 0):
# backoff to decrease likelihood of race condition
time_stamp = ''.join(str(time.time()).split('.'))
time.sleep(2.0 * int(time_stamp[-6:]) / 1e6)
port = sumolib.miscutils.getFreeSocketPort()

# command used to start sumo
sumo_call = [self.sumo_params.sumo_binary,
Expand Down

0 comments on commit a204280

Please sign in to comment.