### Run Pavilion help command Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Displays Pavilion's help information. Use to verify installation and see available commands. ```bash pav --help ``` -------------------------------- ### Setup Commands for Tutorial Environment Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/extracting_results.rst Commands to set up the tutorial environment, verify the example test, run it, and view results. Requires the Pavilion environment and the tutorial examples directory. The `pav show tests` command lists available tests, `pav run extract_tut` runs the example test, and `pav results -f last` displays the latest results. ```bash # Set up the tutorial environment # (sets PAV_CONFIG_DIR to examples/tutorials and adds Pavilion to PATH) $ source examples/tutorials/activate.sh # You should be able to see our example test. $ pav show tests # You should be able to run it, and look at the results. $ pav run extract_tut $ pav results -f last ``` -------------------------------- ### Create and configure a Pavilion config directory Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/basics.md Creates a new Pavilion config directory and working directory, then points Pavilion to the config directory and adds the Pavilion source bin to PATH. Replace , , and with actual paths. This setup creates the config directory, a pavilion.yaml, and a working directory for storing run tests and builds. ```default # Create a new config directory pav config setup # Point Pavilion to this configuration directory. export PAV_CONFIG_DIR= export PATH=$PATH:/bin ``` -------------------------------- ### Install idna using setup script Source: https://github.com/hpc/pavilion2/blob/develop/lib/sub_repos/idna/README.rst Install the idna library using the bundled setup script. ```bash $ python setup.py install ``` -------------------------------- ### Example per-node output file (node_name.out) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/extracting_results.rst Sample content of a per-node output file named .out (e.g., node0045.out). View with 'pav cat build/node5.out'. ```default Node 5 reporting sir! Parameters are optimal! Firing on all cylinders! 0-60 in 42.3s Single node flops are 32.5123 bunnies. Confusion is setting in. Good night! ``` -------------------------------- ### Generated example configuration with comments Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/intro.rst The example configuration file produced by Yaml Config from the specification. It includes comments showing each element's type, required status, and choices. ```yaml # BALLOONS(int): Number of balloons needed balloons: # PARTY_NAME(required str): What to call this party. party_name: # CAKE(str) # Choices: chocolate, vanilla cake: ``` -------------------------------- ### Host configuration file example Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Shows a host config file that sets the default scheduler to slurm and adds a 'foo' variable. The file is located at hosts/my_host.yaml and applies to tests run on that host. ```bash $ cat hosts/my_host.yaml scheduler: slurm variables: foo: "bar" ``` -------------------------------- ### Example run.sh output from Pavilion test Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/extracting_results.rst Sample output produced by the run.sh script created from the run section. Use 'pav status' to find the test id and 'pav log run ' to view this output. ```text Welcome to our contrived example! Ran for: 36.52s GFlops: 9003 Settings (weebles, wobbles, marks, conflagurated?) - - - - - - - - - - - - - - - - - - - - - 32, 98.5, 18.5, True N-dim | Elasticity | Cubism ----------------------------------------- 1 | 45.2 | 16 2 | 25.9 | 121 4 | 35.1 | 144 That went terribly. ``` -------------------------------- ### Run all tests in a suite with pav run Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/basics.md Runs every test in a suite by providing only the suite name. The output shows the number of tests started and the test series ID. ```bash $ pav run hello_mpi 2 tests started as test series s34. ``` -------------------------------- ### Show available tests with pav show tests Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Lists all available test suites and tests. The output shows the test names and summaries. ```bash $ pav show tests -----------------------+---------------------------------------------------- Name | Summary -----------------------+---------------------------------------------------- hello_mpi.hello_mpi | Builds and runs an MPI-based Hello, World program. hello_mpi.hello_worse | Builds and runs MPI-based Hello, World, but badly. supermagic.supermagic | Run all supermagic tests. $ pav run supermagic.supermagic 1 tests started as test series s33. ``` -------------------------------- ### first - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: first with the example test config. Only the first matching file's value is kept. ```json { "huge_size": "2M" } ``` -------------------------------- ### any - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: any with the example test config. Since at least one file matched, the key is set to true. ```json { "huge_size": true, } ``` -------------------------------- ### Create a Pavilion config directory Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Creates a new config directory and working directory. The first command sets up the config directory, the second points Pavilion to it, and the third adds the Pavilion bin to PATH. ```bash # Create a new config directory pav config setup ``` ```bash # Point Pavilion to this configuration directory. export PAV_CONFIG_DIR= ``` ```bash export PATH=$PATH:/bin ``` -------------------------------- ### list - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: list with the example test config. The matching values are combined into a single list. ```json { "huge_size": ["2M", "4K"], } ``` -------------------------------- ### all - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: all with the example test config. Since some files had no matches, the result is false. ```json { "huge_size": false, } ``` -------------------------------- ### proxies configuration example Source: https://github.com/hpc/pavilion2/blob/develop/docs/config.rst Example pavilion.yaml configuration for setting HTTP/HTTPS proxies and no_proxy entries. ```yaml proxies: http: myproxy.example.com:8080 https: myproxy.example.com: 8080 no_proxy: - example.com - alsolocal.com ``` -------------------------------- ### Run tests from a file with pav run -f Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/basics.md Runs tests listed in a file using the -f flag. The output shows the number of tests started and the test series ID. ```bash $ pav run -f mytests 347 tests started as test series s36. ``` -------------------------------- ### Set up a virtual environment and build docs Source: https://github.com/hpc/pavilion2/blob/develop/docs/README.md Creates a virtual environment, installs Sphinx, and builds the documentation. Use this to avoid local build errors. ```bash virtualenv -p $(which python3) /doc_build source /doc_build/bin/activate pip install sphinx cd /docs make clean make html ``` -------------------------------- ### Run a single test with pav run Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/basics.md Runs a specific test by its suite and test name. The output shows the number of tests started and the test series ID. ```bash $ pav run supermagic.supermagic 1 tests started as test series s33. ``` -------------------------------- ### Example YAML document accepted by the config Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/intro.rst A sample YAML document that conforms to the BirthdayPartyConfig specification. It provides values for the required party_name and optional balloons and cake keys. ```yaml party_name: Armond White's Movie Party balloons: 5 cake: chocolate ``` -------------------------------- ### pavilion.yaml config_dirs example Source: https://github.com/hpc/pavilion2/blob/develop/examples/demo/README.md Shows how to list extra config directories in the main pavilion.yaml. These config repos do not have their own pavilion.yaml and can have separate working directories. ```yaml working_dir: ../working_dir config_dirs: - /path/to/some/extra/config_dir ``` -------------------------------- ### name_list - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: name_list with the example test config. Only the names of files with matches are listed. ```json { "huge_size": ["node2", "node3"], } ``` -------------------------------- ### Run multiple tests with pav run Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/basics.md Runs a combination of tests by specifying multiple test names. The output shows the number of tests started and the test series ID. ```bash $ pav run hello_mpi.hello_mpi supermagic 2 tests started as test series s35. ``` -------------------------------- ### name - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: name with the example test config. Results are stored per file, with null for files without matches. ```json { "fn": { "node1": {"huge_size": null}, "node2": {"huge_size": "2M"}, "node3": {"huge_size": "4K"}, "node4": {"huge_size": null} } } ``` -------------------------------- ### Clone and install urllib3 from source Source: https://github.com/hpc/pavilion2/blob/develop/lib/sub_repos/urllib3/README.rst Clone the urllib3 repository from GitHub and install it using setup.py. ```bash $ git clone git://github.com/urllib3/urllib3.git $ python setup.py install ``` -------------------------------- ### Host config example Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/format.rst Example host config file that sets the scheduler to slurm and specifies partition and qos settings. ```yaml scheduler: slurm slurm: partition: user qos: user ``` -------------------------------- ### Example results JSON with run_time Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/extracting_results.rst Example output showing the parsed result. The run_time value is automatically converted to a floating point number because it looks like one. ```json { "name": "results_tut.example", "id": 32, "run_time": 32.5, } ``` -------------------------------- ### Spack Setup for Tests Source: https://github.com/hpc/pavilion2/blob/develop/AGENTS.md Clones spack v1.0.2 and installs patchelf for test environment setup. ```bash ./test/utils/spack_setup test # Clones spack v1.0.2, installs patchelf ``` -------------------------------- ### last - Example output JSON Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Shows the result when using per_file: last with the example test config. The last matching file's value is kept. ```json { "huge_size": "4K", } ``` -------------------------------- ### YAML Primer Example for Pavilion Configurations Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/basic_pavilion.rst A comprehensive YAML example covering comments, golden rules, string types, mappings, and lists. It highlights Pavilion-specific constraints: no tabs, indentation significance, all leaf values converted to strings, strict configuration format, and automatic conversion of single items to lists. ```yaml # Yaml uses pound signs for comments # Golden Rules # 1. No Tabs! Tab characters are not allowed. # 2. Indentation is important for lists and mappings. # 3. Strings only! In Pavilion, all 'leaf' values are converted to strings, # regardless of how Yaml handles them. # 4. Pavilion has a strict format for all its configuration files, especially about # what mapping keys are allowed and where. # 5. Anything that can take a list of things, can just take one thing. It will be # turned into a single item list automatically. # Yaml files generally start with top level key->value mapping. # When that is the case, the whole file is basically a mapping (at the top level) key1: "foo" # Yaml Supports a variety of ways to express string values. a_string1: "This is a string!" # Single quoted strings are literal, and generally preferred when writing Pavilion tests. a_string2: 'I am a literal!' # Types are inferred by the first few characters. This looks like it should be # a string, so it is. a_string3: This too is a string. # Strings can wrap and all whitespace is collapsed to single spaces. a_string4: 'I am going to go all the way around!' # There is more than this - You can do block quotes and other stuff too. # YAML supports other types too, but Pavilion (test) config values are always converted # into strings anyway. # Mappings can contain other mappings. The tabbing levels must be consistent. sub_map: subkey1: "Heya" subkey2: {another_key: "This is a mapping too, in 'inline' style"} # You can also have lists some_lists: list1: - Thing 1 - Thing 2 list2: [item1, item2, item3] # And that's really all you need to know to use Pavilion. ``` -------------------------------- ### flatten_results example input Source: https://github.com/hpc/pavilion2/blob/develop/docs/config.rst Example of a result object with a per_file key, used to illustrate how flatten_results expands entries. ```text {"name": "test1", "avg_speed": 32.5, per_file: {"node1": {"speed": 32}, "node2": {"speed": 33}}} ``` -------------------------------- ### Multiple Files Build Example (tar -tf and ls) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/build.rst Shows how a tar archive with multiple top-level files results in the build directory containing those files directly. ```bash # This tar file has multiple files at the top level. # The build directory will contain these files. tar -tf src2.tar.gz README.txt src/mytest.c ls build_dir README.txt src/mytest.c ``` -------------------------------- ### Build documentation with make clean and make html Source: https://github.com/hpc/pavilion2/blob/develop/docs/README.md Run these commands to build the HTML documentation. Requires Sphinx to be installed. ```bash make clean make html ``` -------------------------------- ### Split parser with multiple keys and underscore Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/tutorials/extracting_results.md Stores split values under multiple keys, using '_' to discard unwanted items. Unmatched list items are ignored. This example extracts 'weebles' and 'marks' while skipping 'wobbles'. ```yaml example: ... result_parse: ... split: # We can list multiple values as the 'key'. "weebles, _, marks": preceded_by: - '^Settings' # Match the 'Settings (weebles,' line - '^- - - ' # Then those weird dashes. # These are comma separated. sep: ',' ``` -------------------------------- ### Install idna using pip Source: https://github.com/hpc/pavilion2/blob/develop/lib/sub_repos/idna/README.rst Install the idna library using pip. ```bash $ pip install idna ``` -------------------------------- ### Example result output for per_file parsing Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/extracting_results.rst Shows the JSON result structure produced when using 'per_file: name' with multiple files. The 'per_file' key contains a mapping of filename to parsed results, alongside the overall result and return_value. ```json { "per_file": {"node1": {"flops": 34.89}, "node2": {"flops": 37.2}, "node3": {"flops": 39.49}, "node4": {"flops": 139.72}, "node5": {"flops": 31.67}}, "result": "PASS", "return_value": 0, } ``` -------------------------------- ### Single Directory Build Example (tar -tf and ls) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/build.rst Shows how a tar archive with a single top-level directory becomes the build directory. The 'src' directory is used as the build directory. ```bash # This tar file has a single top-level directory. # The 'src' directory will be the build directory. tar -tf src.tar.gz src/README.txt src/mytest.c ls build_dir README mytest.c ``` -------------------------------- ### Full Module Wrapper Example for GCC Source: https://github.com/hpc/pavilion2/blob/develop/docs/plugins/module_wrappers.rst Complete example of a ModuleWrapper subclass for GCC. It demonstrates conditional module actions based on the system OS and architecture, swapping programming environments on CLE systems, and setting compiler environment variables. The _load method returns a list of actions and an environment dictionary. ```python import pavilion.module_wrapper as module_wrapper from pavilion.module_actions import ModuleLoad, ModuleSwap, ModuleUnload class GccWrapper(module_wrapper.ModuleWrapper): def __init__(self): # This is a wrapper for gcc, for any version. super().__init__('gcc', "Wrapper for the GCC module", None, self.PRIO_COMMON) def _load(self, var_man, version): actions = list() env = {} if var_man['sys_os.name'] == 'cle': if var_man['sys_arch'] == 'aarch64' # These systems have the cray programming environment loaded # by default. Swap it out for gnu. actions.append(ModuleSwap('PrgEnv-gnu', None, 'PrgEnv-Cray', None)) else: # These systems have the intel programming environment # loaded by default. Swap it out for gnu. actions.append(ModuleSwap('PrgEnv-gnu', None, 'PrgEnv-intel', None)) # Swap out default gcc for the one specified. actions.append(ModuleSwap(self.name, version, self.name, None)) # Use the cray compiler wrappers env['PAV_CC'] = '$(which cc)' env['PAV_CXX'] = '$(which CC)' env['PAV_FC'] = '$(which ftn)' else: # Other system start with an empty module environment, so # just load the given module. actions.append(ModuleLoad(self.name, version)) env['PAV_CC'] = '$(which gcc)' env['PAV_CXX'] = '$(which g++)' env['PAV_FC'] = '$(which gfortran)' return actions, env ``` -------------------------------- ### Variable formats and usage example Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/tutorials/advanced_pavilion.md Example showing all valid variable formats (single value, list, dictionary, list of mappings) and how to access them in run commands. Includes indexing list items and accessing structured value sub-keys. Note that indexing list items is generally unsafe. ```yaml variable-formats: variables: single_value: "hello" # A variable can be a list of values. multi_value: - "thing1" - "thing2" # A variable can be a single dictionary/mapping. structured_value: name: "Bob" moniker: "bobzilla" uid: "2341" # Or a list of mappings, as long as they have the same keys. more_structured_values: - name: Paul moniker: "paulblematic" - name: Nick moniker: "nickelback" - name: Francine moniker: "frantastic" run: cmds: # You can use most variables just about anywhere in the test config, # not just here. # As seen in the prior example. - 'echo {{single_value}}' # You can access individual list items like this, counting from 0. - 'echo "{{multi_value.0}} {{multi_value.1}}"' # If you want the first item, the index is optional. - 'echo "{{multi_value}}"' # For structured values, you have to specify a sub-key - 'echo "My name is {{structured_value.name}}"' - 'echo "Your name is {{more_structured_values.1.name}}"' # If you leave out the index, you still get the first item: - 'echo "Your other name is {{more_structured_values.name}}"' ``` -------------------------------- ### Example test config using test_cmd variable Source: https://github.com/hpc/pavilion2/blob/develop/docs/plugins/schedulers.rst Shows how Pavilion tests use the `test_cmd` variable to prefix MPI run commands. The example requests 32 nodes on the slurm scheduler and runs `./my_mpi_cmd` with the command. ```yaml test_cmd_example: scheduler: slurm schedule: nodes: 32 run: cmds: - '{{test_cmd}} ./my_mpi_cmd' ``` -------------------------------- ### Initialize and reset plugins in tests Source: https://github.com/hpc/pavilion2/blob/develop/test/README.md Shows how to set up and tear down the plugin system using setUp and tearDown methods. ```python from pavilion import unittest from pavilion import plugins class PluginTests(unittest.PavTestCase): def setUp(self): plugins.initialize_plugins(self.pav_cfg) def tearDown(self): plugins._reset_plugins() ``` -------------------------------- ### Example mode config file (dev.yaml) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/format.rst A mode config YAML file placed in /modes/ that applies extra defaults to tests. This example sets the Slurm partition and account for a 'dev' environment. ```yaml slurm: partition: dev account: dev_user ``` -------------------------------- ### YAML example showing environment variable manipulation in test config Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/dev_tutorials/writing_docs.md A demonstrative YAML example that shows how to set, modify, and unset environment variables in the 'run' section of a test configuration. It includes comments explaining each action and notes that setting to YAML null unsets the variable. The example is intended to be comprehensive and self-documenting. ```yaml my_test_cfg: run: # We can set, modify, and unset environment variables. # All environment variables set will be "exported". # This may also be done in the "build" section. env: # Set http_proxy http_proxy: "http://example.com:8080" # Unset https_proxy. # Setting to YAML "null" (not the string "null") is equivalent. https_proxy: # The rest of the test would follow. ``` -------------------------------- ### Spack install and load in build and run sections Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/env.rst Configure Spack packages to be installed and loaded in Pavilion test scripts. The `spack` section can be used in both `build` and `run` sections, with `install` and `load` keys taking lists of package names with optional specs and dependency options. ```yaml build: spack: install: - ember - mpich@3.0.4 - mpileaks @1.2:1.4 %gcc@4.7.5 +debug load: - gcc run: spack: load: - ember - mpich - mpileaks ``` -------------------------------- ### Example raw test config JSON after stacking configs Source: https://github.com/hpc/pavilion2/blob/develop/docs/test_run_lifecycle.rst Shows a pruned example of a raw test config after Pavilion loads and stacks the suite, host, and mode configs. Includes hidden keys like suite_path and default values. ```json {"name": "user_check", "build": {"cmds": ["${CC} -o last_login last_login.c"], "env": {"CC": "gcc"}, "modules": ["gcc"], "source_location": "last_login.zip"}, "permute_on": ["user"], "scheduler": "slurm", "modes": [], "subtitle": null, "suite": "bad_eval", "suite_path": "/usr/local/pav_configs/tests/mytests.yaml", "not_if": {"{{user}}": ["jerry"]}, "only_if": {}, "slurm": { "account": null, "avail_states": ["IDLE", "MAINT"], "num_nodes": "4", "partition": "standard", "tasks_per_node": "1", "time_limit": null, "up_states": ["ALLOCATED", "COMPLETING", "IDLE", "MAINT"]}, "results": {"evaluate": { "result": "last_login > {{pav.timestamp - time_limit}}"}, "regex": [{"key": "last_login", "regex": "Last Login: (\\d+)"}]}, "run": {"cmds": ["{{sched.test_cmd}} ./test1 $ARGS"], "env": {"ARGS": "-u {{user}}"}, "modules": ["gcc"]}, "variables": {"hours": 5, "time_limit": "{{ 60^2 * hours }}", "user": ["bob", "dave"]}} ``` -------------------------------- ### Run tests with pav run Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Runs tests by suite name, test name, or from a file. The output shows the number of tests started and the test series ID. ```bash $ pav run hello_mpi 2 tests started as test series s34. $ pav run hello_mpi.hello_mpi supermagic 2 tests started as test series s35. $ pav run -f mytests 347 tests started as test series s36. ``` -------------------------------- ### Show available result parsers Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Lists all result parsers available in Pavilion. Run this command to see what parsers are installed. ```bash $ pav show result_parsers ``` -------------------------------- ### Scheduler plugin initialization (Slurm example) Source: https://github.com/hpc/pavilion2/blob/develop/docs/plugins/schedulers.rst Initialize a scheduler plugin by subclassing SchedulerPluginAdvanced and calling super().__init__ with a name and description. Most customization is done through method overrides and class variables. ```python from pavilion import schedulers class Slurm(schedulers.SchedulerPluginAdvanced): def __init__(self): super().__init__( name='slurm', description='Schedules tests via the Slurm scheduler.' ) ``` -------------------------------- ### Command Invocation with Aliases Source: https://github.com/hpc/pavilion2/blob/develop/docs/plugins/commands.rst Shows the valid ways to call the example command using its name and aliases defined in the plugin. ```bash $ pav cancel $ pav kill $ pav stop ``` -------------------------------- ### Starting test configuration in tutorial.yaml Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/advanced_pavilion.rst Initial test configuration from the previous tutorial. Defines a basic test that compiles hello_world.c with gcc, runs it with an argument, parses the result using a regex, and evaluates a normalized luck value. ```yaml basic: build: source_path: hello_world.c # We're about to use gcc to compile the test. If you need to # load a module to get gcc, add that module to this list. modules: [] cmds: - gcc -o hello hello_world.c run: cmds: - './hello Paul' result_parse: regex: result: regex: '^Hello .*!$' action: store_true split: "_, lucky": sep: ':' for_lines_matching: '^Today' match_select: first result_evaluate: normalized_luck: 'round(lucky * 1000)' ``` ```yaml basic: # ... variables: other_user: bob run: cmds: # The text can take multiple people as input. # {{user}} is your current username, provided as a built-in variable by Pavilion. - './hello {{other_user}} {{user}}' # ... ``` ```yaml variable-formats: variables: single_value: "hello" # A variable can be a list of values. multi_value: - "thing1" - "thing2" # A variable can be a single dictionary/mapping. structured_value: name: "Bob" moniker: "bobzilla" uid: "2341" # Or a list of mappings, as long as they have the same keys. more_structured_values: - name: Paul moniker: "paulblematic" - name: Nick moniker: "nickelback" - name: Francine moniker: "frantastic" run: cmds: # You can use most variables just about anywhere in the test config, # not just here. # As seen in the prior example. - 'echo {{single_value}}' # You can access individual list items like this, counting from 0. - 'echo "{{multi_value.0}} {{multi_value.1}}"' # If you want the first item, the index is optional. - 'echo "{{multi_value}}"' # For structured values, you have to specify a sub-key - 'echo "My name is {{structured_value.name}}"' - 'echo "Your name is {{more_structured_values.1.name}}"' # If you leave out the index, you still get the first item: - 'echo "Your other name is {{more_structured_values.name}}"' ``` -------------------------------- ### Run the flux-example test Source: https://github.com/hpc/pavilion2/blob/develop/examples/flux/README.md Runs the test with the Flux scheduler and shows build reused and kickoff output. ```bash # pav run flux-example ``` ```console Creating Test Runs: 100% Building 1 tests for test set cmd_line. BUILD_REUSED: 1 Kicked off test 10 for test set 'cmd_line' in series s10. ``` -------------------------------- ### Resulting config.txt content Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/build.rst Shows the expected content of the config.txt file created by the create_files example. The values are rendered from the test variables. ```yaml user: bob scale: 33 ``` -------------------------------- ### Example file content for line selection Source: https://github.com/hpc/pavilion2/blob/develop/docs/results/parse.rst Sample file content used to illustrate how 'preceded_by' and 'for_lines_matching' select lines. The parser is called twice on the lines matching '^flm'. ```text c a a b flm a b flm ``` -------------------------------- ### PBS Scheduler Test Configuration Example Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/scheduling.rst Example test configuration using the PBS scheduler. The schedule section specifies nodes, queue, walltime, and tasks. The pbs section holds scheduler-specific options like queue and walltime. ```yaml pbs_test: scheduler: pbs schedule: nodes: 2 pbs: queue: workq walltime: '00:10:00' tasks: 4 ``` -------------------------------- ### Variable Long Form Example (var-example2) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/advanced_pavilion.rst Shows how to access variables with optional source prefixes (sched, pav, sys, var). Without a prefix, later sources override earlier ones; with a prefix, the specified source is used. The example demonstrates that {{user}} and {{var.user}} always print 'bob', while {{pav.user}} prints the current user. ```yaml var-example2: variables: cookies: "oatmeal" user: 'bob' run: # These two are equivalent (kind-of) - echo "I am running on cluster {{sys_name}}" - echo "I am running on cluster {{sys.sys_name}}" # But these two aren't! - echo "{{user}}" # Will always print 'bob' - echo "{{pav.user}}" # Will print the current user. - echo "{{var.user}}" # Will also always print 'bob' ``` -------------------------------- ### Set PATH to Pavilion bin directory Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Adds the Pavilion bin directory to the PATH environment variable. Required before running Pavilion commands. ```bash PATH=/bin:${PATH} ``` -------------------------------- ### Run the activate script Source: https://github.com/hpc/pavilion2/blob/develop/examples/flux/README.md Activates the pavilion environment. ```bash ./activate.sh ``` -------------------------------- ### YAML: result_parse and result_evaluate configuration Source: https://github.com/hpc/pavilion2/blob/develop/CHANGELOG.md Example of result parsing and evaluation configuration in Pavilion 2.2. ```yaml mytest: variables: unit_base: 100 result_parse: regex: speed: regex: 'speed (\d+)' result_evaluate: speed_normalized: "speed / {{unit_base}}" another_thing: '"some don''t string"' ``` -------------------------------- ### Check test status with pav status Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Displays the status of all tests in the last test series. The output shows test ID, name, state, time, and notes. ```bash $ pav status ------+------------+----------+------------------+------------------------------ Test | Name | State | Time | Note ------+------------+----------+------------------+------------------------------ 41 | supermagic | COMPLETE | 16 May 2019 10:38| Test completed successfully. ``` -------------------------------- ### Create test run objects with _quick_test and _quick_test_cfg Source: https://github.com/hpc/pavilion2/blob/develop/docs/dev_tutorials/writing_a_unittest.rst Shows how to create test run objects using _quick_test and _quick_test_cfg. The default test is a 'hello world'. Modify the config before creating a test with custom options. ```python from pavilion.unittest import PavTestCase from pavilion import plugins import pavilion class MyTests(PavTestCase): def test_foo(self): # This will create a test run object, along with its run directory. # The default test is essentially a 'hello world'. test = self._quick_test() test.run() # If you need to modify the config, first get the default. test_cfg = self._quick_test_cfg() # Note that you're working with a raw config after it's been # loaded and all 'magic' applied. So things that end up as lists # should be given as lists, and you shouldn't use pavilion # variables. test_cfg['run']['cmds'] = ['sleep 5'] test2 = self._quick_test(cfg=test_cfg, build=False, finalize=False) ``` -------------------------------- ### Advanced Example Configuration (YAML) Source: https://github.com/hpc/pavilion2/blob/develop/docs/dev_tutorials/writing_docs.rst Defines environment variables directly written into a bash script. Errors will not result in a run script failure. Variables are executed in order and can reference each other. ```yaml ```yaml # These are directly written into a bash script, so any bash # code is fine (be carefully about escapes). # Note: Errors will not result in a run script failure. wget_exe: "$(which wget)" # These are executed in order, and can reference each other as well # as other environment variables. WGET_CMD: "${wget_exe} -f -q" ``` ``` -------------------------------- ### Example test config before scheduler changes Source: https://github.com/hpc/pavilion2/blob/develop/CHANGELOG.md Shows a test config with the old 'slurm' section and 'num_nodes' key before the 2.4 scheduler configuration changes. ```yaml mytest: run: cmds: "echo 'I am an example!'" slurm: num_nodes: 50 partition: foo up_states: ['IDLE', 'NOT_ON_FIRE'] ``` -------------------------------- ### Resulting config.txt content Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/tests/build.md Shows the expected content of the 'config.txt' file after Pavilion processes the create_files example, with the '{{pav.user}}' variable replaced by 'bob'. ```yaml user: bob scale: 33 ``` -------------------------------- ### Main Help Output Source: https://github.com/hpc/pavilion2/blob/develop/docs/plugins/commands.rst Output of `pav --help` showing the command list with short help for each command, including the example `cancel` command. ```default $ pav --help usage: pav.py [-h] [-v] {run,show,status,view,results,result,log,clean,_run,set_status,status_set,wait,cancel} ... Pavilion is a framework for running tests on supercomputers. positional arguments: {run,show,status,view,results,result,log,clean,_run,set_status,status_set,wait,cancel} run Setup and run a set of tests. show Show pavilion plugin/config info. status Get status of tests. view Show the resolved config for a test. results (result) Displays results from the given tests. log Displays log for the given test id. clean Clean up Pavilion working diretory. set_status (status_set) Set status of tests. wait Wait for statuses of tests. cancel Cancel a test, tests, or test series. optional arguments: -h, --help show this help message and exit -v, --verbose Log all levels of messages to stderr. ``` -------------------------------- ### View test results with pav results command Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Shows the `pav results` command output for a test, including a table and the full JSON output with the `--full` flag. The full output includes fields like name, id, result, duration, created, started, and finished. ```bash $ pav results Test Results ------------+----+-------- Name | Id | Result ------------+----+-------- supermagic | 41 | PASS # Use '--full' or '-f' to get the full result json with all fields. $ pav results --full Test Results { "name": "supermagic", "id": 41, "result": "PASS", "duration": 3.825, "created": 2019-05-15 10:38, "started": 2019-05-15 10:41, "finished": 2019-05-15 10:42, } ``` -------------------------------- ### Show available schedulers Source: https://github.com/hpc/pavilion2/blob/develop/examples/flux/README.md Lists scheduler plugins, including flux. ```bash n# pav show sched Available Scheduler Plugins -------+--------------------------------------------------- Name | Description -------+--------------------------------------------------- raw | Schedules tests as local processes. slurm | Schedules tests via the Slurm scheduler. flux | Schedules tests via the Flux Framework scheduler. ``` -------------------------------- ### Use Spack to build and load packages Source: https://github.com/hpc/pavilion2/blob/develop/docs/advanced.rst Configures Spack to install and load packages for build and run. Requires a working Spack instance configured globally for Pavilion. ```yaml build: spack: install: - ember load: - gcc run: spack: load: - ember ``` -------------------------------- ### prepend_cmds and append_cmds example Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/run.rst Shows how prepend_cmds and append_cmds add commands to inherited cmds at each inheritance level. The resulting command list for the 'next' test is shown in the following default block. ```yaml base: run: cmds: - a - b - c next: run: prepend_cmds: - 'prepend_a' - 'prepend_b' append_cmds: - 'append_a' - 'append_b' ``` ```default - 'prepend_a' - 'prepend_b' - a - b - c - 'append_a' - 'append_b' ``` -------------------------------- ### Basic test configuration in YAML Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst Defines a test named 'mytest' using the raw scheduler and a single command. The test passes if the command returns 0. It runs as a local process without special privileges. ```yaml # Tests are in a strictly defined YAML format. # This defines a test, and names it. mytest: # The scheduler to use to schedule the test on a cluster. # In this case, we'll use the raw (local system) scheduler scheduler: raw run: cmds: 'test -d /var/log/messages' ``` -------------------------------- ### Example build config (build-example) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/build.rst YAML configuration for a Pavilion test build. Defines source_location, modules to load, environment variables to set/unset, and build commands. Note that deferred variables cannot be used in the build config. ```yaml build-example: build: source_location: my_test.tar.gz modules: [gcc, openmpi] env: # Add to the path. PATH: "${PATH}:$(which gcc)" # unset the USER environment variable. USER: cmds: - ./configure - ./make ``` -------------------------------- ### Override test result with result_parse and result_evaluate Source: https://github.com/hpc/pavilion2/blob/develop/docs/basics.rst YAML configuration for a test that uses a regex result parser to extract a 'speed' key from the run script output, then evaluates a condition to set the overall result. The test passes only if the extracted speed is greater than 50. ```yaml mytest: run: cmds: # We'll use the result parsers below to parse values from # the output of the run script. - './test_script.sh' result_parse: regex: # Use the regex parser to extract a speed key and add it to # the results. speed: regex: '^speed (\d+)' result_evaluate: # The test will PASS if the speed (extracted above) is more than 50. result: 'speed > 50' ``` -------------------------------- ### Get plugins by name Source: https://github.com/hpc/pavilion2/blob/develop/docs/dev_tutorials/writing_a_unittest.rst Shows how to retrieve plugins of different types using their get_plugin functions. System variable plugins are accessed through the sys_vars dict. ```python from pavilion.unittest import PavTestCase from pavilion import plugins import pavilion class MyTests(PavTestCase): def test_plugins(self): run_cmd = pavilion.commands.get_plugin('run') slurm = pavilion.schedulers.get_plugin('slurm') regex_parser = pavilion.result_parsers.get_plugin('regex') # System Variable Plugins simply provide values through the # sys_vars dict. sys_vars = pavilion.system_variables.get_vars(defer=True) sys_vars['sys_name'] ``` -------------------------------- ### Pavilion Config with copy_files (YAML) Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/build.rst Example Pavilion test configuration using copy_files to copy specific files instead of symlinking them. Supports globbing and recursive matching with '**'. ```yaml mytest: build: source_location: mytest.zip cmds: 'make' copy_files: # The config.txt file will be an actual file, not a symlink. # The test run can alter it as needed. - config.txt # Filesystem globs are allowed, including "*", "?", and ranges. - data/*.dat - data/data_?.txt - data/data[0-9].json # To copy whole directories, use recursive matching "**". - libs/** ``` -------------------------------- ### Show available tests Source: https://github.com/hpc/pavilion2/blob/develop/examples/flux/README.md Lists available tests, including flux-example and vars-example. ```bash # pav show tests Available Tests -------------------------------+--------- Name | Summary -------------------------------+--------- flux-example.variable-formats | vars-example.variable-formats | ``` -------------------------------- ### Activate Pavilion tutorial environment Source: https://github.com/hpc/pavilion2/blob/develop/docs/tutorials/basic_pavilion.rst Sources the tutorial activation script from the Pavilion source root to set PAV_CONFIG_DIR and PATH for the tutorial configuration. ```bash # From the Pavilion source root source examples/tutorials/activate.sh ``` -------------------------------- ### Example test config after scheduler changes Source: https://github.com/hpc/pavilion2/blob/develop/CHANGELOG.md Shows the same test config updated to use the new 'schedule' section and 'nodes' key, with scheduler-specific options nested under 'slurm'. ```yaml mytest: run: cmds: "echo 'I am an example!'" schedule: nodes: 50 partition: foo slurm: up_states: ['IDLE', 'NOT_ON_FIRE'] ``` -------------------------------- ### Run the vars-example test Source: https://github.com/hpc/pavilion2/blob/develop/examples/flux/README.md Runs the non-flux scheduler test and shows build success and kickoff output. ```bash # pav run vars-example Creating Test Runs: 100% Building 1 tests for test set cmd_line. BUILD_SUCCESS: 1 Kicked off test 1 for test set 'cmd_line' in series s7. ``` -------------------------------- ### per_file: any - True if any file returned a True result Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/results/parse.md Sets the key to true if any file result evaluates to True. In the example, at least one file matched, so the key is set to true. ```yaml result_parse: regex: huge_size: regex: 'HUGETLB_DEFAULT_PAGE_SIZE=(.+)' files: '*.out' per_file: any ``` ```json { "huge_size": true, } ``` -------------------------------- ### Get CA bundle path with certifi.where() Source: https://github.com/hpc/pavilion2/blob/develop/lib/sub_repos/python-certifi/README.rst Use the built-in function to reference the installed certificate authority bundle. The output shows the path to the cacert.pem file. ```python >>> import certifi >>> certifi.where() '/usr/local/lib/python3.7/site-packages/certifi/cacert.pem' ``` -------------------------------- ### create_files example with variables and deferred variables Source: https://github.com/hpc/pavilion2/blob/develop/docs/tests/run.rst Defines files to be created at runtime in the build directory. Paths must stay within the build directory; otherwise an exception occurs at finalize. Variables and deferred variables are allowed. ```yaml run_example: build: variables: page: - {module: 'craype-hugepages2M', bytes: '2097152'} run: create_files: # Create file, "data.in", in the build directory at runtime. data.in: - 'line 1' - 'line 2' - 'line 3' # Create file, "data.in", inside subdirectory "subdir". Note if # the subdirectory(ies) do not exist they will be created. ./subdir/data.in: - 'line 1' - 'line 2' - 'line 3' # Create file, "var.in", with 'page' variable data inside nested # subdirectory "subdir/another_subdir". ./subdir/another_subdir/var.in: - 'module = {{page.module}}' - 'size = {{page.bytes}}' # Create file, "defer.in", with deferred variables. defer.in: - system_name = {{sys.name}} - system_os = {{sys.os}} ``` -------------------------------- ### per_file: last - Keep the last result Source: https://github.com/hpc/pavilion2/blob/develop/docs/yaml_config_docs/results/parse.md Works backwards through files to get the last match value. Ignores null results, so in the example node4's null is skipped and node3's '4K' is taken. ```yaml result_parse: regex: huge_size: regex: 'HUGETLB_DEFAULT_PAGE_SIZE=(.+)' files: '*.out' per_file: last ``` ```json { "huge_size": "4K", } ``` -------------------------------- ### Set up Python virtual environment for tests Source: https://github.com/hpc/pavilion2/blob/develop/test/README.md Creates and activates a virtual environment, then installs required packages for testing and documentation. Recommended to keep sphinx and pylint up-to-date. ```bash # You should create the virtual env outside of the pavilion source. python3 -m venv source /bin/activate pip install --upgrade pip pip install -r test/requirements.txt pip install -r docs/requirements.txt ``` -------------------------------- ### Install urllib3 with pip Source: https://github.com/hpc/pavilion2/blob/develop/lib/sub_repos/urllib3/README.rst Install urllib3 using pip. ```bash $ python -m pip install urllib3 ```