本文整理汇总了Python中pyres.worker.Worker.started方法的典型用法代码示例。如果您正苦于以下问题:Python Worker.started方法的具体用法?Python Worker.started怎么用?Python Worker.started使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyres.worker.Worker
的用法示例。
在下文中一共展示了Worker.started方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_started
# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import started [as 别名]
def test_started(self):
worker = Worker(['basic'])
dt = datetime.datetime.utcnow()
worker.started = dt
name = "%s:%s:%s" % (os.uname()[1],os.getpid(),'basic')
assert self.redis.get('resque:worker:%s:started' % name) == str(int(calendar.timegm(dt.utctimetuple())))
assert worker.started == str(int(calendar.timegm(dt.utctimetuple())))
worker.started = None
assert not self.redis.exists('resque:worker:%s:started' % name)
示例2: test_started
# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import started [as 别名]
def test_started(self):
import datetime
worker = Worker(['basic'])
dt = datetime.datetime.now()
worker.started = dt
name = "%s:%s:%s" % (os.uname()[1],os.getpid(),'basic')
assert self.redis.get('resque:worker:%s:started' % name) == dt.strftime('%Y-%m-%d %H:%M:%S')
assert worker.started == datetime.datetime.strptime(dt.strftime('%Y-%m-%d %H:%M:%S'),'%Y-%m-%d %H:%M:%S')
worker.started = None
assert not self.redis.exists('resque:worker:%s:started' % name)
示例3: test_started
# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import started [as 别名]
def test_started(self):
import datetime
worker = Worker(['basic'])
dt = datetime.datetime.now()
worker.started = dt
name = "%s:%s:%s" % (os.uname()[1],os.getpid(),'basic')
assert self.redis.get('resque:worker:%s:started' % name).decode() == str(int(time.mktime(dt.timetuple())))
assert worker.started.decode() == str(int(time.mktime(dt.timetuple())))
worker.started = None
assert not self.redis.exists('resque:worker:%s:started' % name)