autosubmit.database — autosubmit 3.9.1 documentation

# 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.

  Parameters: | error_on_inexistence (bool) – if True, adds an error log if experiment does not exists 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

  Parameters: | experiment_id (str) – experiment identifier
  Returns: | True if delete is succesful
  Return type: | bool

`autosubmit.database.db_common.` `get_autosubmit_version`(expid)

  Get the minimun autosubmit version needed for the experiment

  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

  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

  Parameters: | version (str) – name (str) – experiment’s name description (str) – experiment’s description