Page MenuHomeSoftware Heritage

Several swwh-scheduler's cli improvements
ClosedPublic

Authored by douardda on Dec 18 2018, 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

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

swh/scheduler/cli.py
113–114

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!

202

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 marked 2 inline comments as done.

Fix typos and inconsistencies reported by olasd

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.