コード例 #1
0
 def tearDown(self):
     super(CoordinatorTests, self).tearDown()
     self.coordinator = None
     dispatch_factory._task_queue = self._task_queue_factory
     self._task_queue_factory = None
     self.collection.drop()
     self.collection = None
     QueuedCall.get_collection().drop()
     ArchivedCall.get_collection().drop()
コード例 #2
0
 def tearDown(self):
     super(CoordinatorTests, self).tearDown()
     self.coordinator = None
     dispatch_factory._task_queue = self._task_queue_factory
     self._task_queue_factory = None
     self.collection.drop()
     self.collection = None
     QueuedCall.get_collection().drop()
     ArchivedCall.get_collection().drop()
コード例 #3
0
ファイル: test_dispatch_task.py プロジェクト: ashcrow/pulp
 def test_task_archival(self):
     task = Task(CallRequest(call_without_callbacks, archive=True))
     try:
         task._run()
     except:
         self.fail(traceback.format_exc())
     collection = ArchivedCall.get_collection()
     archived_call = collection.find_one({'serialized_call_report.call_request_id': task.call_request.id})
     self.assertFalse(archived_call is None)
コード例 #4
0
 def test_task_archival(self):
     task = Task(CallRequest(call_without_callbacks, archive=True))
     try:
         task._run()
     except:
         self.fail(traceback.format_exc())
     collection = ArchivedCall.get_collection()
     archived_call = collection.find_one(
         {'serialized_call_report.call_request_id': task.call_request.id})
     self.assertFalse(archived_call is None)
コード例 #5
0
ファイル: history.py プロジェクト: ryanschneider/pulp
def archive_call(call_request, call_report):
    """
    Store a completed call request in the database.
    @param call_request: call request to store
    @type call_request: L{pulp.server.dispatch.call.CallRequest}
    @param call_report: call report corresponding to the call request
    @type call_report: L{pulp.server.dispatch.call.CallReport}
    """
    archived_call = ArchivedCall(call_request, call_report)
    collection = ArchivedCall.get_collection()
    collection.insert(archived_call, safe=True)
コード例 #6
0
ファイル: history.py プロジェクト: ryanschneider/pulp
def purge_archived_tasks():
    """
    Remove archived tasks from the database that have expired.
    """
    archived_call_lifetime = pulp_config.config.getint('tasks', 'archived_call_lifetime')

    delta = datetime.timedelta(hours=archived_call_lifetime)
    now = datetime.datetime.now(tz=dateutils.utc_tz())
    expired_timestamp = dateutils.datetime_to_utc_timestamp(now - delta)

    collection = ArchivedCall.get_collection()
    collection.remove({'timestamp': {'$lte': expired_timestamp}}, safe=True)
コード例 #7
0
ファイル: history.py プロジェクト: tomlanyon/pulp
def archive_call(call_request, call_report):
    """
    Store a completed call request in the database.

    :param call_request: call request to store
    :type call_request: pulp.server.dispatch.call.CallRequest
    :param call_report: call report corresponding to the call request
    :type call_report: pulp.server.dispatch.call.CallReport
    """
    archived_call = ArchivedCall(call_request, call_report)
    collection = ArchivedCall.get_collection()
    collection.insert(archived_call, safe=True)
コード例 #8
0
ファイル: history.py プロジェクト: ehelms/pulp
def find_archived_calls(**criteria):
    query = {}
    if 'task_id' in criteria:
        query['serialized_call_report.task_id'] = criteria['task_id']
    if 'task_group_id' in criteria:
        query['serialized_call_report.task_group_id'] = criteria['task_group_id']
    if 'state' in criteria:
        query['serialized_call_report.state'] = criteria['state']
    if 'call_name' in criteria:
        call_name = callable_name(criteria.get('class_name'), criteria['call_name'])
        query['serialized_call_request.callable_name'] = call_name
    # XXX allow args, kwargs, and resources?
    if 'tags' in criteria:
        query['serialized_call_request.tags'] = {'$in': criteria['tags']}

    collection = ArchivedCall.get_collection()
    cursor = collection.find(query)
    return cursor
コード例 #9
0
ファイル: history.py プロジェクト: ryanschneider/pulp
def find_archived_calls(**criteria):
    """
    Find archived call requests that match the given criteria.
    Criteria is passed in as keyword arguments.

    Currently supported criteria:
    * call_request_id
    * call_request_group_id

    @return: (possibly empty) mongo collection cursor containing the matching archived calls
    @rtype: L{pymongo.cursor.Cursor}
    """
    query = {}
    if 'call_request_id' in criteria:
        query['serialized_call_request.id'] = criteria['call_request_id']
    if 'call_request_group_id' in criteria:
        query['serialized_call_request.group_id'] = criteria['call_request_group_id']

    collection = ArchivedCall.get_collection()
    cursor = collection.find(query)
    return cursor
コード例 #10
0
ファイル: history.py プロジェクト: tomlanyon/pulp
def find_archived_calls(**criteria):
    """
    Find archived call requests that match the given criteria.
    Criteria is passed in as keyword arguments.

    Currently supported criteria:
     * call_request_id
     * call_request_group_id

    :return: (possibly empty) mongo collection cursor containing the matching archived calls
    :rtype: pymongo.cursor.Cursor
    """
    query = {}
    if 'call_request_id' in criteria:
        query['serialized_call_report.call_request_id'] = criteria[
            'call_request_id']
    if 'call_request_group_id' in criteria:
        query['serialized_call_report.call_request_group_id'] = criteria[
            'call_request_group_id']

    collection = ArchivedCall.get_collection()
    cursor = collection.find(query)
    return cursor
コード例 #11
0
ファイル: test_dispatch_task.py プロジェクト: ashcrow/pulp
 def tearDown(self):
     super(TaskArchivalTests, self).tearDown()
     ArchivedCall.get_collection().drop()
コード例 #12
0
 def tearDown(self):
     super(TaskArchivalTests, self).tearDown()
     ArchivedCall.get_collection().drop()
コード例 #13
0
 def setUp(self):
     super(ArchivedCallTests, self).setUp()
     self.archived_call_collection = ArchivedCall.get_collection()
     self.archived_call_collection.remove(safe=True)  # cleanup others' messes
コード例 #14
0
ファイル: history.py プロジェクト: ehelms/pulp
def archive_call(call_request, call_report):
    archived_call = ArchivedCall(call_request, call_report)
    collection = ArchivedCall.get_collection()
    collection.insert(archived_call, safe=True)
コード例 #15
0
 def setUp(self):
     super(ArchivedCallTests, self).setUp()
     self.archived_call_collection = ArchivedCall.get_collection()
     self.archived_call_collection.remove(
         safe=True)  # cleanup others' messes