bout_runners.metadata.status_checker¶
Module containing the StatusChecker class.
Classes
|
Class to check and update the status of runs. |
-
class
bout_runners.metadata.status_checker.
StatusChecker
(db_connector: bout_runners.database.database_connector.DatabaseConnector, project_path: Optional[Union[pathlib.Path, str]] = None)[source]¶ Class to check and update the status of runs.
Examples
>>> from pathlib import Path >>> from bout_runners.database.database_connector import \ ... DatabaseConnector >>> db_connector = DatabaseConnector('name_of_db', ... Path().joinpath('path', 'to', 'db')) >>> project_path = Path('path').joinpath('to', 'project') >>> status_checker = StatusChecker(db_connector, project_path) >>> status_checker.check_and_update_status()
Any updates to the runs will be written to the database. Alternatively, one can run the program until all jobs have stopped by calling
>>> status_checker.check_and_update_until_complete()
- Attributes
- __db_connectorDatabaseConnector
Connection to the database under consideration
- __db_readerDatabaseReader
Object to read the database with
- project_pathPath
Path to the project
Methods
check_and_update_status()
Check and update the status for the schema
check_and_update_status_until_complete()
Check and update the status until all runs are stopped
__check_submitted(metadata_updater, submitted_to_check)
Check the status of all runs which has status submitted
__check_running(metadata_updater, running_to_check)
Check the status of all runs which has status running __check_if_stopped(log_reader, metadata_updater) Check if a run has stopped
check_if_running_or_errored(log_reader)
Check if a run is still running or has errored
Set connector, reader and a project path.
- Parameters
- db_connectorDatabaseConnector
Connection to the database
- project_pathPath
Path to the project (the root directory with which usually contains the makefile and the executable)
Notes
The StatusChecker instance only checks the project belonging to the same database schema grouped together by the db_connector
Methods
Check and update the status for the schema.
Check and update the status until all runs are stopped.
check_if_running_or_errored
(log_reader)Check if a run is still running or has errored.
Return the query string for non errored results.
-
check_and_update_status
() → None[source]¶ Check and update the status for the schema.
- Raises
- RuntimeError
If the schema does not exist
-
check_and_update_until_complete
(seconds_between_update: int = 5) → None[source]¶ Check and update the status until all runs are stopped.
- Parameters
- seconds_between_updateint
Number of seconds before a new status check is performed
-
static
check_if_running_or_errored
(log_reader: bout_runners.log.log_reader.LogReader) → str[source]¶ Check if a run is still running or has errored.
- Parameters
- log_readerLogReader
The object which reads log files
- Returns
- latest_statusstr
The latest status