oxwhirl / smac

SMAC: The StarCraft Multi-Agent Challenge
MIT License
1.08k stars 228 forks source link

disabling/redirecting sc2 logging #109

Open ElieAljalbout opened 1 year ago

ElieAljalbout commented 1 year ago

is it somehow possible to disable or at least redirect all the logging outputs so that they don't dominate the terminal? I'm talking about prints such as the following:

Configure: feature layer interface disabled Configure: score interface disabled Configure: render interface disabled Launching next game. Next launch phase started: 2 Next launch phase started: 3 Next launch phase started: 4 Next launch phase started: 5 Next launch phase started: 6 Next launch phase started: 7

Joy1112 commented 1 year ago

Same problem. When i run multiple smac instances, this could be really annoying.

I struggled to find these outputs are caused by package pysc2, and there was already an issue about it.

For me, i update the pysc2.lib.sc_process.StarcraftProcess()._launch() as i proposed in the issue above. Meanwhile, I also change the source code of smac in StarCraft2Env()._launch() to disable the logging info:

self._sc2_proc = self._run_config.start(
    window_size=self.window_size, want_rgb=False, stderr=subprocess.DEVNULL
)

Additionally, if one wants to retrace these outputs, I found pysc2 already supports strace. The only thing is to set flags.sc2_strace=True defined at sc_process.py.