Skip to content

Commit

Permalink
Merge f5e180d into 0ca1346
Browse files Browse the repository at this point in the history
  • Loading branch information
drjova committed Feb 22, 2018
2 parents 0ca1346 + f5e180d commit e89668e
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions invenio_indexer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,25 @@ def abort_if_false(ctx, param, value):
@click.option(
'--concurrency', '-c', default=1, type=int,
help='Number of concurrent indexing tasks to start.')
@click.option('--queue', '-q', type=str,
help='Name of the celery queue used to put the tasks into.')
@click.option('--version-type')
@with_appcontext
def run(delayed, concurrency, version_type=None):
def run(delayed, concurrency, version_type=None, queue=None):
"""Run bulk record indexing."""
if delayed:
click.secho(
'Starting {0} tasks for indexing records...'.format(concurrency),
fg='green')
data = {
'kwargs': {
'version_type': version_type
}
}
if queue is not None:
data.update({'queue': queue})
for c in range(0, concurrency):
process_bulk_queue.delay(version_type=version_type)
process_bulk_queue.apply_async(**data)
else:
click.secho('Indexing records...', fg='green')
RecordIndexer(version_type=version_type).process_bulk_queue()
Expand Down

0 comments on commit e89668e

Please sign in to comment.