Page MenuHomeSoftware Heritage

Several swwh-scheduler's cli improvements
ClosedPublic

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

Details

Summary
  • 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

results.

Diff Detail

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

Event Timeline

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

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

swh/scheduler/cli.py
114–115

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?).

189

Yes!

203

that docstring should probably be saying --policy ?

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

Fix typos and inconsistencies reported by olasd

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