修复BUG

This commit is contained in:
zhiyang7 2022-01-05 12:05:07 +08:00
parent 4f8db44ae4
commit 0e3476b734
1 changed files with 6 additions and 4 deletions

View File

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