Closed rob-dalton closed 5 years ago
For UI changes - we could break out commands into groups. For example:
amti batch <command>
amti workers <command>
I think click allows you to group commands pretty easily.
Also I can't think of a better way to handle single vs multiple WorkerIds. It's a bit clunky, but I feel like you should be able to handle them with the same command, since it's the same action.
This way, you can provide any number of WorkerIds on the command line (makes it easy to handle one or two workers). And if you want to do a large batch, you can leave the IDS
arg empty and just provide a file path.
Sounds good to me.
I really like the idea of having amti batch
and amti workers
command groups, but I think we could handle that in a follow up PR to keep things moving. Changing the UI like that might also justify a larger refactor of the code base, with subpackages for the different command groups.
Having one command per action makes sense to me UI-wise. We should handle the additional columns for other arguments in the case that it takes CSV input (like --reason
for example). Similarly, we should allow the delimiter to be specified by the user, since at a minimum people will probably have both CSV and TSV files. Also, with two input modes, we should have more thorough validation, i.e.
--file
is passed, we should check that ids
is None and --reason
is not used.ids
is passed, we should validate that --file
is not passed and --reason
is present.Or something like that. This issue discusses implementing mutually exclusive options in click, though I think the simplest and probably best approach is to just put a little validation logic at the beginning of the command rather than trying to fit it into click's callbacks / parameter validation.
Added commands for:
Added new utils file for worker management functions.