autosubmit.database#
Module containing functions to manage autosubmit’s database.
- exception autosubmit.database.db_common.DbException(message)#
Exception class for database errors
- autosubmit.database.db_common.check_db()#
Checks if database file exist
- Returns:
None if exists, terminates program if not
- autosubmit.database.db_common.check_experiment_exists(name, error_on_inexistence=True)#
Checks if exist an experiment with the given name. Anti-lock version.
- Parameters:
error_on_inexistence (bool) – if True, adds an error log if experiment does not exist
name (str) – Experiment name
- Returns:
If experiment exists returns true, if not returns false
- Return type:
bool
- autosubmit.database.db_common.close_conn(conn, cursor)#
Commits changes and close connection to database
- Parameters:
conn (sqlite3.Connection) – connection to close
cursor (sqlite3.Cursor) – cursor to close
- autosubmit.database.db_common.create_db(qry)#
Creates a new database for autosubmit
- Parameters:
qry (str) – query to create the new database
- autosubmit.database.db_common.delete_experiment(experiment_id)#
Removes experiment from database. Anti-lock version.
- Parameters:
experiment_id (str) – experiment identifier
- Returns:
True if delete is successful
- Return type:
bool
- autosubmit.database.db_common.get_autosubmit_version(expid)#
Get the minimum autosubmit version needed for the experiment. Anti-lock version.
- Parameters:
expid (str) – Experiment name
- Returns:
If experiment exists returns the autosubmit version for it, if not returns None
- Return type:
str
- autosubmit.database.db_common.last_name_used(test=False, operational=False)#
Gets last experiment identifier used. Anti-lock version.
- Parameters:
test (bool) – flag for test experiments
operational – flag for operational experiments
- Returns:
last experiment identifier used, ‘empty’ if there is none
- Return type:
str
- autosubmit.database.db_common.open_conn(check_version=True)#
Opens a connection to database
- Parameters:
check_version (bool) – If true, check if the database is compatible with this autosubmit version
- Returns:
connection object, cursor object
- Return type:
sqlite3.Connection, sqlite3.Cursor
- autosubmit.database.db_common.save_experiment(name, description, version)#
Stores experiment in database. Anti-lock version.
- Parameters:
version (str) –
name (str) – experiment’s name
description (str) – experiment’s description
- autosubmit.database.db_common.update_experiment_descrip_version(name, description=None, version=None)#
Updates the experiment’s description and/or version. Anti-lock version.
- Parameters:
name – experiment name (expid)
description – experiment new description
version – experiment autosubmit version
- Rtype name:
str
- Rtype description:
str
- Rtype version:
str
- Returns:
If description has been update, True; otherwise, False.
- Return type:
bool