Page MenuHomeSoftware Heritage

Several swwh-scheduler's cli improvements

Authored by douardda on Dec 18 2018, 6:08 PM.


  • Add a --list option to the 'swh-scheduler task' command that lists available task types.
  • Add a new policy argument to SchedulerBackend.create_tasks

    so that we can expose it to cli tools.
  • Add a new 'swh-schedule task add' command

    that allows to easily insert a new task in the scheduler's database, eg.

    swh-scheduler --database 'service=swh-scheduler' \ task add swh-lister-debian distribution=stretch policy=oneshot
  • Refactor a bit the 'swh-scheduler task list-pending' cli tool

    since the task-type is mandatory, make it a command argument instead of an option, and make it variadic, so one can list several pending task types at once.

    Also do not use the pager. Let the user decide whether she wants paginated


Diff Detail

rDSCH Scheduling utilities
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

douardda created this revision.Dec 18 2018, 6:08 PM
olasd added a subscriber: olasd.Dec 18 2018, 6:15 PM

Looks fine to me save from a few nits, thanks!


For consistency, shouldn't this be a task subcommand (or a subcommand for a new task-type group that would allow manipulating task types)?

In any case, this doesn't list tasks, it lists task types, so if it stays here the long option name should be changed (to list-types?).




that docstring should probably be saying --policy ?

olasd requested changes to this revision.Dec 18 2018, 6:15 PM
This revision now requires changes to proceed.Dec 18 2018, 6:15 PM
douardda updated this revision to Diff 2731.Dec 18 2018, 6:39 PM
douardda marked 2 inline comments as done.

Fix typos and inconsistencies reported by olasd

olasd accepted this revision.Dec 18 2018, 6:40 PM
This revision is now accepted and ready to land.Dec 18 2018, 6:40 PM
This revision was automatically updated to reflect the committed changes.