Command Plugins
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, is_dummy=False)
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()
For commands we don’t actually want to load all the command modules - we’ll probably only need one. We’ll just put in place dummy commands
- 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).
- setup_arguments(sub_parser)
Add arguments for this command to the give argparse sub_parser.
- silence()
Convert the command to use string IO for its output and error output.
- pavilion.commands.get_command(command_name: str) 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()
For commands we don’t actually want to load all the command modules - we’ll probably only need one. We’ll just put in place dummy commands
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:
CommandPrint 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:
CommandPlugin 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.
- 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.format_numeric(value: Any, digits: int | None) str
run command
The run command resolves tests by their names, builds them, and runs them.
- class pavilion.commands.run.RunCommand
Bases:
CommandResolve 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, log_results: bool = True)
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. :param log_results: Whether or not to automatically run the _log_results command. Useful
for fine-grained control of logging during unit tests.
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:
CommandPlugin 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, args, 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, args, cfg, conf_type) int
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:
CommandPrints 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
view command
Command for showing fully resolved test config.
- class pavilion.commands.view.ViewCommand
Bases:
RunCommandCommand 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:
CommandA command to wait for test completion.
- OUT_FULL = 'full'
- OUT_SILENT = 'silent'
- OUT_SUMMARY = 'summary'
- STATUS_UPDATE_PERIOD = 5
- last_summary_width = 1
- 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.