示例#1
0
 def accepted(self, reply):
     """
     Notification that an RMI has started executing in the agent.
     The task status is updated in the pulp DB.
     :param reply: A status reply object.
     :type reply: gofer.rmi.async.Started
     """
     call_context = reply.any
     task_id = call_context['task_id']
     TaskStatusManager.set_task_accepted(task_id)
示例#2
0
 def accepted(self, reply):
     """
     Notification that an RMI has started executing in the agent.
     The task status is updated in the pulp DB.
     :param reply: A status reply object.
     :type reply: gofer.rmi.async.Accepted
     """
     log.debug(_('Task RMI (accepted): %(r)s'), {'r': reply})
     call_context = dict(reply.any)
     task_id = call_context['task_id']
     TaskStatusManager.set_task_accepted(task_id)
示例#3
0
    def test_set_accepted(self, mock_update):
        task_id = 'test'

        # test

        TaskStatusManager.set_task_accepted(task_id)

        # validation

        delta = {'state': constants.CALL_ACCEPTED_STATE}

        mock_update.assert_called_with(task_id=task_id, delta=delta)
示例#4
0
    def test_set_accepted(self, mock_update):
        task_id = 'test'

        # test

        TaskStatusManager.set_task_accepted(task_id)

        # validation

        delta = {
            'state': constants.CALL_ACCEPTED_STATE
        }

        mock_update.assert_called_with(task_id=task_id, delta=delta)
    def test_set_accepted(self, get_collection):
        task_id = 'test'
        collection = mock.Mock()
        get_collection.return_value = collection

        # test
        TaskStatusManager.set_task_accepted(task_id)

        # validation
        select = {
            'task_id': task_id,
            'state': constants.CALL_WAITING_STATE
        }
        update = {
            '$set': {'state': constants.CALL_ACCEPTED_STATE}
        }

        collection.update.assert_called_once_with(select, update, safe=True)