bout_runners.log.log_reader¶
Module containing the LogReader class.
Classes
|
Class for reading BOUT++ log files. |
-
class
bout_runners.log.log_reader.LogReader(log_path: pathlib.Path)[source]¶ Class for reading BOUT++ log files.
Examples
>>> from pathlib import Path >>> path = Path().joinpath('path', 'to', 'BOUT.log.0') >>> log_reader = LogReader(path) >>> log_reader.start_time '2020-05-01 17:07:10'
>>> log_reader.end_time '2020-05-01 17:07:14'
>>> log_reader.pid 1190
- Attributes
- file_strstr
The log file as a string
start_timeNone or strReturn the start time of the process.
end_timeNone or strReturn the end time of the process.
pidNone or intReturn the pid of the process.
Methods
started()
Whether or not the execution has started
ended()
Whether or not the execution has ended
pid_exist()
Whether or not the pid can be found
__is_str_in_file(pattern)
Check whether regex-pattern exists in file
__find_locale_time(pattern)
Return the locale time of a regex capture
Open and read a log file.
- Parameters
- log_pathstr or Path
Absolute path to log file
- Attributes
end_timeReturn the end time of the process.
pidReturn the pid of the process.
start_timeReturn the start time of the process.
Methods
ended(self)Check whether the run has an end time.
pid_exist(self)Check whether a process id exist.
started(self)Check whether the run has a start time.
-
property
end_time¶ Return the end time of the process.
- Returns
- datetime or None
The end time on date time format
-
ended(self) → bool[source]¶ Check whether the run has an end time.
- Returns
- bool
True if the end signature is found in the file
-
property
pid¶ Return the pid of the process.
- Returns
- int or None
The pid of the process
-
pid_exist(self) → bool[source]¶ Check whether a process id exist.
- Returns
- bool
True if the pid is found
-
property
start_time¶ Return the start time of the process.
- Returns
- datetime or None
The start time on date time format