def release_judge_instance(self, judge_server_id):
        with transaction.atomic():
            # 使用原子操作, 同时因为use和release中间间隔了判题过程,需要重新查询一下
            server = JudgeServer.objects.select_for_update().get(id=judge_server_id)
            server.left_instance_number += 1
            server.workload = 100 - int(float(server.left_instance_number) / server.max_instance_number * 100)
            server.save()
dataset/ETHPy150Open QingdaoU/OnlineJudge/judge_dispatcher/tasks.py/JudgeDispatcher.release_judge_instance/original