Command Plugins¶
Table of Contents
pavilion.commands module¶
-
class
pavilion.commands.
Command
(name, description, short_help=None, aliases=None)¶ Provides a pavilion command via a plugin.
-
_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.
-
deactivate
()¶ You can’t deactivate 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).
-
-
exception
pavilion.commands.
CommandError
¶ Bases:
RuntimeError
The error type commands should raise for semi-expected errors.
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¶
-
class
pavilion.plugins.commands.clean.
CleanCommand
¶ Bases:
pavilion.commands.Command
Cleans outdated test and series run directories.
-
run
(pav_cfg, args)¶ Run this command.
-
-
pavilion.plugins.commands.clean.
get_month_delta
(months)¶ Turn a number of months in the future into a concrete date.
log command¶
-
class
pavilion.plugins.commands.log.
LogCommand
¶ Bases:
pavilion.commands.Command
-
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).
-
result command¶
-
class
pavilion.plugins.commands.result.
ResultsCommand
¶ Bases:
pavilion.commands.Command
-
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).
-
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 ([TestRun]) – A list of the last test runs that this command started (also for unit testing).
-
BUILD_ONLY
= False¶
-
BUILD_SLEEP_TIME
= 0.1¶
-
BUILD_STATUS_PREAMBLE
= '{when:20s} {test_id:6} {state:{state_len}s}'¶
-
SLEEP_INTERVAL
= 1¶
-
build_local
(tests, max_threads, mb_tracker, build_verbosity)¶ Build all tests that request for their build to occur on the kickoff host.
Parameters: - tests (list[TestRun]) – The list of tests to potentially build.
- max_threads (int) – Maximum number of build threads to start.
- build_verbosity (int) – How much info to print during building. See the -b/–build-verbose argument for more info.
- mb_tracker (MultiBuildTracker) – The tracker for all builds.
-
check_result_parsers
(tests)¶ Make sure the result parsers for each test are ok.
-
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.
-
run_tests
(pav_cfg, tests_by_sched, series, wait, report_status)¶ Parameters: - pav_cfg –
- tests_by_sched (dict[str,[TestRun]]) – A dict by scheduler name of the tests (in a list).
- series – The test series.
- wait (int) – Wait this long for a test to start before exiting.
- report_status (bool) – Do a ‘pav status’ after tests have started. on nodes, and kick them off in build only mode.
Returns:
set_status command¶
-
class
pavilion.plugins.commands.set_status.
SetStatusCommand
¶ Bases:
pavilion.commands.Command
-
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).
-
show command¶
-
class
pavilion.plugins.commands.show.
ShowCommand
¶ Bases:
pavilion.commands.Command
-
SUMMARY_SIZE_LIMIT
= 100¶
-
run
(pav_cfg, args)¶ Run the show command’s chosen sub-command.
-
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.
-
run
(pav_cfg, args)¶ Gathers and prints the statuses from the specified test runs and/or series.
-
-
pavilion.plugins.commands.status.
get_all_tests
(pav_cfg, args)¶ Return the statuses for all tests, up to the limit in args.limit.
-
pavilion.plugins.commands.status.
get_statuses
(pav_cfg, args, errfile)¶ Get the statuses of the listed tests or series.
Parameters: - pav_cfg – The pavilion config.
- namespace args (argparse) – The tests via the command line args.
- errfile – stream to output errors as needed.
Returns: List of dictionary objects with the test id, name, state, time that the most recent status was set, and the associated note.
-
pavilion.plugins.commands.status.
get_tests
(pav_cfg, args, errfile)¶ - Gets the tests depending on arguments.
Parameters: - pav_cfg – The pavilion config
- namespace args (argparse) – The tests via command line args.
- errfile – stream to output errors as needed
Returns: List of test objects
-
pavilion.plugins.commands.status.
print_from_test_obj
(pav_cfg, test_obj, outfile, json=False)¶ Print the statuses given a list of test objects or a single test object.
Parameters: - pav_cfg (dict) – Base pavilion configuration.
- test_obj (Union(test_run.TestRun,list(test_run.TestRun)) – Single or list of test objects.
- json (bool) – Whether the output should be a JSON object or not.
- outfile (stream) – Stream to which the statuses should be printed.
Returns: 0 for success.
Return type: int
-
pavilion.plugins.commands.status.
print_status
(statuses, outfile, json=False)¶ Prints the statuses provided in the statuses parameter.
Parameters: - statuses (list) – list of dictionary objects containing the test ID, name, state, time of state update, and note associated with that state.
- json (bool) – Whether state should be printed as a JSON object or not.
- outfile (stream) – Stream to which the statuses should be printed.
Returns: success or failure.
Return type: int
-
pavilion.plugins.commands.status.
status_from_test_obj
(pav_cfg, test_obj)¶ - Takes a test object or list of test objects and creates the dictionary
- expected by the print_status function.
Parameters: Returns: List of dictionary objects containing the test ID, name, statt time of state update, and note associated with that state.
Return type: list(dict)
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¶
-
class
pavilion.plugins.commands.wait.
WaitCommand
¶ Bases:
pavilion.commands.Command
-
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).
-