test/worker: test watchdog in build()

This commit is contained in:
Sebastien Bourdeauducq 2015-03-11 19:07:04 +01:00
parent 43a05c783d
commit f158711f7e
1 changed files with 14 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import sys
from time import sleep from time import sleep
from artiq import * from artiq import *
from artiq.master.worker import * from artiq.master.worker import *
class WatchdogNoTimeout(Experiment, AutoDB): class WatchdogNoTimeout(Experiment, AutoDB):
@ -20,6 +20,15 @@ class WatchdogTimeout(Experiment, AutoDB):
sleep(100.0) sleep(100.0)
class WatchdogTimeoutInBuild(Experiment, AutoDB):
def build(self):
with self.scheduler.watchdog(0.1*s):
sleep(100.0)
def run(self):
pass
@asyncio.coroutine @asyncio.coroutine
def _call_worker(worker, run_params): def _call_worker(worker, run_params):
yield from worker.prepare(0, run_params) yield from worker.prepare(0, run_params)
@ -52,3 +61,7 @@ class WatchdogCase(unittest.TestCase):
def test_watchdog_timeout(self): def test_watchdog_timeout(self):
with self.assertRaises(WorkerWatchdogTimeout): with self.assertRaises(WorkerWatchdogTimeout):
_run_experiment("WatchdogTimeout") _run_experiment("WatchdogTimeout")
def test_watchdog_timeout_in_build(self):
with self.assertRaises(WorkerWatchdogTimeout):
_run_experiment("WatchdogTimeoutInBuild")