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


Python CallRequest.deserialize方法代码示例

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


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

示例1: start

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
    def start(self):
        """
        Start the coordinator by clearing conflicting metadata and restarting any
        interrupted tasks.
        """
        # drop all previous knowledge of previous calls
        self.call_resource_collection.remove(safe=True)

        # re-start interrupted tasks
        queued_call_collection = QueuedCall.get_collection()
        queued_call_list = list(queued_call_collection.find().sort('timestamp'))
        queued_call_collection.remove(safe=True)

        queued_call_request_list = [CallRequest.deserialize(q['serialized_call_request']) for q in queued_call_list]

        while queued_call_request_list:
            call_request = queued_call_request_list[0]

            # individually call un-grouped calls
            if call_request.group_id is None:
                queued_call_request_list.remove(call_request)
                self.execute_call_asynchronously(call_request)
                continue

            # call grouped calls at all at once
            call_request_group = [c for c in queued_call_request_list if c.group_id == call_request.group_id]
            map(queued_call_request_list.remove, call_request_group)

            try:
                # NOTE (jconnor 2012-10-12) this will change the group_id, but I don't think I care
                self.execute_multiple_calls(call_request_group)
            except TopologicalSortError, e:
                log_msg = _('Cannot execute call request group: %(g)s' % {'g': call_request.group_id})
                _LOG.warn('\n'.join((log_msg, str(e))))
开发者ID:domcleal,项目名称:pulp,代码行数:36,代码来源:coordinator.py

示例2: test_serialize_deserialize

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
 def test_serialize_deserialize(self):
     args = ["fee", "fie", "foe", "foo"]
     kwargs = {"one": "foo", "two": "bar", "three": "baz"}
     call_request = CallRequest(function, args, kwargs)
     data = call_request.serialize()
     self.assertTrue(isinstance(data, dict))
     call_request_2 = CallRequest.deserialize(data)
     self.assertTrue(isinstance(call_request_2, CallRequest), str(type(call_request_2)))
开发者ID:jlsherrill,项目名称:pulp,代码行数:10,代码来源:test_dispatch_call.py

示例3: test_serialize_deserialize_with_execution_hook

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
 def test_serialize_deserialize_with_execution_hook(self):
     key = dispatch_constants.CALL_CANCEL_LIFE_CYCLE_CALLBACK
     call_request = CallRequest(function)
     call_request.add_life_cycle_callback(key, function)
     data = call_request.serialize()
     self.assertTrue(isinstance(data, dict))
     call_request_2 = CallRequest.deserialize(data)
     self.assertTrue(isinstance(call_request_2, CallRequest))
     self.assertTrue(call_request_2.execution_hooks[key][0] == function)
开发者ID:jlsherrill,项目名称:pulp,代码行数:11,代码来源:test_dispatch_call.py

示例4: test_serialize_deserialize_with_control_hook

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
 def test_serialize_deserialize_with_control_hook(self):
     key = dispatch_constants.CALL_CANCEL_CONTROL_HOOK
     call_request = CallRequest(function)
     call_request.add_control_hook(key, function)
     data = call_request.serialize()
     self.assertTrue(isinstance(data, dict))
     call_request_2 = CallRequest.deserialize(data)
     self.assertTrue(isinstance(call_request_2, CallRequest))
     self.assertTrue(call_request_2.control_hooks[key] == function)
开发者ID:jlsherrill,项目名称:pulp,代码行数:11,代码来源:test_dispatch_call.py

示例5: test_queued_call_collection

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
 def test_queued_call_collection(self):
     task = self.gen_task(call=call)
     collection = QueuedCall.get_collection()
     try:
         self.queue.enqueue(task)
     except:
         self.fail(traceback.format_exc())
     queued_call = collection.find_one({'_id': task.queued_call_id})
     self.assertFalse(queued_call is None)
     self.assertFalse(queued_call['serialized_call_request'] is None)
     try:
         call_request = CallRequest.deserialize(queued_call['serialized_call_request'])
     except:
         self.fail(traceback.format_exc())
     self.assertFalse(call_request is None)
开发者ID:ehelms,项目名称:pulp,代码行数:17,代码来源:test_dispatch_taskqueue.py

示例6: start

# 需要导入模块: from pulp.server.dispatch.call import CallRequest [as 别名]
# 或者: from pulp.server.dispatch.call.CallRequest import deserialize [as 别名]
 def start(self):
     """
     Start the coordinator by clearing conflict metadata and restarting any
     interrupted tasks.
     """
     # drop all previous knowledge of running tasks
     task_resource_collection = TaskResource.get_collection()
     task_resource_collection.remove(safe=True)
     # re-start interrupted tasks
     queued_call_collection = QueuedCall.get_collection()
     queued_call_list = list(queued_call_collection.find().sort('timestamp'))
     queued_call_collection.remove(safe=True)
     for queued_call in queued_call_list:
         call_request = CallRequest.deserialize(queued_call['serialized_call_request'])
         call_report = self.execute_call_asynchronously(call_request)
开发者ID:ehelms,项目名称:pulp,代码行数:17,代码来源:coordinator.py


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