bout_runners.metadata.metadata_updater

Module containing the MetadataUpdater class.

Classes

MetadataUpdater(db_connector, run_id)

Class which updates dynamic data about the run.

class bout_runners.metadata.metadata_updater.MetadataUpdater(db_connector: bout_runners.database.database_connector.DatabaseConnector, run_id: int)[source]

Class which updates dynamic data about the run.

Examples

>>> from pathlib import Path
>>> from datetime import datetime
>>> from bout_runners.database.database_connector import DatabaseConnector
>>> db_root_path = Path().joinpath('path', 'to', 'db_root')
>>> db_connector = DatabaseConnector('name_of_db', db_root_path)
>>> run_id = 1  # This must be a valid id in the run table
>>> metadata_updater = MetadataUpdater(db_connector, run_id)
>>> metadata_updater.update_start_time(datetime.now())
>>> metadata_updater.update_stop_time(datetime.now())
>>> metadata_updater.update_latest_status('error')
Attributes
__db_writerDatabaseWriter

Class used to write to the database

run_idint

The id of the run to update

Methods

update_start_time(start_time)

Update the start time

update_end_time(end_time)

Update the end time

update_latest_status(status)

Update the latest status

Set the database and id to use.

Parameters
db_connectorDatabaseConnector

The database connector

run_idint

The id of the run to update

Methods

update_field(column, value)

Update a field with a certain row in the run table.

update_latest_status(status)

Update the latest status.

update_start_time(start_time)

Update the start time.

update_stop_time(end_time)

Update the end time.

update_field(column: str, value: Union[datetime.datetime, str]) → None[source]

Update a field with a certain row in the run table.

Parameters
columnstr

The column to update

valueobject

The updating value

update_latest_status(status: str) → None[source]

Update the latest status.

Parameters
statusstr

The latest status

update_start_time(start_time: datetime.datetime) → None[source]

Update the start time.

Parameters
start_timedatetime

The start time of the execution

update_stop_time(end_time: datetime.datetime) → None[source]

Update the end time.

Parameters
end_timedatetime

The end time of the execution