Skip to content

Commit

Permalink
Prevent user warning configuration from being overwritten. (#2105)
Browse files Browse the repository at this point in the history
* Prevent user warning configuration from being overwritten.

* Update changelog.
  • Loading branch information
Gamenot authored Nov 7, 2023
1 parent 0f4a739 commit e3a1a76
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Copy and pasting the git commit messages is __NOT__ enough.
- Fixed issue where `SumoTrafficSimulation` could get locked up on reset if a scenario had only 1 map but multiple scenario variations.
- Fixed an issue where an out-of-scope method reference caused a pickling error.
- Fixed an issue where the `EnvisionDataFormatterArgs` default would use a locally defined lambda and cause a serialization failure.
- Fixed an issue where user configuration was being overridden.
- Fixed a `pkg_resources` deprecation warning in `python3.10` and up.
### Removed
### Security

Expand Down
3 changes: 0 additions & 3 deletions envision/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@
from envision.web import dist as web_dist
from smarts.core.utils.file import path2hash

logging.basicConfig(level=logging.WARNING)


# Mapping of simulation IDs to a set of web client run loops
WEB_CLIENT_RUN_LOOPS = {}

Expand Down
6 changes: 6 additions & 0 deletions examples/e2_single_agent.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
"""This example shows how you might run a SMARTS environment for single-agent work. SMARTS is
natively multi-agent so a single-agent wrapper is used."""
import argparse
import logging
import random
import sys
import warnings
from pathlib import Path
from typing import Final

logging.basicConfig(level=logging.ERROR)
warnings.filterwarnings("ignore")


import gymnasium as gym

SMARTS_REPO_PATH = Path(__file__).parents[1].absolute()
Expand Down
3 changes: 1 addition & 2 deletions examples/replay/replay_klws_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from smarts.env.utils.observation_conversion import ObservationOptions
from smarts.zoo.registry import make as zoo_make

logging.basicConfig(level=logging.INFO)

AGENT_ID = "Agent-007"


Expand Down Expand Up @@ -116,6 +114,7 @@ def main(scenarios, sim_name, headless, seed, speed, max_steps, save_dir, write)


if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
parser = default_argument_parser("klws-agent-example")
parser.add_argument(
"--speed",
Expand Down
11 changes: 8 additions & 3 deletions smarts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

try:
from importlib.metadata import version

import pkg_resources
VERSION = version("smarts")
except:
# This is now deprecated `https://setuptools.pypa.io/en/latest/pkg_resources.html`
import pkg_resources

# The full version, including alpha/beta/rc tags
VERSION = pkg_resources.get_distribution("smarts").version
# The full version, including alpha/beta/rc tags
VERSION = pkg_resources.get_distribution("smarts").version
2 changes: 0 additions & 2 deletions smarts/core/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import warnings
from typing import Any, Callable

warnings.simplefilter("once")

logger = logging.getLogger(__name__)


Expand Down
2 changes: 0 additions & 2 deletions smarts/zoo/agent_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
from smarts.core.agent import Agent
from smarts.core.agent_interface import AgentInterface

warnings.simplefilter("once")


@dataclass
class AgentSpec(object):
Expand Down

0 comments on commit e3a1a76

Please sign in to comment.