本文整理汇总了Python中circus.process.Process.age方法的典型用法代码示例。如果您正苦于以下问题:Python Process.age方法的具体用法?Python Process.age怎么用?Python Process.age使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类circus.process.Process
的用法示例。
在下文中一共展示了Process.age方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_base
# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import age [as 别名]
def test_base(self):
cmd = "%s -c 'import time; time.sleep(2)'"
process = Process('test', cmd % sys.executable, shell=True)
try:
info = process.info()
self.assertEqual(process.pid, info['pid'])
age = process.age()
self.assertTrue(age > 0.)
self.assertFalse(process.is_child(0))
finally:
process.stop()
示例2: test_base
# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import age [as 别名]
def test_base(self):
cmd = sys.executable
args = "-c 'import time; time.sleep(2)'"
process = Process("test", cmd, args=args, shell=False)
try:
info = process.info()
self.assertEqual(process.pid, info["pid"])
age = process.age()
self.assertTrue(age > 0.0)
self.assertFalse(process.is_child(0))
finally:
process.stop()
示例3: test_base
# 需要导入模块: from circus.process import Process [as 别名]
# 或者: from circus.process.Process import age [as 别名]
def test_base(self):
cmd = PYTHON
args = "-c 'import time; time.sleep(10)'"
process = Process('test', cmd, args=args, shell=False,
use_fds=USE_FDS)
try:
info = process.info()
self.assertEqual(process.pid, info['pid'])
# Make sure the process lived a measurable amount of time
# (precision error on Windows)
time.sleep(0.01)
age = process.age()
self.assertTrue(age > 0.)
self.assertFalse(process.is_child(0))
finally:
process.stop()