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)

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.

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.register_core_plugins()

Add all the builtin plugins and activate them.

Included Command Plugins

cancel command

Cancels tests as prescribed by the user.

class pavilion.commands.cancel.CancelCommand

Bases: pavilion.commands.base_classes.Command

Cancel a set of commands using the appropriate scheduler.

run(pav_cfg, args)

Cancel the given tests.

clean command

Clean old tests/builds/etc from the working directory.

class pavilion.commands.clean.CleanCommand

Bases: pavilion.commands.base_classes.Command

Cleans outdated test and series run directories.

run(pav_cfg, args)

Run this command.

log command

Print out the contents of the various log files for a given test run.

class pavilion.commands.log.LogCommand

Bases: pavilion.commands.base_classes.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'}
run(pav_cfg, args)

Figure out which log the user wants and print it.

result command

Print the test results for the given test/suite.

class pavilion.commands.result.ResultsCommand

Bases: pavilion.commands.base_classes.Command

Plugin for result printing.

run(pav_cfg, args)

Print the test results in a variety of formats.

update_results(pav_cfg: dict, tests: List[pavilion.test_run.test_run.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.

run command

The run command resolves tests by their names, builds them, and runs them.

class pavilion.commands.run.RunCommand

Bases: pavilion.commands.base_classes.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.

class pavilion.commands.set_status.SetStatusCommand

Bases: pavilion.commands.base_classes.Command

Plugin for setting the status of a test.

run(pav_cfg, args)

Set the status of the given test.

show command

Show a variety of different internal information for Pavilion.

class pavilion.commands.show.ShowCommand

Bases: pavilion.commands.base_classes.Command

Plugin to show Pavilion internal info.

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 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: pavilion.commands.base_classes.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: pavilion.commands.run.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: pavilion.commands.base_classes.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.

wait(pav_cfg, tests: List[pavilion.test_run.test_run.TestRun], end_time: float, out_mode: str) → None

Wait on each of the given tests to complete, printing a status message

pavilion.commands.wait.check_pgid(pgid)

Checks if pgid still exists. Returns false if pgid does not exist.