toil.exceptions

Neutral place for exceptions, to break import cycles.

Attributes

logger

Exceptions

FailedJobsException

Common base class for all non-exit exceptions.

Classes

StatsAndLogging

A thread to aggregate statistics and logging.

Module Contents

class toil.exceptions.StatsAndLogging(jobStore, config)[source]

A thread to aggregate statistics and logging.

Parameters:
start()[source]

Start the stats and logging thread.

Return type:

None

classmethod formatLogStream(stream, stream_name)[source]

Given a stream of text or bytes, and the job name, job itself, or some other optional stringifyable identity info for the job, return a big text string with the formatted job log, suitable for printing for the user.

We don’t want to prefix every line of the job’s log with our own logging info, or we get prefixes wider than any reasonable terminal and longer than the messages.

Parameters:
  • stream (Union[IO[str], IO[bytes]]) – The stream of text or bytes to print for the user.

  • stream_name (str)

Return type:

str

classmethod logWithFormatting(stream_name, jobLogs, method=logger.debug, message=None)[source]
Parameters:
  • stream_name (str)

  • jobLogs (Union[IO[str], IO[bytes]])

  • method (Callable[[str], None])

  • message (Optional[str])

Return type:

None

classmethod writeLogFiles(jobNames, jobLogList, config, failed=False)[source]
Parameters:
Return type:

None

classmethod statsAndLoggingAggregator(jobStore, stop, config)[source]

The following function is used for collating stats/reporting log messages from the workers. Works inside of a thread, collates as long as the stop flag is not True.

Parameters:
Return type:

None

check()[source]

Check on the stats and logging aggregator. :raise RuntimeError: If the underlying thread has quit.

Return type:

None

shutdown()[source]

Finish up the stats/logging aggregation thread.

Return type:

None

toil.exceptions.logger
exception toil.exceptions.FailedJobsException(job_store, failed_jobs, exit_code=1)[source]

Bases: Exception

Common base class for all non-exit exceptions.

Parameters:
__str__()[source]

Stringify the exception, including the message.

Return type:

str