Pavilion Builder Objects

pavilion.pav_test module

Contains the object for tracking multi-threaded builds, along with the TestBuilder class itself.

class pavilion.builder.BuildTracker(builder, tracker)

Bases: object

Tracks the status updates for a single build.

error(note, state='BUILD_ERROR')

Add a note and error via the logger denote as a failure.

fail(note, state='BUILD_FAILED')

Denote that the test has failed.

notes()

Return the notes for this tracker.

update(note, state=None, log=None)

Update the tracker for this build with the given note.

warn(note, state=None)

Add a note and warn via the logger.

class pavilion.builder.MultiBuildTracker

Bases: object

Allows for the central organization of multiple build tracker objects.

Variables:status_files ({StatusFile}) – The dictionary of status files by build.
failures()

Returns a list of builders that have failed.

get_notes(builder)

Return all notes for the given builder. :param TestBuilder builder: The test builder object to get notes for. :rtype: [str]

register(builder, test_status_file)

Register a builder, and get your own build tracker.

Parameters:
Returns:

A build tracker instance that can be used by builds directly.

Return type:

BuildTracker

state_counts()

Return a dictionary of the states across all builds and the number of occurrences of each.

update(builder, note, state=None, log=None)

Add a message for the given builder without changes the status.

Parameters:
  • builder (TestBuilder) – The builder object to set the message.
  • note – The message to set.
  • state (str) – A status_file state to set on this builder’s status file.
  • log (int) – A log level for the python logger. If set, also log the message to the Pavilion log.
class pavilion.builder.TestBuilder(pav_cfg, test, mb_tracker, build_name=None)

Bases: object

Manages a test build and their organization.

Variables:
  • _BLOCK_SIZE (int) – Chunk size when reading and hashing files.
  • BUILD_HASH_BYTES (int) – Number of bytes in the build hash (1/2 the chars)
  • DEPRECATED (str) – The name of the build deprecation file.
  • path (Path) – The intended location of this build in the build directory.
  • fail_path (Path) – Where this build will be placed if it fails.
  • name (str) – The name of this build.
BUILD_HASH_BYTES = 8
DEPRECATED = '.pav_deprecated_build'
LOG_NAME = 'pav_build_log'
TAR_SUBTYPES = ('gzip', 'x-gzip', 'x-bzip2', 'x-xz', 'x-tar', 'x-lzma')
build(cancel_event=None)

Perform the build if needed, do a soft-link copy of the build directory into our test directory, and note that we’ve used the given build. :param threading.Event cancel_event: Allows builds to tell each other to die. :return: True if these steps completed successfully.

copy_build(dest)

Copy the build (using ‘symlink’ copying to the destination.

Parameters:dest (Path) – Where to copy the build to.
Returns:True on success, False on failure
create_build_hash()

Turn the build config, and everything the build needs, into hash. This includes the build config itself, the source tarball, and all extra files. Additionally, system variables may be included in the hash if specified via the pavilion config.

deprecate()

Deprecate this build, so that it will be rebuilt if any other test run wants to use it.

exists()

Return True if the given build exists.

name_build()

Search for the first non-deprecated version of this build (whether or not it exists) and name the build for it.

rename_build()

Rechecks deprecation and updates the build name.

exception pavilion.builder.TestBuilderError

Bases: RuntimeError

Exception raised when builds encounter an error.