How to disable warnings in Flow?

554 views Asked by At

I have set all loggers to CRITICAL:

import logging
loggers = [logging.getLogger()] 
loggers = loggers + [logging.getLogger(name) for name in logging.root.manager.loggerDict]
for logger in loggers:
    logger.setLevel(logging.FATAL)

and I still get those messages:

Warning: Vehicle 'flow_00.0' performs emergency braking with decel=-9.00 wished=7.50 severity=1.00, time=21.00.

Question 1 : How to manage the logging levels in Flow? Or the underlying SUMO/Aimsum backend?

In the Flow code, I see these kinds of stuff:

import logging
logging.warning("some stuff")

Question 2: Why does it log only on the root log? If I want to disable the root log for some reason, but not the log from Flow, how can I do it?

1

There are 1 answers

0
mehh On BEST ANSWER

This warning is a SUMO warning. Using Flow, you can disable it by specifying print_warnings=false in the simulation parameters sim_params.

Check flow/core/kernel/simulation.traci.py file, the warning disable is performed like this:

if not sim_params.print_warnings:
    sumo_call.append("--no-warnings")
    sumo_call.append("true")