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


Python Worker.fork_worker方法代码示例

本文整理汇总了Python中pyres.worker.Worker.fork_worker方法的典型用法代码示例。如果您正苦于以下问题:Python Worker.fork_worker方法的具体用法?Python Worker.fork_worker怎么用?Python Worker.fork_worker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyres.worker.Worker的用法示例。


在下文中一共展示了Worker.fork_worker方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_kills_stale_workers_after_timeout

# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import fork_worker [as 别名]
    def test_kills_stale_workers_after_timeout(self):
        timeout = 1

        worker = Worker(['basic'], timeout=timeout)
        self.resq.enqueue(TimeoutJob, timeout + 1)

        assert worker.get_failed() == 0
        worker.fork_worker(worker.reserve())
        assert worker.get_failed() == 1
开发者ID:jbardin,项目名称:pyres,代码行数:11,代码来源:test_worker.py

示例2: test_detect_code_0_os_exit_as_success

# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import fork_worker [as 别名]
    def test_detect_code_0_os_exit_as_success(self):
        worker = Worker(['basic'])
        self.resq.enqueue(PrematureHardExitJob, 0)

        assert worker.job() == {}
        assert worker.get_failed() == 0

        worker.fork_worker(worker.reserve())

        assert worker.job() == {}
        assert worker.get_failed() == 0
开发者ID:jbardin,项目名称:pyres,代码行数:13,代码来源:test_worker.py

示例3: test_detect_non_0_sys_exit_as_failure

# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import fork_worker [as 别名]
    def test_detect_non_0_sys_exit_as_failure(self):
        worker = Worker(['basic'])
        self.resq.enqueue(PrematureExitJob, 9)

        assert worker.job() == {}
        assert worker.get_failed() == 0

        worker.fork_worker(worker.reserve())

        assert worker.job() == {}
        assert worker.get_failed() == 1
开发者ID:jbardin,项目名称:pyres,代码行数:13,代码来源:test_worker.py

示例4: test_detect_crashed_workers_as_failures

# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import fork_worker [as 别名]
    def test_detect_crashed_workers_as_failures(self):
        worker = Worker(['basic'])
        self.resq.enqueue(CrashJob)

        assert worker.job() == {}
        assert worker.get_failed() == 0

        worker.fork_worker(worker.reserve())

        assert worker.job() == {}
        assert worker.get_failed() == 1
开发者ID:jbardin,项目名称:pyres,代码行数:13,代码来源:test_worker.py

示例5: test_sigterm_worker_gets_requeued

# 需要导入模块: from pyres.worker import Worker [as 别名]
# 或者: from pyres.worker.Worker import fork_worker [as 别名]
    def test_sigterm_worker_gets_requeued(self):
        worker = Worker(['basic'])
        self.resq.enqueue(SigtermJob, 'string argument')

        assert worker.job() == {}
        assert worker.get_failed() == 0

        job = worker.reserve()
        worker.fork_worker(job)

        # our last job should land back in the queue
        job2 = worker.reserve()
        assert str(job2) == str(job)

        # didn't run job2, so there shouldn't be more jobs
        assert worker.reserve(timeout=1) == None

        assert worker.job() == {}
        assert worker.get_failed() == 0
开发者ID:jbardin,项目名称:pyres,代码行数:21,代码来源:test_worker.py


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