本文整理汇总了Python中indico.modules.scheduler.Client.getTask方法的典型用法代码示例。如果您正苦于以下问题:Python Client.getTask方法的具体用法?Python Client.getTask怎么用?Python Client.getTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类indico.modules.scheduler.Client
的用法示例。
在下文中一共展示了Client.getTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTaskRelocate
# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import getTask [as 别名]
def testTaskRelocate(self):
"""
Creating 1 task and relocating it
"""
self._startSomeWorkers([TestTask],
[base.TimeSource.get().getCurrentTime() + \
timedelta(seconds=2)])
base.TimeSource.get().sleep(1)
with self._context('database', sync=True) as conn:
# wait to task to be scheduled
c = Client()
while True:
try:
conn.sync()
t = c.getTask(0)
break
except KeyError:
continue
c.moveTask(t, base.TimeSource.get().getCurrentTime() + timedelta(seconds=2))
self.assertEqual(self._checkWorkersFinished(5),
True)
self._assertStatus({'state': True,
'waiting': 0,
'running': 0,
'spooled': 0,
'finished': 1,
'failed': 0})
示例2: TaskAdminService
# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import getTask [as 别名]
class TaskAdminService(SchedulerModuleAdminService):
"""
Common to all tasks
"""
def _checkParams(self):
SchedulerModuleAdminService._checkParams(self)
tid = self._params.get('id', None)
if tid == None:
raise ServiceError('ERR-T0','Task Id not provided')
self._client = Client()
self._task = self._client.getTask(tid)
示例3: testPriority
# 需要导入模块: from indico.modules.scheduler import Client [as 别名]
# 或者: from indico.modules.scheduler.Client import getTask [as 别名]
def testPriority(self):
"""
Checking that one task is executed before another
"""
self._workers = {}
global terminated
terminated = multiprocessing.Array('i', [0, 0])
terminated[0] = 0
terminated[1] = 0
w1 = Worker(0, TestTask, base.TimeSource.get().getCurrentTime() + \
timedelta(seconds=4))
w1.start()
base.TimeSource.get().sleep(1)
w2 = Worker(1, TestTask, base.TimeSource.get().getCurrentTime() + \
timedelta(seconds=0))
w2.start()
self._workers[0] = w1
self._workers[1] = w2
w1.join()
w2.join()
self.assertEqual(self._checkWorkersFinished(10),
True)
self._assertStatus({'state': True,
'waiting': 0,
'running': 0,
'spooled': 0,
'finished': 2,
'failed': 0})
with self._context('database', sync=True):
c = Client()
t1 = c.getTask(0)
t2 = c.getTask(1)
self.assertEqual(t1.endedOn > t2.endedOn, True)