Daemon Log Reader

class ornithology.DaemonLog(path)[source]

Represents the log file for a particular HTCondor daemon. Can be used to open multiple “views” (DaemonLogStream) of the log file.

Warning

You shouldn’t need to create these yourself. Instead, see the <daemon>_log methods on Condor.

open()[source]

Return a DaemonLogStream pointing to the daemon’s log file.

class ornithology.DaemonLogStream(file)[source]
clear()[source]

Clear the internal message store; useful for isolating tests.

display_raw()[source]

Display the raw text of the daemon log as has been read so far.

property lines

An iterator over the raw lines that have been read from the daemon log so far.

read()[source]

Read lines from the daemon log and parse them into DaemonLogMessage. Returns an iterator over the messages as they are parsed.

Warning

If you do not consume the iterator, no lines will be read!

wait(condition, timeout=120)[source]

Wait for some condition to be true on a DaemonLogMessage parsed from the daemon log.

Parameters:
  • condition (Callable[[DaemonLogMessage], bool]) – A callback which will be executed on each message. If the callback returns True, this method will return as well.

  • timeout – How long to time out after. If the method times out, it will return False instead of True.

Returns:

True if the condition was satisfied, False otherwise.

Return type:

success

class ornithology.DaemonLogMessage(line, file_name, line_number)[source]

A class that represents a single message in a DaemonLog.

Parameters:
  • line (str) – The actual line that appeared in the daemon log file.

  • file_name (str) – The file that the line came from.

  • line_number (int) – The line number of the message in the log file.

property tags

The tags (like D_ALL) of the message.

property timestamp: datetime

The time that the message occurred.