buildtest.buildsystem.builders

This module implements the Builder class that is responsible for getting builders from a buildspec file. The Builder class is invoked once buildspec file has parsed validation via buildtest.buildsystem.parser.BuildspecParser.

Module Contents

Classes

Builder

The Builder class creates builder objects based on parsed buildspecs.

class buildtest.buildsystem.builders.Builder(bp, buildtest_compilers, buildexecutor, filters, testdir, configuration, buildtest_system, rebuild=1, numprocs=None, numnodes=None)[source]

The Builder class creates builder objects based on parsed buildspecs.

The builder class is created based on the ‘type’ field in the test. If test contains type: script we will create builder by calling buildtest.buildsystem.scriptbuilder.ScriptBuilder. Likewise for type: compiler and type: spack we will call buildtest.buildsystem.compilerbuilder.CompilerBuilder and buildtest.buildsystem.spack.SpackBuilder.

Based on a loaded Buildspec file, return the correct builder for each based on the type. Each type is associated with a known Builder class.

Parameters
  • bp (buildtest.buildsystem.parser.BuildspecParser) – Instance of BuildspecParser class

  • buildexecutor (buildtest.executors.setup.BuildExecutor) – Instance of BuildExecutor class

  • filters (dict) – List of filter fields specified via buildtest build --filter for filtering tests

  • testdir (str) – Test directory where tests will be written which could be specified via buildtest build --testdir or configuration file

  • configuration (buildtest.config.SiteConfiguration) – Instance of SiteConfiguration class

  • buildtest_system (buildtest.system.BuildTestSystem) – Instance of BuildTestSystem class

  • rebuild (int, option) – Number of rebuild for test. This is specified via buildtest build --rebuild. Defaults to 1

  • numprocs (list, optional) – List of processor values to create builder objects specified via buildtest build --procs

  • numnodes (list, optional) – List of processor values to create builder objects specified via buildtest build --numnodes

_create_builders_procs(self, name, executor, recipe, compiler_name=None)[source]

This method will create builders for range of process configuration specified via buildtest build --procs. The return will be a list of builder object of type buildtest.buildsystem.base.BuilderBase. If builder is using a Local Executor we will return a the builder as is without iterating over the loop over all proc values. The –procs work with builders that leverage a Batch Executor such as Slurm, LSF, PBS, etc…

Parameters
  • name (str) – Name of test in buildspec file

  • recipe (dict) – Loaded test recipe from buildspec file

  • executor (str) – Name of executor for a given test

  • compiler_name (str, optional) – Name of compiler

_generate_builders(self, recipe, name, compiler_name=None)[source]

This method is responsible for generating builders by applying regular expression specified by executor field in buildspec with list of executors. If their is a match we generate a builder.

Parameters
  • name (str) – Name of test in buildspec file

  • recipe (dict) – Loaded test recipe from buildspec file

  • compiler_name (str, optional) – Name of compiler

Returns

List of builder objects

_build_compilers(self, name, recipe)[source]

This method will perform regular expression with ‘name’ field in compilers section and retrieve one or more compiler that were defined in buildtest configuration. If any compilers were retrieved we return one or more builder objects that call buildtest.buildsystem.builders.compiler.CompilerBuilder

Parameters
  • name (str) – name of test

  • recipe (dict) – Loaded test recipe from buildspec

_skip_tests_by_tags(self, recipe, name)[source]

This method determines if test should be skipped based on tag names specified in filter field that is specified on command line via buildtest build --filter tags=<TAGNAME>

Parameters
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns

False if buildtest build --filter tags is not specified. If specified we return True if tags field is not in test recipe or there is a matching tag.

Return type

bool

_skip_tests_by_type(self, recipe, name)[source]

This method determines if test should be skipped based on type field specified in filter field that is specified on command line via buildtest build --filter type=<SCHEMATYPE>

Parameters
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns

False if buildtest build --filter type is not specified. If there is a match with input filter and type field in test we return True

Return type

bool

_skip_tests_run_only(self, recipe, name)[source]

This method will skip tests based on run_only field from buildspec. Checks are performed based on conditionals and if any conditional is not met we skip test.

Parameters
  • recipe (dict) – Loaded test recipe from buildspec

  • name (str) – Name of test

Returns

False if run_only property not specified in buildspec otherwise returns True based on following condition
  • True if there is no match with system ‘scheduler’ and one specified in buildspec

  • True if there is no match with user specifed by ‘user’ property and one detected by system using os.getenv("USER")

  • True if there is no match with specified ‘platform’ property and one detected by system platform

  • True if there is no match with specified ‘linux_distro’ property and one detected by system

Return type

bool

get_builders(self)[source]

Return a list of builder objects

get_filtered_buildspec(self)[source]

Return a list of buildspec that were filtered out