Pavilion Builder Objects¶
Table of Contents
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
(log=True)¶ 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: - builder (TestBuilder) – The builder object to track.
- test_status_file (status_file.StatusFile) – The status file object for the corresponding test.
Returns: A build tracker instance that can be used by builds directly.
Return type:
-
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'¶
-
DOWNLOAD_HASH_SIZE
= 13¶
-
FINISHED_SUFFIX
= '.finished'¶
-
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 a hash. This includes the build config itself, the source tarball, and all extra files.
-
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.
-
log_updated
() → Optional[float]¶ Return the last time the build log was updated. Simply returns None if the log can’t be found or read.
-
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.