當前位置: 首頁>>代碼示例>>Python>>正文


Python MessageProcessor.to_dict方法代碼示例

本文整理匯總了Python中furious.batcher.MessageProcessor.to_dict方法的典型用法代碼示例。如果您正苦於以下問題:Python MessageProcessor.to_dict方法的具體用法?Python MessageProcessor.to_dict怎麽用?Python MessageProcessor.to_dict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在furious.batcher.MessageProcessor的用法示例。


在下文中一共展示了MessageProcessor.to_dict方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_to_task_has_correct_arguments

# 需要導入模塊: from furious.batcher import MessageProcessor [as 別名]
# 或者: from furious.batcher.MessageProcessor import to_dict [as 別名]
    def test_to_task_has_correct_arguments(self, memcache, time, task,
                                           task_retry):
        """Ensure that if no name is passed into the MessageProcessor that it
        creates a default unique name when creating the task.
        """
        from furious.async import MAX_RESTARTS
        from furious.batcher import MessageProcessor

        memcache.get.return_value = 'current-batch'
        time.time.return_value = 100

        task_retry_object = Mock()
        task_retry.return_value = task_retry_object

        processor = MessageProcessor('something', queue='test_queue',
                                     id='someid', parent_id='parentid',
                                     context_id="contextid")

        processor.to_task()

        task_args = {
            'name': 'processor-processor-current-batch-3',
            'url': '/_ah/queue/async/something',
            'countdown': 30,
            'headers': {},
            'retry_options': task_retry_object,
            'payload': json.dumps(processor.to_dict())
        }

        task.assert_called_once_with(**task_args)
        task_retry.assert_called_once_with(task_retry_limit=MAX_RESTARTS)
開發者ID:aaronkavlie-wf,項目名稱:furious,代碼行數:33,代碼來源:test_batcher.py

示例2: test_has_type

# 需要導入模塊: from furious.batcher import MessageProcessor [as 別名]
# 或者: from furious.batcher.MessageProcessor import to_dict [as 別名]
    def test_has_type(self):
        """Ensure that if _type is not furious.async.Async that the correct
        subclass is instantiated.
        """
        from furious.async import async_from_options
        from furious.batcher import MessageProcessor

        async_job = MessageProcessor(dir)

        options = async_job.to_dict()

        result = async_from_options(options)

        self.assertIsInstance(result, MessageProcessor)
開發者ID:brianneal-wf,項目名稱:furious,代碼行數:16,代碼來源:test_async.py


注:本文中的furious.batcher.MessageProcessor.to_dict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。