Advertisement
Guest User

Untitled

a guest
Sep 15th, 2014
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.72 KB | None | 0 0
  1. 2014-09-14 15:11:35,234 [noc.lib.debug] UNHANDLED EXCEPTION (2014-09-14 15:10:49.976076)
  2. Working directory: /opt/noc
  3. <class 'pymongo.errors.OperationFailure'>
  4. 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
  5. START OF TRACEBACK
  6. ------------------------------------------------------------------------
  7. File: /opt/noc/lib/python2.7/site-packages/pymongo/helpers.py (Line: 178)
  8. Function: _check_command_response
  9. 171 # findAndModify with upsert can raise duplicate key error
  10. 172 if code in (11000, 11001, 12582):
  11. 173 raise DuplicateKeyError(errmsg, code, response)
  12. 174 elif code == 50:
  13. 175 raise ExecutionTimeout(errmsg, code, response)
  14. 176
  15. 177 msg = msg or "%s"
  16. 178 ==> raise OperationFailure(msg % errmsg, code, response)
  17. 179
  18. 180
  19. 181 def _check_write_command_response(results):
  20. 182 """Backward compatibility helper for write command error handling.
  21. 183 """
  22. 184 errors = [res for res in results
  23. Variables:
  24. reset = <bound method MongoClient.disconnect of MongoClient('localhost', 27017)>
  25. code = 85
  26. allowable_errors = []
  27. details =
  28. {u'code': 85,
  29. u'errmsg': u'Index with name: as_set_1 already exists with different options',
  30. u'ok': 0.0}
  31. msg =
  32. "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"
  33. response =
  34. {u'code': 85,
  35. u'errmsg': u'Index with name: as_set_1 already exists with different options',
  36. u'ok': 0.0}
  37. errmsg = u'Index with name: as_set_1 already exists with different options'
  38. ------------------------------------------------------------------------
  39. File: /opt/noc/lib/python2.7/site-packages/pymongo/database.py (Line: 351)
  40. Function: _command
  41. 344 cursor = self["$cmd"].find(command, **extra_opts).limit(-1)
  42. 345 for doc in cursor:
  43. 346 result = doc
  44. 347
  45. 348 if check:
  46. 349 msg = "command %s failed: %%s" % repr(command).replace("%", "%%")
  47. 350 helpers._check_command_response(result, self.connection.disconnect,
  48. 351 ==> msg, allowable_errors)
  49. 352
  50. 353 return result, cursor.conn_id
  51. 354
  52. 355 def command(self, command, value=1,
  53. 356 check=True, allowable_errors=[],
  54. 357 uuid_subtype=OLD_UUID_SUBTYPE, compile_re=True, **kwargs):
  55. Variables:
  56. kwargs =
  57. {'indexes': [{'background': False,
  58. 'dropDups': False,
  59. 'key': SON([('as_set', 1)]),
  60. 'name': u'as_set_1',
  61. 'sparse': False,
  62. 'unique': True}]}
  63. allowable_errors = []
  64. doc =
  65. {u'code': 85,
  66. u'errmsg': u'Index with name: as_set_1 already exists with different options',
  67. u'ok': 0.0}
  68. self = Database(MongoClient('localhost', 27017), u'noc')
  69. must_use_master = True
  70. value = u'noc.whois.asset.members'
  71. cursor = <pymongo.cursor.Cursor object at 0x81dcf8150>
  72. command =
  73. 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}])])
  74. result =
  75. {u'code': 85,
  76. u'errmsg': u'Index with name: as_set_1 already exists with different options',
  77. u'ok': 0.0}
  78. fields = None
  79. msg =
  80. "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"
  81. extra_opts =
  82. {'_must_use_master': True,
  83. '_uuid_subtype': 3,
  84. 'as_class': None,
  85. 'compile_re': True,
  86. 'read_preference': 0,
  87. 'secondary_acceptable_latency_ms': 15.0,
  88. 'slave_okay': False,
  89. 'tag_sets': [{}]}
  90. compile_re = True
  91. check = True
  92. uuid_subtype = 3
  93. command_name = 'createindexes'
  94. ------------------------------------------------------------------------
  95. File: /opt/noc/lib/python2.7/site-packages/pymongo/database.py (Line: 445)
  96. Function: command
  97. 438 `command` can be a string in addition to a full document.
  98. 439 .. versionadded:: 1.4
  99. 440
  100. 441 .. mongodoc:: commands
  101. 442 .. _localThreshold: http://docs.mongodb.org/manual/reference/mongos/#cmdoption-mongos--localThreshold
  102. 443 """
  103. 444 return self._command(command, value, check, allowable_errors,
  104. 445 ==> uuid_subtype, compile_re, **kwargs)[0]
  105. 446
  106. 447 def collection_names(self, include_system_collections=True):
  107. 448 """Get a list of all the collection names in this database.
  108. 449
  109. 450 :Parameters:
  110. 451 - `include_system_collections` (optional): if ``False`` list
  111. Variables:
  112. allowable_errors = []
  113. self = Database(MongoClient('localhost', 27017), u'noc')
  114. value = u'noc.whois.asset.members'
  115. command = 'createIndexes'
  116. kwargs =
  117. {'indexes': [{'background': False,
  118. 'dropDups': False,
  119. 'key': SON([('as_set', 1)]),
  120. 'name': u'as_set_1',
  121. 'sparse': False,
  122. 'unique': True}],
  123. 'read_preference': 0}
  124. compile_re = True
  125. check = True
  126. uuid_subtype = 3
  127. ------------------------------------------------------------------------
  128. File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 1060)
  129. Function: create_index
  130. 1053 kwargs["bucketSize"] = kwargs.pop("bucket_size")
  131. 1054
  132. 1055 index.update(kwargs)
  133. 1056
  134. 1057 try:
  135. 1058 self.__database.command('createIndexes', self.name,
  136. 1059 read_preference=ReadPreference.PRIMARY,
  137. 1060 ==> indexes=[index])
  138. 1061 except OperationFailure, exc:
  139. 1062 if exc.code in common.COMMAND_NOT_FOUND_CODES:
  140. 1063 index["ns"] = self.__full_name
  141. 1064 self.__database.system.indexes.insert(index, manipulate=False,
  142. 1065 check_keys=False,
  143. 1066 **self._get_wc_override())
  144. Variables:
  145. index =
  146. {'background': False,
  147. 'dropDups': False,
  148. 'key': SON([('as_set', 1)]),
  149. 'name': u'as_set_1',
  150. 'sparse': False,
  151. 'unique': True}
  152. index_doc = SON([('as_set', 1)])
  153. exc =
  154. 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",)
  155. keys = [('as_set', 1)]
  156. self =
  157. Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
  158. cache_for = 300
  159. kwargs =
  160. {'background': False,
  161. 'dropDups': False,
  162. 'name': u'as_set_1',
  163. 'sparse': False,
  164. 'unique': True}
  165. key_or_list = [('as_set', 1)]
  166. name = u'as_set_1'
  167. ------------------------------------------------------------------------
  168. File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 1167)
  169. Function: ensure_index
  170. 1160 name = kwargs["name"]
  171. 1161 else:
  172. 1162 keys = helpers._index_list(key_or_list)
  173. 1163 name = kwargs["name"] = _gen_index_name(keys)
  174. 1164
  175. 1165 if not self.__database.connection._cached(self.__database.name,
  176. 1166 self.__name, name):
  177. 1167 ==> return self.create_index(key_or_list, cache_for, **kwargs)
  178. 1168 return None
  179. 1169
  180. 1170 def drop_indexes(self):
  181. 1171 """Drops all indexes on this collection.
  182. 1172
  183. 1173 Can be used on non-existant collections or collections with no indexes.
  184. Variables:
  185. name = u'as_set_1'
  186. keys = [('as_set', 1)]
  187. self =
  188. Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
  189. kwargs =
  190. {'background': False,
  191. 'drop_dups': False,
  192. 'name': u'as_set_1',
  193. 'sparse': False,
  194. 'unique': True}
  195. cache_for = 300
  196. key_or_list = [('as_set', 1)]
  197. ------------------------------------------------------------------------
  198. File: /opt/noc/lib/python2.7/site-packages/mongoengine/document.py (Line: 574)
  199. Function: ensure_indexes
  200. 567 for spec in index_spec:
  201. 568 spec = spec.copy()
  202. 569 fields = spec.pop('fields')
  203. 570 cls_indexed = cls_indexed or includes_cls(fields)
  204. 571 opts = index_opts.copy()
  205. 572 opts.update(spec)
  206. 573 collection.ensure_index(fields, background=background,
  207. 574 ==> drop_dups=drop_dups, **opts)
  208. 575
  209. 576 # If _cls is being used (for polymorphism), it needs an index,
  210. 577 # only if another index doesn't begin with _cls
  211. 578 if (index_cls and not cls_indexed and
  212. 579 cls._meta.get('allow_inheritance', ALLOW_INHERITANCE) is True):
  213. 580 collection.ensure_index('_cls', background=background,
  214. Variables:
  215. index_spec = [{'fields': [('as_set', 1)], 'unique': True, 'sparse': False}]
  216. fields = [('as_set', 1)]
  217. collection =
  218. Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.whois.asset.members')
  219. drop_dups = False
  220. background = False
  221. cls_indexed = False
  222. cls = <class 'noc.peer.models.whoisassetmembers.WhoisASSetMembers'>
  223. index_cls = True
  224. spec = {'unique': True, 'sparse': False}
  225. opts = {'unique': True, 'sparse': False}
  226. index_opts = {}
  227. ------------------------------------------------------------------------
  228. File: /opt/noc/lib/python2.7/site-packages/mongoengine/document.py (Line: 178)
  229. Function: _get_collection
  230. 171 opts['max'] = max_documents
  231. 172 cls._collection = db.create_collection(
  232. 173 collection_name, **opts
  233. 174 )
  234. 175 else:
  235. 176 cls._collection = db[collection_name]
  236. 177 if cls._meta.get('auto_create_index', True):
  237. 178 ==> cls.ensure_indexes()
  238. 179 return cls._collection
  239. 180
  240. 181 def save(self, force_insert=False, validate=True, clean=True,
  241. 182 write_concern=None, cascade=None, cascade_kwargs=None,
  242. 183 _refs=None, **kwargs):
  243. 184 """Save the :class:`~mongoengine.Document` to the database. If the
  244. Variables:
  245. collection_name = 'noc.whois.asset.members'
  246. db = Database(MongoClient('localhost', 27017), u'noc')
  247. cls = <class 'noc.peer.models.whoisassetmembers.WhoisASSetMembers'>
  248. ------------------------------------------------------------------------
  249. File: /opt/noc/peer/models/whoisassetmembers.py (Line: 44)
  250. Function: upload
  251. 37 def upload(cls, data):
  252. 38 """
  253. 39 Replace cache with the new data
  254. 40 :param cls:
  255. 41 :param data: List of {as_set:, members:}
  256. 42 :return: Number of inserted records
  257. 43 """
  258. 44 ==> c = cls._get_collection()
  259. 45 c.drop()
  260. 46 c.insert(data, manipulate=False, check_keys=False)
  261. 47 # Reindex
  262. 48 c.ensure_index("as_set")
  263. 49 return c.count()
  264. Variables:
  265. data =
  266. [{'as_set': 'AS-INTERCOLO',
  267. 'members': ['AS57433',
  268. 'AS59592',
  269. 'AS197071',
  270. 'AS35042',
  271. 'AS29066',...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement