コード例 #1
0
    def test_set_started_with_timestamp(self, get_collection):
        task_id = 'test'
        timestamp = '1234'
        collection = mock.Mock()
        get_collection.return_value = collection

        # test
        TaskStatusManager.set_task_started(task_id, timestamp=timestamp)

        # validation
        select_1 = {
            'task_id': task_id
        }
        update_1 = {
            '$set': {'start_time': timestamp}
        }
        select_2 = {
            'task_id': task_id,
            'state': {'$in': [constants.CALL_WAITING_STATE, constants.CALL_ACCEPTED_STATE]}
        }
        update_2 = {
            '$set': {'state': constants.CALL_RUNNING_STATE}
        }

        self.assertEqual(
            collection.update.call_args_list,
            [
                ((select_1, update_1), {'safe': True}),
                ((select_2, update_2), {'safe': True}),
            ])
コード例 #2
0
ファイル: services.py プロジェクト: preethit/pulp-1
 def started(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_started(task_id)
コード例 #3
0
 def started(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_started(task_id)
コード例 #4
0
ファイル: services.py プロジェクト: VuokkoVuorinnen/pulp
 def started(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
     """
     log.debug(_('Task RMI (started): %(r)s'), {'r': reply})
     call_context = dict(reply.any)
     task_id = call_context['task_id']
     TaskStatusManager.set_task_started(task_id, timestamp=reply.timestamp)
コード例 #5
0
    def test_set_started(self, mock_update, mock_date):
        task_id = 'test'
        now = '1234'
        mock_date.return_value = now

        # test

        TaskStatusManager.set_task_started(task_id)

        # validation

        delta = {'state': constants.CALL_RUNNING_STATE, 'start_time': now}

        mock_update.assert_called_with(task_id=task_id, delta=delta)
コード例 #6
0
    def test_set_started(self, mock_update, mock_date):
        task_id = 'test'
        now = '1234'
        mock_date.return_value = now

        # test

        TaskStatusManager.set_task_started(task_id)

        # validation

        delta = {
            'state': constants.CALL_RUNNING_STATE,
            'start_time': now
        }

        mock_update.assert_called_with(task_id=task_id, delta=delta)