Skip to content

Commit

Permalink
Merge pull request #688 from Princeton-CDH/feature/revise-index-by-so…
Browse files Browse the repository at this point in the history
…urce

Revise index pages source args to make it easier to use
  • Loading branch information
rlskoeser authored Oct 30, 2024
2 parents cc6a2d0 + 30c05f9 commit 69df0ec
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ppa/archive/management/commands/index_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,27 @@ def add_arguments(self, parser):
parser.add_argument(
"source_ids", nargs="*", help="List of specific items to index (optional)"
)
parser.add_argument(
"--source", help="Limit to one source", choices=Command.sources.keys()
)
parser.add_argument(
"--expedite",
help="Only index works with page count mismatch between Solr and database",
action="store_true",
default=False,
)

# add source names as arguments to take advantage of
# argparse built in prefixing; lower case args but display proper case
source_arg_group = parser.add_argument_group(
"Source", "Limit indexing to all works from a specific source"
)
for source_name in Command.sources.keys():
source_arg_group.add_argument(
f"--{source_name.lower()}",
help=source_name,
dest="source",
action="store_const",
const=source_name,
)

def handle(self, *args, **kwargs):
self.verbosity = kwargs.get("verbosity", self.v_normal)
num_processes = kwargs.get("processes", cpu_count())
Expand Down

0 comments on commit 69df0ec

Please sign in to comment.