forked from M-Labs/artiq
examples: add RunForever experiment to demonstrate graceful termination
This commit is contained in:
parent
139072d402
commit
3cf53667c8
18
examples/master/repository/run_forever.py
Normal file
18
examples/master/repository/run_forever.py
Normal file
@ -0,0 +1,18 @@
|
||||
from itertools import count
|
||||
from time import sleep
|
||||
|
||||
from artiq import *
|
||||
|
||||
|
||||
class RunForever(EnvExperiment):
|
||||
def build(self):
|
||||
self.setattr_device("scheduler")
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
for i in count():
|
||||
self.scheduler.pause()
|
||||
sleep(1)
|
||||
print("ping", i)
|
||||
except TerminationRequested:
|
||||
print("Terminated gracefully")
|
Loading…
Reference in New Issue
Block a user