diff --git a/douzero/server/battle.py b/douzero/server/battle.py index 8222763..df9bd0e 100644 --- a/douzero/server/battle.py +++ b/douzero/server/battle.py @@ -94,10 +94,12 @@ def battle_logic(flags, baseline : Baseline, battle : Battle): battle.status = 1 if challenge_success else 2 battle.save() if not challenge_success: - onnx_path = str(battle.challenger_path) + '.onnx' - if os.path.exists(onnx_path): - os.remove(onnx_path) - os.remove(str(battle.challenger_path)) + cnt = Battle.select().where(Battle.status == 0).count() + if cnt == 0: + onnx_path = str(battle.challenger_path) + '.onnx' + if os.path.exists(onnx_path): + os.remove(onnx_path) + os.remove(str(battle.challenger_path)) else: baseline_players[position_idx[battle.challenger_position]] = DeepAgent(battle.challenger_position, str(battle.challenger_path), use_onnx=True)