I am trying to run a method periodically(60 seconds). I am using oslo service to do so. Below is the snippet.
import time
from oslo_service import periodic_task
class MyClass(periodic_task.PeriodicTasks):
def __init__(self):
super(periodic_task.PeriodicTasks, self).__init__()
@periodic_task.periodic_task
def hello(self):
print "hello"
def sleeptime(self):
time.sleep(5000)
myobj = MyClass()
myobj.hello()
myobj.sleeptime()
"hello" gets printed just once. What am i doing wrong here ?