Command Plugins

pavilion.commands module

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.

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.

exception pavilion.commands.CommandError

Bases: RuntimeError

The error type commands should raise for semi-expected errors.

pavilion.commands.add_command(command)

Add the given command instance to the dictionary of commands.

Parameters:command (Command) – The command object to add
pavilion.commands.get_command(command_name)

Return the command of the given name.

Parameters:command_name (str) – The name of the command to search for.
Return type:Command
pavilion.commands.sub_cmd(*aliases)

Tag this given function as a sub_cmd, and record its aliases.

Included Command Plugins

cancel command

Cancels tests as prescribed by the user.

class pavilion.plugins.commands.cancel.CancelCommand

Bases: pavilion.commands.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.plugins.commands.clean.CleanCommand

Bases: pavilion.commands.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.plugins.commands.log.LogCommand

Bases: pavilion.commands.Command

Print the contents of log files for test runs.

LOG_PATHS = {'build': 'build.log', 'kickoff': '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.plugins.commands.result.ResultsCommand

Bases: pavilion.commands.Command

Plugin for result printing.

BASE_FIELDS = ['name', 'id', 'sys_name', 'started', 'finished', 'result']
run(pav_cfg, args)

Print the test results in a variety of formats.

update_results(pav_cfg: dict, tests: List[pavilion.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.plugins.commands.run.RunCommand

Bases: pavilion.commands.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.plugins.commands.set_status.SetStatusCommand

Bases: pavilion.commands.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.plugins.commands.show.ShowCommand

Bases: pavilion.commands.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.plugins.commands.status.StatusCommand

Bases: pavilion.commands.Command

Prints the status of a set of tests.

display_history(pav_cfg, args)

Display_history takes a test_id from the command line arguments and formats the status file from the id and displays it for the user through draw tables. :param pav_cfg: The pavilion config. :param argparse namespace args: The test via command line :rtype int

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

class pavilion.plugins.commands.view.ViewCommand

Bases: pavilion.plugins.commands.run.RunCommand

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 err_file:

wait command

Wait for the specified tests to finish, printing progress reports along the way.

class pavilion.plugins.commands.wait.WaitCommand

Bases: pavilion.commands.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[int], end_time: float, out_mode: str) → None

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