Page MenuHomeSoftware Heritage

Add support for non-string options when scheduling tasks.
ClosedPublic

Authored by vlorentz on Feb 26 2019, 2:09 PM.

Details

Summary

This also fixes the pretty-printing of tasks, which was ambiguous
(42 and "42" where both printed as 42).

Depends on D1194

Needed to scheduling indexer tasks (which take a boolean argument parse_ids).

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

vlorentz edited the summary of this revision. (Show Details)
vlorentz edited the summary of this revision. (Show Details)

I don't like the idea of making double quoting mandatory on a command-line tool very much.

Can we add a fallback to parsing the input as a plain string if ast.literal_eval fails? (I guess that'd be a YAML-ish parsing fallback strategy :P)

olasd requested changes to this revision.Mar 5 2019, 8:40 AM
This revision now requires changes to proceed.Mar 5 2019, 8:40 AM

Or I could just parse it directly as yaml, as it's (mostly?) a superset of what ast.literal_eval accepts. And it spares us a new quirky format.

Or I could just parse it directly as yaml, as it's (mostly?) a superset of what ast.literal_eval accepts. And it spares us a new quirky format.

My first reaction is *yuck* but I guess that'd work...

  • rebase
  • use yaml instead of ast.literal_eval
olasd added inline comments.
swh/scheduler/cli_utils.py
46

It'd be nice(r) to know which argument was invalid.

swh/scheduler/tests/test_cli.py
115

That hunk shouldn't be needed?

This revision is now accepted and ready to land.Mar 11 2019, 3:34 PM
  • Show which argument is invalid
This revision was automatically updated to reflect the committed changes.