Fix: Catch RequestHumanTakeover in benchmark

This commit is contained in:
LmeSzinc 2023-08-05 18:03:50 +08:00
parent b40850200b
commit f81d53cf68
2 changed files with 13 additions and 13 deletions

View File

@ -197,14 +197,10 @@ class Benchmark(DaemonBase, CampaignUI):
return tuple(screenshot), tuple(click)
def run(self):
try:
self.config.override(Emulator_ScreenshotMethod='ADB')
self.device.uninstall_minicap()
self.ui_goto_campaign()
self.campaign_set_chapter('7-2')
except RequestHumanTakeover:
logger.critical('Request human takeover')
return
self.config.override(Emulator_ScreenshotMethod='ADB')
self.device.uninstall_minicap()
self.ui_goto_campaign()
self.campaign_set_chapter('7-2')
logger.attr('DeviceType', self.config.Benchmark_DeviceType)
logger.attr('TestScene', self.config.Benchmark_TestScene)
@ -236,6 +232,10 @@ class Benchmark(DaemonBase, CampaignUI):
return method
if __name__ == '__main__':
b = Benchmark('alas', task='Benchmark')
b.run()
def run_benchmark(config):
try:
Benchmark(config, task='Benchmark').run()
return True
except RequestHumanTakeover:
logger.critical('Request human takeover')
return False

View File

@ -162,9 +162,9 @@ class ProcessManager:
AzurLaneUncensored(config=config_name, task="AzurLaneUncensored").run()
elif func == "Benchmark":
from module.daemon.benchmark import Benchmark
from module.daemon.benchmark import run_benchmark
Benchmark(config=config_name, task="Benchmark").run()
run_benchmark(config=config_name)
elif func == "GameManager":
from module.daemon.game_manager import GameManager