Replies: 2 comments 2 replies
-
Since you have written this up so well, can you do the same for the pbench agent? =) |
Beta Was this translation helpful? Give feedback.
-
I need to refactor my "state manager" and "dataset importer" tools into this framework, too. I didn't try it originally because I was afraid of being the first to "click" on the server side (even though |
Beta Was this translation helpful? Give feedback.
-
Introduction
This is an initial stab at laying out some thoughts around the new Pbench CLI.
General Requirements
We expect to have at least two CLIs -- one for the server and one for the agent. (There is a possibility of having "client" commands, as well, which would be used to talk to the server over the network, without requiring either a server installation or an agent installation on the user's node.) The CLIs should have a common "feel", with similar (but not identical) options, but they will need to have largely separate implementations, since they will be packaged separately (and since they have separate missions).
The commands will be implemented in Python using the Click package. We expect that, with modest discipline on our part, this will yield a CLI similar to Git's, where we can invoke or refer to specific commands directly (like
pbench-user-create
) or via nested invocations (likepbench user create
) where there is a mainpbench
command which invokes the CLI, and then object-verb sub-commands arranged into groups (such as auser
subgroup which sportscreate
,list
,update
, anddelete
sub-sub-commands).Commands should be named in object-verb format. This allows the manipulation of different objects to be separated from each other while grouping together the available manipulations. This will likely require some changes (e.g.,
pbench-generate-token
should be renamed topbench-token-generate
andpbench-move-results
should becomepbench-results-move
or similar).Where appropriate commands may take positional arguments. Otherwise, the operation of a command can be modified by specifying options or switches. Short options consist of a single hyphen and a single letter; long options consist of two hyphens and (typically) multiple letters; aliases are available. Commands and long options should be lower-case. Neither commands nor option names should contain underscores; hyphens can be used in option names if necessary; commands must be a single word.
There will be a set of options which are common to nearly all commands. These will have a common implementation which is shared by all the command implementations for a given part of Pbench. For instance, the
-C
option for specifying the configuration file is available and used by nearly every command; however, note that the-C
when specified to an agent command looks at the agent configuration file, while the same option on a server command looks at the server configuration file.Specific Commands
Eventually, we should describe all of the current and planned Pbench commands here. For the moment, we'll start with a single set as the concrete basis for discussion.
pbench user
There are four commands which we are in the process of implementing to manipulate users in the server database.
create
No positional parameter; all information is specified via options.
update
The user to be updated is specified as a positional parameter (whether this is a "username", an "email address", a "database identifier" is unspecified and the implementation may accept more than one) and updated values are specified via options.
delete
The user to be deleted is specified as a positional parameter (see comment under
update
).list
No positional parameters (and, no options currently -- it is presumed that, since this is a shell command, the user can pipe the output to shell utilities for additional processing).
Beta Was this translation helpful? Give feedback.
All reactions