コード例 #1
0
 def _post_add_artifacts(self, chunk):
     """
     Post task, recursively splitting and re-posting if the resulting
     mongo document is too large.
     """
     try:
         add_artifacts.post(chunk,
                 update_solr=self.options.solr,
                 update_refs=self.options.refs)
     except InvalidDocument as e:
         # there are many types of InvalidDocument, only recurse if its expected to help
         if str(e).startswith('BSON document too large'):
             self._post_add_artifacts(chunk[:len(chunk) // 2])
             self._post_add_artifacts(chunk[len(chunk) // 2:])
         else:
             raise
コード例 #2
0
ファイル: show_models.py プロジェクト: heiths/allura
 def _post_add_artifacts(self, chunk):
     """
     Post task, recursively splitting and re-posting if the resulting
     mongo document is too large.
     """
     try:
         with self.ming_config(self.options.ming_config):
             add_artifacts.post(
                 chunk, update_solr=self.options.solr, update_refs=self.options.refs, **self.add_artifact_kwargs
             )
     except InvalidDocument as e:
         # there are many types of InvalidDocument, only recurse if its
         # expected to help
         if e.args[0].startswith("BSON document too large"):
             self._post_add_artifacts(chunk[: len(chunk) // 2])
             self._post_add_artifacts(chunk[len(chunk) // 2 :])
         else:
             raise