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:
parent
9305967d10
commit
f971cda727
|
|
@ -140,9 +140,8 @@ class Sge(IGridEngine):
|
||||||
return queues_status
|
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)
|
# a table storing the log of actions (queue activation or deactivation)
|
||||||
if not conn.table_exists('log'):
|
if not conn.table_exists('log'):
|
||||||
fields = [
|
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'
|
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'
|
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)
|
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"'
|
command = f'ssh "{ssh_user}@{sql_server_fqdn}" "hostname"'
|
||||||
completed_process = subprocess.run(command, shell=True, check=False, capture_output=True)
|
completed_process = subprocess.run(command, shell=True, check=False, capture_output=True)
|
||||||
if completed_process.returncode != 0:
|
if completed_process.returncode != 0:
|
||||||
|
|
@ -194,8 +195,6 @@ def create_db_backend(db_def: str) -> ISqlDatabaseBackend:
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unsupported database type: %s" % db_type)
|
raise ValueError("Unsupported database type: %s" % db_type)
|
||||||
|
|
||||||
init_db(backend)
|
|
||||||
|
|
||||||
return backend
|
return backend
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -478,6 +477,7 @@ def main():
|
||||||
grid_engine = Sge()
|
grid_engine = Sge()
|
||||||
db_backend = create_db_backend(args.db_def)
|
db_backend = create_db_backend(args.db_def)
|
||||||
with db_backend.connect() as conn:
|
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)}"
|
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)
|
logging.debug("Connected to database successfully with connection %s", conn)
|
||||||
quman = QueueManager(conn, grid_engine)
|
quman = QueueManager(conn, grid_engine)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
__version__ = '1.0.32'
|
__version__ = '1.0.33'
|
||||||
|
|
||||||
|
|
||||||
class Version(object):
|
class Version(object):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue