plainbox.impl.result – job result

This module has two basic implementation of IJobResult: MemoryJobResult and DiskJobResult.

class plainbox.impl.result.DiskJobResult(data)[source]

Bases: plainbox.impl.result._JobResultBase

A IJobResult that keeps IO logs on disk.

This type of JobResult is intended for working with most results. It does not store IO logs in memory so it is scalable to arbitrary IO log sizes. Each instance just knows where the log file is located (using the ‘io_log_filename’ attribute for that) and offers streaming API for accessing particular parts of the log.

OUTCOME_CRASH = 'crash'
OUTCOME_FAIL = 'fail'
OUTCOME_NONE = None
OUTCOME_NOT_IMPLEMENTED = 'not-implemented'
OUTCOME_NOT_SUPPORTED = 'not-supported'
OUTCOME_PASS = 'pass'
OUTCOME_SKIP = 'skip'
OUTCOME_UNDECIDED = 'undecided'
append_comments(comments)

Append new comments to the result

Parameters:comments – The comments to append

This method simplifies appending comments to an existing result. Since initally there are no comments (None is returned) this makes all the code that has to halde updates a little tedious. Using this method, in contrast, is always easy.

comments

comments of the test operator

execution_duration

The amount of time in seconds it took to run this job.

get_io_log()[source]
io_log[source]
io_log_filename[source]

pathname of the file containing serialized IO log records

is_hollow

flag that indicates if the result is hollow

Hollow results may have been created but hold no data at all. Hollow results are also tentatively deprecated, once we have some time to re-factor SessionState and specifically the job_state_map code we will remove the need to have hollow results.

Hollow results are not saved, beginning with plainbox.impl.session.suspend.SessionSuspendHelper4.

on_comments_changed

Basic signal that supports arbitrary listeners.

While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.

Attr _name:Name of the signal, typically accessed via name().
Attr _listeners:
 List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener.
on_outcome_changed

Basic signal that supports arbitrary listeners.

While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.

Attr _name:Name of the signal, typically accessed via name().
Attr _listeners:
 List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener.
outcome

outcome of running this job.

The outcome ultimately classifies jobs (tests) as failures or successes. There are several other types of outcome that all basically mean that the job did not run for some particular reason.

outcome_color_ansi()

Get an ANSI escape sequence that represents this outcome

outcome_color_hex()

Get the hexadecimal “#RRGGBB” color that represents this outcome

outcome_meta()

Get the OutcomeMetadata object associated with this outcome.

return_code

return code of the command associated with the job, if any

tr_outcome()

Get the translated value of the outcome

class plainbox.impl.result.GzipFile(filename=None, mode=None, compresslevel=9, fileobj=None, mtime=None)[source]

Bases: gzip.GzipFile

Subclass of GzipFile that works around missing read1() on python3.2

See: http://bugs.python.org/issue10791

close()
closed
detach()

Disconnect this buffer from its underlying raw stream and return it.

After the raw stream has been detached, the buffer is in an unusable state.

filename
fileno()

Invoke the underlying file object’s fileno() method.

This will raise AttributeError if the underlying file object doesn’t support fileno().

flush(zlib_mode=2)
isatty()

Return whether this is an ‘interactive’ stream.

Return False if it can’t be determined.

max_read_chunk = 10485760
myfileobj = None
peek(n)
read(size=-1)
read1(n)[source]
readable()
readinto()
readline(size=-1)
readlines()

Return a list of lines from the stream.

hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.

rewind()

Return the uncompressed stream file position indicator to the beginning of the file

seek(offset, whence=0)
seekable()
tell()

Return current stream position.

truncate()

Truncate file to size bytes.

File pointer is left unchanged. Size defaults to the current IO position as reported by tell(). Returns the new size.

writable()
write(data)
writelines()
class plainbox.impl.result.IOLogRecord

Bases: builtins.tuple

IOLogRecord(delay, stream_name, data)

count(value) → integer -- return number of occurrences of value
data

Alias for field number 2

delay

Alias for field number 0

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

stream_name

Alias for field number 1

class plainbox.impl.result.IOLogRecordReader(stream)[source]

Bases: builtins.object

Class for streaming :class`IOLogRecord` instances from a text stream

close()[source]
read_record()[source]

Read the next record from the stream.

Returns:None if the stream is empty
Returns:next IOLogRecord as found in the stream.
class plainbox.impl.result.IOLogRecordWriter(stream)[source]

Bases: builtins.object

Class for writing IOLogRecord instances to a text stream

close()[source]
write_record(record)[source]

Write an IOLogRecord to the stream.

class plainbox.impl.result.MemoryJobResult(data)[source]

Bases: plainbox.impl.result._JobResultBase

A IJobResult that keeps IO logs in memory.

This type of JobResult is indented for writing unit tests where the hassle of going through the filesystem would make them needlessly complicated.

OUTCOME_CRASH = 'crash'
OUTCOME_FAIL = 'fail'
OUTCOME_NONE = None
OUTCOME_NOT_IMPLEMENTED = 'not-implemented'
OUTCOME_NOT_SUPPORTED = 'not-supported'
OUTCOME_PASS = 'pass'
OUTCOME_SKIP = 'skip'
OUTCOME_UNDECIDED = 'undecided'
append_comments(comments)

Append new comments to the result

Parameters:comments – The comments to append

This method simplifies appending comments to an existing result. Since initally there are no comments (None is returned) this makes all the code that has to halde updates a little tedious. Using this method, in contrast, is always easy.

comments

comments of the test operator

execution_duration

The amount of time in seconds it took to run this job.

get_io_log()[source]
io_log
is_hollow

flag that indicates if the result is hollow

Hollow results may have been created but hold no data at all. Hollow results are also tentatively deprecated, once we have some time to re-factor SessionState and specifically the job_state_map code we will remove the need to have hollow results.

Hollow results are not saved, beginning with plainbox.impl.session.suspend.SessionSuspendHelper4.

on_comments_changed

Basic signal that supports arbitrary listeners.

While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.

Attr _name:Name of the signal, typically accessed via name().
Attr _listeners:
 List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener.
on_outcome_changed

Basic signal that supports arbitrary listeners.

While this class can be used directly it is best used with the helper decorator Signal.define on a function or method. See the documentation for the plainbox.vendor.morris module for details.

Attr _name:Name of the signal, typically accessed via name().
Attr _listeners:
 List of signal listeners. Each item is a tuple (listener, pass_signal) that encodes how to call the listener.
outcome

outcome of running this job.

The outcome ultimately classifies jobs (tests) as failures or successes. There are several other types of outcome that all basically mean that the job did not run for some particular reason.

outcome_color_ansi()

Get an ANSI escape sequence that represents this outcome

outcome_color_hex()

Get the hexadecimal “#RRGGBB” color that represents this outcome

outcome_meta()

Get the OutcomeMetadata object associated with this outcome.

return_code

return code of the command associated with the job, if any

tr_outcome()

Get the translated value of the outcome

class plainbox.impl.result.OutcomeMetadata

Bases: builtins.tuple

OutcomeMetadata(value, unicode_sigil, tr_outcome, tr_label, color_ansi, color_hex, hexr_xml_mapping, hexr_xml_allowed, hexr_xml_order)

color_ansi

Alias for field number 4

color_hex

Alias for field number 5

count(value) → integer -- return number of occurrences of value
hexr_xml_allowed

Alias for field number 7

hexr_xml_mapping

Alias for field number 6

hexr_xml_order

Alias for field number 8

index(value[, start[, stop]]) → integer -- return first index of value.

Raises ValueError if the value is not present.

tr_label

Alias for field number 3

tr_outcome

Alias for field number 2

unicode_sigil

Alias for field number 1

value

Alias for field number 0

plainbox.impl.result.outcome_color_ansi(outcome)[source]

Get an ANSI escape sequence that represents this outcome

plainbox.impl.result.outcome_color_hex(outcome)[source]

Get the hexadecimal “#RRGGBB” color that represents this outcome

plainbox.impl.result.outcome_meta(outcome)[source]

Get the OutcomeMetadata object associated with this outcome.

plainbox.impl.result.tr_outcome(outcome)[source]

Get the translated value of OUTCOME_ constant

Previous topic

plainbox.impl.resource – job resources

Next topic

plainbox.impl.runner – job runner

This Page