当前位置: 首页>>代码示例>>Python>>正文


Python Client.getTask方法代码示例

本文整理汇总了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})
开发者ID:VishrutMehta,项目名称:indico,代码行数:36,代码来源:server_test.py

示例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)
开发者ID:NIIF,项目名称:indico,代码行数:16,代码来源:scheduler.py

示例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)
开发者ID:VishrutMehta,项目名称:indico,代码行数:48,代码来源:server_test.py


注:本文中的indico.modules.scheduler.Client.getTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。