allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] git commit: [#2835] add --tasks option to reindex cmd, so macros work
Date Wed, 27 Mar 2013 15:22:52 GMT
Updated Branches:
  refs/heads/db/42cc_2835_content_preview bcc5f812a -> c0a7418f6


[#2835] add --tasks option to reindex cmd, so macros work


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ec1341e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ec1341e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ec1341e0

Branch: refs/heads/db/42cc_2835_content_preview
Commit: ec1341e0506ad50c4b5c409891313a35f450404d
Parents: bcc5f81
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Wed Mar 27 14:36:25 2013 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Wed Mar 27 14:36:25 2013 +0000

----------------------------------------------------------------------
 Allura/allura/command/show_models.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ec1341e0/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index 6934424..eaaa2ed 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -42,6 +42,10 @@ class ReindexCommand(base.Command):
                       help='Solr needs artifact references to already exist.')
     parser.add_option('--refs', action='store_true', dest='refs',
                       help='Update artifact references and shortlinks')
+    parser.add_option('--tasks', action='store_true', dest='tasks',
+                      help='Run each individual index operation as a background task.  '
+                           'Note: this is often better, since tasks have "request" objects
'
+                           'which are needed for some markdown macros to run properly')
 
     def command(self):
         from allura import model as M
@@ -91,15 +95,18 @@ class ReindexCommand(base.Command):
                     M.main_orm_session.flush()
                     M.artifact_orm_session.clear()
                     try:
-                        allura.tasks.index_tasks.add_artifacts(ref_ids,
-                                                               update_solr=self.options.solr,
-                                                               update_refs=self.options.refs)
+                        add_artifacts = allura.tasks.index_tasks.add_artifacts
+                        if self.options.tasks:
+                            add_artifacts = add_artifacts.post
+                        add_artifacts(ref_ids,
+                                       update_solr=self.options.solr,
+                                       update_refs=self.options.refs)
                     except CompoundError, err:
                         base.log.exception('Error indexing artifacts:\n%r', err)
                         base.log.error('%s', err.format_error())
                     M.main_orm_session.flush()
                     M.main_orm_session.clear()
-        base.log.info('Reindex done')
+        base.log.info('Reindex %s', 'queued' if self.options.tasks else 'done')
 
 class EnsureIndexCommand(base.Command):
     min_args=1


Mime
View raw message