Command Plugins
Table of Contents
pavilion.commands module
Built-in commands, as well as the base classes for those commands, go in this module. While commands are all technically plugins, these are manually added because its faster than searching for them and loading them as plugins.
- class pavilion.commands.Command(name, description, short_help=None, aliases=None, sub_commands=False, formatter_class=None)
Provides a pavilion command via a plugin.
- Variables
parser (argparse.ArgumentParser) – The plugin’s argument parser object.
- _inventory_sub_commands()
Find all the sub commands and populate the sub_cmds dict.
- _run_sub_command(pav_cfg, args)
Find and run the subcommand.
- _setup_arguments(parser)
Setup the commands arguments in the Pavilion argument parser. This is handed a pre-created sub-command parser for this command. Simply add arguments to it like you would a base parser.
parser.add_arguemnt('-x', '--extra', action='store_true', help="Add extra stuff.")
- Parameters
parser (argparse.ArgumentParser) – The parser object.
- _setup_other()
Additional setup actions for this command at activation time. The base version of this does nothing..
- activate()
The Yapsy plugin system calls this to setup the plugin. In this case that includes:
Adding the command’s sub-command arguments to the general pavilion argument parser.
Running the _setup_other method.
Adding the command to Pavilion’s known commands.
- clear_output()
Reset the output io buffers for this command.
- deactivate()
You can’t deactivate commands.
- property path
The path to the object that defined this instance.
- register_core_plugins()
Add all the builtin plugins and activate them.
- run(pav_cfg, args)
Override this method with your command’s code.
- Parameters
pav_cfg – The pavilion configuration object.
args (argparse.Namespace) – The parsed arguments for pavilion.
- Returns
The return code of the command should denote success (0) or failure (not 0).
- silence()
Convert the command to use string IO for its output and error output.
- pavilion.commands.get_command(command_name: str) Union[None, Command]
Return the command of the given name. This assumes the command has already been validated as being one that exists.
- pavilion.commands.load(*cmds: str)
Load the given commands. If no commands are given, load all commands.
- pavilion.commands.register_core_plugins()
Add all the builtin plugins and activate them.
Included Command Plugins
cancel command
Cancels tests as prescribed by the user.
clean command
Clean old tests/builds/etc from the working directory.
log command
Print out the contents of the various log files for a given test run.
- class pavilion.commands.log.LogCommand
Bases:
Command
Print the contents of log files for test runs.
- LOG_PATHS = {'build': 'build.log', 'kickoff': 'job/kickoff.log', 'results': 'results.log', 'run': 'run.log', 'series': 'series.out'}
- error_msg(err_msg: str, follow: bool)
Prints the error message.
- follow_testing = False
- run(pav_cfg, args)
Figure out which log the user wants and print it.
- sleep_timeout = 1
result command
Print the test results for the given test/suite.
- class pavilion.commands.result.ResultsCommand
Bases:
Command
Plugin for result printing.
- key_fields(args)
Update default fields with keys given as arguments. Returns a list of fields (columns) to be shown as output.
- run(pav_cfg, args)
Print the test results in a variety of formats.
- update_results(pav_cfg: dict, tests: List[TestRun], log_file: IO[str], save: bool = False) bool
Update each of the given tests with the result section from the current version of their configs. Then rerun result processing and update the results in the test object (but change nothing on disk).
- Parameters
pav_cfg – The pavilion config.
tests – A list of test objects to update.
log_file – The logfile to log results to. May be None.
save – Whether to save the updated results to the test’s result log. It will not update the general result log.
- Returns
True if successful, False otherwise. Will handle printing of any failure related errors.
- pavilion.commands.result.sort_results(args, results: List[dict]) List[dict]
Same basic operation as pavilion.filters.get_sort_opts except here the sort operation is performed on the results array rather than stored as a function and called later.
If the sort-by key is present in the test object, the sort will be performed in dir_db.select or select_from. Otherwise the default sort will be performed in dir_db and here the results dict will be sorted according to the key for output.
Results dicts without the key will be skipped with dummy value dval. Thus the user may sort the results of incomplete series, by result keys specific to a particular test in a series, or by keys that are not being displayed. If the key is not in any of the results dicts, it simply returns a copy of the results dict.
- Parameters
args – Command line arguments, for sort_by.
results – A list of flattened result dicts.
- Returns
The sorted (or copied) list of results dicts.
run command
The run command resolves tests by their names, builds them, and runs them.
- class pavilion.commands.run.RunCommand
Bases:
Command
Resolve tests by name, build, and run them.
- Variables
last_series (TestSeries) – The suite number of the last suite to run with this command (for unit testing).
last_tests (List[TestRun]) – A list of the last test runs that this command started (also for unit testing).
- BUILD_ONLY = False
- SLEEP_INTERVAL = 1
- run(pav_cfg, args)
Resolve the test configurations into individual tests and assign to schedulers. Have those schedulers kick off jobs to run the individual tests themselves. :param pav_cfg: The pavilion configuration. :param args: The parsed command line argument object.
set_status command
Set the status for a test run. Typically used by pavilion when a test run errors inside its run script.
show command
Show a variety of different internal information for Pavilion.
- class pavilion.commands.show.ShowCommand
Bases:
Command
Plugin to show Pavilion internal info.
- BUILD_KEYS = ['build']
- DOC_KEYS = ['summary', 'doc']
- INHERITANCE_KEYS = ['inherits_from']
- PERMUTATION_KEYS = ['permute_on', 'subtitle']
- RESULT_KEYS = ['result_parse', 'result_evaluate']
- RUN_KEYS = ['run']
- SCHEDULING_KEYS = ['schedule', 'chunk']
- SUMMARY_SIZE_LIMIT = 100
- run(pav_cfg, args)
Run the show command’s chosen sub-command.
- show_configs_table(pav_cfg, conf_type, errors=False, verbose=False)
Default config table, shows the config name and if it can be loaded.
- show_full_config(pav_cfg, cfg_name, conf_type)
Show the full config of a given os/host/mode.
- show_vars(pav_cfg, cfg, conf_type)
Show the variables of a config, each variable is displayed as a table.
status command
The Status command, along with useful functions that make it easy for other commands to print statuses.
- class pavilion.commands.status.StatusCommand
Bases:
Command
Prints the status of a set of tests.
- print_summary(statuses)
Print_summary takes in a list of test statuses. It summarizes basic state output and displays the data to the user through draw_table. :param statuses: state list of current jobs :rtype: int
- run(pav_cfg, args)
Gathers and prints the statuses from the specified test runs and/or series.
view command
Command for showing fully resolved test config.
- class pavilion.commands.view.ViewCommand
Bases:
RunCommand
Command for showing fully resolved test config.
- SLEEP_INTERVAL = 1
- run(pav_cfg, args)
Resolve the test configurations into individual tests and assign to schedulers. Have those schedulers kick off jobs to run the individual tests themselves.
wait command
Wait for the specified tests to finish, printing progress reports along the way.
- class pavilion.commands.wait.WaitCommand
Bases:
Command
A command to wait for test completion.
- OUT_SILENT = 'silent'
- OUT_SUMMARY = 'summary'
- STATUS_UPDATE_PERIOD = 5
- run(pav_cfg, args)
Wait for the requested tests to complete.
- pavilion.commands.wait.check_pgid(pgid)
Checks if pgid still exists. Returns false if pgid does not exist.