sorcha.utilities.check_output_logs

Functions

find_all_log_files(filepath)

Looks for all Sorcha log files in the given filepath and subdirectories

check_all_logs(log_files)

Checks the last line of all the log files supplied and checks to see

check_output_logs(filepath[, output])

Searches directories recursively for Sorcha log files, classifies them as

Module Contents

find_all_log_files(filepath)[source]

Looks for all Sorcha log files in the given filepath and subdirectories recursively. Specifically searches for files ending *sorcha.log.

Parameters:

filepath (str) -- Filepath of top-level directory within which to search for Sorcha log files.

Returns:

log_files -- A list of the discovered log files (absolute paths)

Return type:

list

check_all_logs(log_files)[source]

Checks the last line of all the log files supplied and checks to see if the Sorcha run completed successfully, saving the last line of the log in question if it did not.

Parameters:

log_files (list) -- A list of filepaths pointing to Sorcha log files.

Returns:

  • good_log (list of Booleans) -- A list of whether each log file was deemed to be successful or not

  • last_lines (list of str) -- A list of the last lines of unsuccessful Sorcha runs.

check_output_logs(filepath, output=False)[source]

Searches directories recursively for Sorcha log files, classifies them as belonging to successful or unsuccessful Sorcha runs, and provides this information to the user. This is helpful in cases where several runs of Sorcha are being performed simultaneously (i.e. on a supercomputer). Can output either a .csv file or straight to the terminal.

Parameters:
  • filepath (str) -- Filepath of top-level directory within which to search for Sorcha log files.

  • output (str or bool, default=False) -- Either the filepath/name in which to save output, or False to print output to terminal.