cocluto v1.0.33 - improved the performance of quman by removing 2 unneeded ssh connection requests

work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=3093]
This commit is contained in:
Guillaume Raffy 2026-06-03 11:27:41 +02:00
parent 9305967d10
commit f971cda727
2 changed files with 35 additions and 35 deletions

View File

@ -140,9 +140,8 @@ class Sge(IGridEngine):
return queues_status
def init_db(db_backend: ISqlDatabaseBackend):
def init_db(conn: ISqlConnection):
with db_backend.connect() as conn:
# a table storing the log of actions (queue activation or deactivation)
if not conn.table_exists('log'):
fields = [
@ -184,6 +183,8 @@ def create_db_backend(db_def: str) -> ISqlDatabaseBackend:
db_name = db_params['db_name'] # the name of the database, eg 'quman'
ssh_user = db_params['ssh_user'] # the ssh user which has the privileges to access the mysql database, eg 'qumandbw'
backend = SshAccessedMysqlDb(sql_server_fqdn, db_user, db_name, ssh_user)
check_ssh = False
if check_ssh:
command = f'ssh "{ssh_user}@{sql_server_fqdn}" "hostname"'
completed_process = subprocess.run(command, shell=True, check=False, capture_output=True)
if completed_process.returncode != 0:
@ -194,8 +195,6 @@ def create_db_backend(db_def: str) -> ISqlDatabaseBackend:
else:
raise ValueError("Unsupported database type: %s" % db_type)
init_db(backend)
return backend
@ -478,6 +477,7 @@ def main():
grid_engine = Sge()
db_backend = create_db_backend(args.db_def)
with db_backend.connect() as conn:
init_db(conn)
assert isinstance(conn, ISqlConnection), f"Expected db_backend.connect() to return an ISqlConnection but got {type(conn)}"
logging.debug("Connected to database successfully with connection %s", conn)
quman = QueueManager(conn, grid_engine)

View File

@ -1,4 +1,4 @@
__version__ = '1.0.32'
__version__ = '1.0.33'
class Version(object):