eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.38k stars 1.37k forks source link

Traci Connection Error when using Slurm #14608

Open zhuzh6593 opened 3 months ago

zhuzh6593 commented 3 months ago

Add your issue description here. I'm having problem when running my sumo simulation on slurm, and error came up when I try to connect or start the traci server, it said that connection was closed, and I tried to start traci server using:

srun --nodes=1 --ntasks=1 -w "$head_node" -v \
    sumo -c marllib.envs.m3fc_envs.sumo_tl.simulation.sumocfg --remote-port 6379

and use traci.init(6379) in my script, but also failed. If possible, please provide me an example for running traci on such remote server.

If possible, upload an example that shows your problem.

Traceback (most recent call last):
  File "/shared/apps/.gcc/8.5/python/3.8.0/lib/python3.8/runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/shared/apps/.gcc/8.5/python/3.8.0/lib/python3.8/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/work/scratch/zz58nago/Masterarbeit-M3FC/marllib/envs/m3fc_envs/sumo_tl/simulation.py", line 134, in <module>
    start_simulation()
  File "/work/scratch/zz58nago/Masterarbeit-M3FC/marllib/envs/m3fc_envs/sumo_tl/simulation.py", line 109, in start_simulation
    traci.init(port=6379)
  File "/work/scratch/zz58nago/Masterarbeit-M3FC/venv/lib/python3.8/site-packages/sumo/tools/traci/main.py", line 116, in init
    con = connect(port, numRetries, host, proc, 1, traceFile, traceGetters, label)
  File "/work/scratch/zz58nago/Masterarbeit-M3FC/venv/lib/python3.8/site-packages/sumo/tools/traci/main.py", line 106, in connect
    raise FatalTraCIError("Could not connect in %s tries" % (numRetries + 1))
sumo.tools.traci.exceptions.FatalTraCIError: Could not connect in 61 tries

SUMO-version: sumo = 1.19 python = 3.8 operating system: slurm/linux

behrisch commented 1 month ago

Are the client and the server running on the same machine or on different ones? If it is on the same machine, does starting sumo directly via traci.start work? Is a firewall active?