Display exception when creating multiple SMARTS instances
See original GitHub issueI encounter the “Display is not found” exception when trying to create multiple SMARTS instances:
To reproduce:
train_env = gym.make(
"smarts.env:hiway-v0",
scenarios=scenarios,
agent_specs={AGENT_ID: agent_spec},
headless=headless,
visdom=False,
timestep_sec=0.1,
sumo_headless=True,
seed=seed,
# envision_record_data_replay_path="./data_replay",
)
test_env = gym.make(
"smarts.env:hiway-v0",
scenarios=scenarios,
agent_specs={AGENT_ID: agent_spec},
headless=headless,
visdom=False,
timestep_sec=0.1,
sumo_headless=True,
seed=seed,
# envision_record_data_replay_path="./data_replay",
)
Development Environment:
OS: Ubuntu 16.04
Python: 3.7.4
SUMO: 1.7.0
SMARTS: 0.4.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
python - How do I determine what type of exception occurred?
Inside except block the exception is available through sys. exc_info() function – This function returns a tuple of three values that give information...
Read more >How to Catch Multiple Exceptions in Python - Rollbar
In Python, try-except blocks can be used to catch and respond to one or multiple exceptions. In cases where a process raises more...
Read more >Top 10 Selenium Exceptions and How To Handle These ...
Handling Exceptions in Selenium WebDriver - In this tutorial we will learn about types of exceptions and how to handle top 10 most...
Read more >Modern C++ best practices for exceptions and error handling
In modern C++, in most scenarios, the preferred way to report and handle both logic errors and runtime errors is to use exceptions....
Read more >Exceptions and Error Handling, C++ FAQ - Standard C++
Exception handling seems to make my life more difficult; that must mean exception handling itself is bad; clearly I'm not the problem, right??...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @zbzhu99 , this is a known issue. SMARTS uses a few dependencies that have the requirement for a single instance in a process. In order to use another SMARTS instance in the same thread, the previous needs to be destroyed, or run on another process.
There is an
example/multi_instance.py
that shows one way to be able use more than one smarts environment usingray
.https://github.com/huawei-noah/SMARTS/blob/master/examples/multi_instance.py#L68-L162
@alek5k Yeah we did hit that one with one of our users as well
Maybe you can find something of use from the other configuration options we tuned here:
https://github.com/huawei-noah/SMARTS/blob/master/smarts/core/smarts.py#L62-L68