本文整理汇总了Python中lib.cuckoo.core.database.Database.unlock_machine_by_experiment方法的典型用法代码示例。如果您正苦于以下问题:Python Database.unlock_machine_by_experiment方法的具体用法?Python Database.unlock_machine_by_experiment怎么用?Python Database.unlock_machine_by_experiment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.cuckoo.core.database.Database
的用法示例。
在下文中一共展示了Database.unlock_machine_by_experiment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: terminate
# 需要导入模块: from lib.cuckoo.core.database import Database [as 别名]
# 或者: from lib.cuckoo.core.database.Database import unlock_machine_by_experiment [as 别名]
def terminate(request, task_id):
db = Database()
task = db.view_task(task_id)
db.delete_task(task_id)
if task.status != TASK_PENDING:
task_running = db.list_tasks(experiment=task.experiment_id, status=TASK_RUNNING)
if task_running:
# Ask the task to free the vm once done
task_running.repeat = TASK_SINGLE
else:
# Free the vm assigned to this experiment
db.unlock_machine_by_experiment(task.experiment_id)
if len(db.list_tasks(experiment=task.experiment_id)) == 0:
# No tasks attached to this experiment, no need to keep the experiment
db.delete_experiment(task.experiment_id)
return render_to_response("success.html",
{"message": "Task terminated, thanks for all the fish."},
context_instance=RequestContext(request))