Builder Process¶
buildtest will process all buildspecs that are discovered see diagram Discover Buildspecs.
The BuildspecParser class is responsible for validating the buildspec. The
validation is performed using jsonschema.validate.
The parser will validate every buildspec using the global.schema.json
which validates the top-level structure. This is performed using BuildspecParser._validate_global
method.
The build pipeline is comprised of 5 stages shown below. Every buildspec goes
through this pipeline, if one stage fails, buildtest will skip the test. For instance,
a buildspec that fails Parse
stage will not be built. It is possible a
buildspec passes Parse
stage but fails to build because we have an Invalid Buildspecs
for example an invalid executor name.
Parse Stage¶
A buildspec file may contain one or more test sections specified via buildspec
field. Each test is validated by a sub-schema specified by type
field.
The BuildspecParser._validate
method will validate buildspec test section with
the sub-schema.
In this diagram, a buildspec file is passed to the Parser and validated with global schema and a sub-schema.
buildtest will invoke BuildspecParser against all discovered buildspecs and catch
exceptions ValidationError and SystemExit and ignore those buildspecs. Next
buildtest will build each test, this is implemented using base class BuilderBase.
The subclass for BuilderBase such as ScriptBuilder and CompilerBuilder
are responsible for generating the test script based on the type
field.
type: script
will invoke ScriptBuilder class
type: compiler
will invoke CompilerBuilder class
This allows buildtest to extend BuilderBase class and each subclass is responsible for one schema type.
The BuildExecutor class is responsible for initializing the executors defined in your Configuring buildtest. The BuildExecutor class is invoked once and buildtest configuration is passed to this class. buildtest will process all executors defined in executors field by invoking the appropriate sub-class. The local, slurm, lsf executors are implemented in class LocalExecutor, SlurmExecutor, LSFExecutor that are sub-class of of BaseExecutor. The BaseExecutor class is responsible for implementing common methods for all executors. Each executor class is responsible for running test that is performed in the Run stage of the general pipeline.