hatnote / montage

📷 Photo evaluation tool for and by Wiki Loves competitions
https://commons.wikimedia.org/wiki/Commons:Montage
BSD 3-Clause "New" or "Revised" License
36 stars 11 forks source link

Refactor and clean up admin tools #142

Closed mahmoud closed 4 years ago

mahmoud commented 5 years ago

Using the master branch of face, massively cleaned up the admin tools. I think there's still a little ways to go to create a full-blown CLI, but figured I'd open up a PR to start reviewing, as the changes are pretty sizable.

mahmoud commented 5 years ago

The new interface is subcommand-driven instead of flags, and has a much nicer help:

Usage: tools/admin.py subcommand [FLAGS] 

CLI tools for administrating Montage.

Subcommands: 

  add-organizer               Add a top-level organizer to the system, capable of
                              creating campaigns and adding coordinators.
  add-coordinator             add specified user as coordinator of a given campaign
  create-campaign             interactively create a campaign
  cancel-campaign             cancel the specified campaign
  create-round                interactively create a round in the specified campaign
  import-gist                 import round entries from a csv list
  activate-round              activate a round to start or resume voting
  pause-round                 pause a round to make edits and perform other maintenance
  advance-round               finalize the specified round and start the next
  edit-round-quorum           change the quorum of a given round, assigning and
                              reassigning tasks as need be
  check-round-dupes           check for double-assigned tasks or ratings in a specified
                              round
  apply-round-ratings         apply ratings to a round based on an input file
  retask-duplicate-ratings    reassign all ratings that were duplicated
  shuffle-round-assignments   randomly reassign all the rating tasks in a round
  cancel-round                set a round as cancelled, cancel related tasks and remove
                              it from the campaign's active rounds.
  list-campaigns              list details about all campaigns
  rdb-console                 Load a developer console for interacting with database
                              objects.

Flags: 

  --help / -h   show this help message and exit

And the help of a subcommand:

$ python tools/admin.py cancel-campaign -h
Usage: tools/admin.py cancel_campaign [FLAGS]

cancel the specified campaign

Flags:

  --help / -h                 show this help message and exit
  --debug                     get extra output, enable debug console before db commit
  --force                     skip some confirmations, use with caution
  --campaign-id CAMPAIGN_ID   integer (required)
slaporte commented 5 years ago

This format is a big improvement. I personally like the proposal for more hierarchy, like montage-cli round activate.

Does each subcommand specify which flags are relevant/required? (eg, some need campaign-id, others need round-id, you'd never need both)

mahmoud commented 5 years ago

Yep! face does that automatically :)

On Fri, Apr 19, 2019, 12:54 AM Stephen LaPorte notifications@github.com wrote:

This format is a big improvement. I personally like the proposal for more hierarchy, like montage-cli round activate.

Does each subcommand specify which flags are relevant/required? (eg, some need campaign-id, others need round-id, you'd never need both)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hatnote/montage/pull/142#issuecomment-484797057, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA7ZEILXYZESTWYJBVA5Y3PRF3B5ANCNFSM4HGZWVCA .

mahmoud commented 4 years ago

Alright, calling this good for now. The rest we'll fix forward. The priority right now is to get this into a real packaged state, with admin tools living inside the montage app. Then we refactor the tests, get the CLI under test, and maybe do some instrumenting.