You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/04/25 00:30:57 UTC

[32/50] git commit: [#2835] add --tasks option to reindex cmd, so macros work

[#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/196f7186
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/196f7186
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/196f7186

Branch: refs/heads/cj/5655
Commit: 196f718649439d2a5c07bc92ea34cc8269565921
Parents: ee3e615
Author: Dave Brondsema <db...@geek.net>
Authored: Wed Mar 27 14:36:25 2013 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Wed Apr 24 16:34:42 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/196f7186/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index 940adbd..890805d 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -59,6 +59,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
@@ -108,15 +112,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