Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 2014-09-14 15:11:35,234 [noc.lib.debug] UNHANDLED EXCEPTION (2014-09-14 15:10:49.976076)
- Working directory: /opt/noc
- <class 'pymongo.errors.OperationFailure'>
- command SON([('createIndexes', u'noc.whois.asset.members'), ('indexes', [{'name': u'as_set_1', 'key': SON([('as_set', 1)]), 'unique': True, 'background': False, 'sparse': False, 'dropDups': False}])]) failed: Index with name: as_set_1 already exists with different options
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/helpers.py (Line: 178)
- Function: _check_command_response
- 171 # findAndModify with upsert can raise duplicate key error
- 172 if code in (11000, 11001, 12582):
- 173 raise DuplicateKeyError(errmsg, code, response)
- 174 elif code == 50:
- 175 raise ExecutionTimeout(errmsg, code, response)
- 176
- 177 msg = msg or "%s"
- 178 ==> raise OperationFailure(msg % errmsg, code, response)
- 179
- 180
- 181 def _check_write_command_response(results):
- 182 """Backward compatibility helper for write command error handling.
- 183 """
- 184 errors = [res for res in results
- Variables:
- reset = <bound method MongoClient.disconnect of MongoClient('localhost', 27017)>
- code = 85
- allowable_errors = []
- details =
- {u'code': 85,
- u'errmsg': u'Index with name: as_set_1 already exists with different options',
- u'ok': 0.0}
- msg =
- "command SON([('createIndexes', u'noc.whois.asset.members'), ('indexes', [{'name': u'as_set_1', 'key': SON([('as_set', 1)]), 'unique': True, 'background': False, 'sparse': False, 'dropDups': False}])]) failed: %s"
- response =
- {u'code': 85,
- u'errmsg': u'Index with name: as_set_1 already exists with different options',
- u'ok': 0.0}
- errmsg = u'Index with name: as_set_1 already exists with different options'
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/database.py (Line: 351)
- Function: _command
- 344 cursor = self["$cmd"].find(command, **extra_opts).limit(-1)
- 345 for doc in cursor:
- 346 result = doc
- 347
- 348 if check:
- 349 msg = "command %s failed: %%s" % repr(command).replace("%", "%%")
- 350 helpers._check_command_response(result, self.connection.disconnect,
- 351 ==> msg, allowable_errors)
- 352
- 353 return result, cursor.conn_id
- 354
- 355 def command(self, command, value=1,
- 356 check=True, allowable_errors=[],
- 357 uuid_subtype=OLD_UUID_SUBTYPE, compile_re=True, **kwargs):
- Variables:
- kwargs =
- {'indexes': [{'background': False,
- 'dropDups': False,
- 'key': SON([('as_set', 1)]),
- 'name': u'as_set_1',
- 'sparse': False,
- 'unique': True}]}
- allowable_errors = []
- doc =
- {u'code': 85,
- u'errmsg': u'Index with name: as_set_1 already exists with different options',
- u'ok': 0.0}
- self = Database(MongoClient('localhost', 27017), u'noc')
- must_use_master = True
- value = u'noc.whois.asset.members'
- cursor = <pymongo.cursor.Cursor object at 0x81dcf8150>
- command =
- SON([('createIndexes', u'noc.whois.asset.members'), ('indexes', [{'name': u'as_set_1', 'key': SON([('as_set', 1)]), 'unique': True, 'background': False, 'sparse': False, 'dropDups': False}])])
- result =
- {u'code': 85,
- u'errmsg': u'Index with name: as_set_1 already exists with different options',
- u'ok': 0.0}
- fields = None
- msg =
- "command SON([('createIndexes', u'noc.whois.asset.members'), ('indexes', [{'name': u'as_set_1', 'key': SON([('as_set', 1)]), 'unique': True, 'background': False, 'sparse': False, 'dropDups': False}])]) failed: %s"
- extra_opts =
- {'_must_use_master': True,
- '_uuid_subtype': 3,
- 'as_class': None,
- 'compile_re': True,
- 'read_preference': 0,
- 'secondary_acceptable_latency_ms': 15.0,
- 'slave_okay': False,
- 'tag_sets': [{}]}
- compile_re = True
- check = True
- uuid_subtype = 3
- command_name = 'createindexes'
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/database.py (Line: 445)
- Function: command
- 438 `command` can be a string in addition to a full document.
- 439 .. versionadded:: 1.4
- 440
- 441 .. mongodoc:: commands
- 442 .. _localThreshold: http://docs.mongodb.org/manual/reference/mongos/#cmdoption-mongos--localThreshold
- 443 """
- 444 return self._command(command, value, check, allowable_errors,
- 445 ==> uuid_subtype, compile_re, **kwargs)[0]
- 446
- 447 def collection_names(self, include_system_collections=True):
- 448 """Get a list of all the collection names in this database.
- 449
- 450 :Parameters:
- 451 - `include_system_collections` (optional): if ``False`` list
- Variables:
- allowable_errors = []
- self = Database(MongoClient('localhost', 27017), u'noc')
- value = u'noc.whois.asset.members'
- command = 'createIndexes'
- kwargs =
- {'indexes': [{'background': False,
- 'dropDups': False,
- 'key': SON([('as_set', 1)]),
- 'name': u'as_set_1',
- 'sparse': False,
- 'unique': True}],
- 'read_preference': 0}
- compile_re = True
- check = True
- uuid_subtype = 3
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 1060)
- Function: create_index
- 1053 kwargs["bucketSize"] = kwargs.pop("bucket_size")
- 1054
- 1055 index.update(kwargs)
- 1056
- 1057 try:
- 1058 self.__database.command('createIndexes', self.name,
- 1059 read_preference=ReadPreference.PRIMARY,
- 1060 ==> indexes=[index])
- 1061 except OperationFailure, exc:
- 1062 if exc.code in common.COMMAND_NOT_FOUND_CODES:
- 1063 index["ns"] = self.__full_name
- 1064 self.__database.system.indexes.insert(index, manipulate=False,
- 1065 check_keys=False,
- 1066 **self._get_wc_override())
- Variables:
- index =
- {'background': False,
- 'dropDups': False,
- 'key': SON([('as_set', 1)]),
- 'name': u'as_set_1',
- 'sparse': False,
- 'unique': True}
- index_doc = SON([('as_set', 1)])
- exc =
- OperationFailure(u"command SON([('createIndexes', u'noc.whois.asset.members'), ('indexes', [{'name': u'as_set_1', 'key': SON([('as_set', 1)]), 'unique': True, 'background': False, 'sparse': False, 'dropDups': False}])]) failed: Index with name: as_set_1 already exists with different options",)
- keys = [('as_set', 1)]
- self =
- Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
- cache_for = 300
- kwargs =
- {'background': False,
- 'dropDups': False,
- 'name': u'as_set_1',
- 'sparse': False,
- 'unique': True}
- key_or_list = [('as_set', 1)]
- name = u'as_set_1'
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 1167)
- Function: ensure_index
- 1160 name = kwargs["name"]
- 1161 else:
- 1162 keys = helpers._index_list(key_or_list)
- 1163 name = kwargs["name"] = _gen_index_name(keys)
- 1164
- 1165 if not self.__database.connection._cached(self.__database.name,
- 1166 self.__name, name):
- 1167 ==> return self.create_index(key_or_list, cache_for, **kwargs)
- 1168 return None
- 1169
- 1170 def drop_indexes(self):
- 1171 """Drops all indexes on this collection.
- 1172
- 1173 Can be used on non-existant collections or collections with no indexes.
- Variables:
- name = u'as_set_1'
- keys = [('as_set', 1)]
- self =
- Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
- kwargs =
- {'background': False,
- 'drop_dups': False,
- 'name': u'as_set_1',
- 'sparse': False,
- 'unique': True}
- cache_for = 300
- key_or_list = [('as_set', 1)]
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/document.py (Line: 574)
- Function: ensure_indexes
- 567 for spec in index_spec:
- 568 spec = spec.copy()
- 569 fields = spec.pop('fields')
- 570 cls_indexed = cls_indexed or includes_cls(fields)
- 571 opts = index_opts.copy()
- 572 opts.update(spec)
- 573 collection.ensure_index(fields, background=background,
- 574 ==> drop_dups=drop_dups, **opts)
- 575
- 576 # If _cls is being used (for polymorphism), it needs an index,
- 577 # only if another index doesn't begin with _cls
- 578 if (index_cls and not cls_indexed and
- 579 cls._meta.get('allow_inheritance', ALLOW_INHERITANCE) is True):
- 580 collection.ensure_index('_cls', background=background,
- Variables:
- index_spec = [{'fields': [('as_set', 1)], 'unique': True, 'sparse': False}]
- fields = [('as_set', 1)]
- collection =
- Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
- drop_dups = False
- background = False
- cls_indexed = False
- cls = <class 'noc.peer.models.whoisassetmembers.WhoisASSetMembers'>
- index_cls = True
- spec = {'unique': True, 'sparse': False}
- opts = {'unique': True, 'sparse': False}
- index_opts = {}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/document.py (Line: 178)
- Function: _get_collection
- 171 opts['max'] = max_documents
- 172 cls._collection = db.create_collection(
- 173 collection_name, **opts
- 174 )
- 175 else:
- 176 cls._collection = db[collection_name]
- 177 if cls._meta.get('auto_create_index', True):
- 178 ==> cls.ensure_indexes()
- 179 return cls._collection
- 180
- 181 def save(self, force_insert=False, validate=True, clean=True,
- 182 write_concern=None, cascade=None, cascade_kwargs=None,
- 183 _refs=None, **kwargs):
- 184 """Save the :class:`~mongoengine.Document` to the database. If the
- Variables:
- collection_name = 'noc.whois.asset.members'
- db = Database(MongoClient('localhost', 27017), u'noc')
- cls = <class 'noc.peer.models.whoisassetmembers.WhoisASSetMembers'>
- ------------------------------------------------------------------------
- File: /opt/noc/peer/models/whoisassetmembers.py (Line: 44)
- Function: upload
- 37 def upload(cls, data):
- 38 """
- 39 Replace cache with the new data
- 40 :param cls:
- 41 :param data: List of {as_set:, members:}
- 42 :return: Number of inserted records
- 43 """
- 44 ==> c = cls._get_collection()
- 45 c.drop()
- 46 c.insert(data, manipulate=False, check_keys=False)
- 47 # Reindex
- 48 c.ensure_index("as_set")
- 49 return c.count()
- Variables:
- data =
- [{'as_set': 'AS-INTERCOLO',
- 'members': ['AS57433',
- 'AS59592',
- 'AS197071',
- 'AS35042',
- 'AS29066',...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement