Skip to content

Commit

Permalink
black format
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodong-ji committed Nov 28, 2024
1 parent 7af0df5 commit dbcfd8f
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 11 deletions.
4 changes: 3 additions & 1 deletion handler/analyzer/analyze_index_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def init_option(self):
ob_cluster = self.context.cluster_config
self.stdio.verbose('cluster config: {0}'.format(StringUtils.mask_passwords(ob_cluster)))
self.ob_cluster = ob_cluster
self.sys_connector = OBConnector(context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100)
self.sys_connector = OBConnector(
context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100
)
tenant_name = Util.get_option(options, 'tenant_name')
table_name = Util.get_option(options, 'table_name')
index_name = Util.get_option(options, 'index_name')
Expand Down
4 changes: 3 additions & 1 deletion handler/analyzer/analyze_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def init_config(self):
ob_cluster = self.context.cluster_config
self.stdio.verbose('cluster config: {0}'.format(StringUtils.mask_passwords(ob_cluster)))
self.ob_cluster = ob_cluster
self.sys_connector = OBConnector(context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100)
self.sys_connector = OBConnector(
context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100
)
self.ob_cluster_name = ob_cluster.get("ob_cluster_name")
self.stdio.print('init cluster config complete')
return True
Expand Down
4 changes: 3 additions & 1 deletion handler/analyzer/analyze_sql_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def init_config(self):
ob_cluster = self.context.cluster_config
self.stdio.verbose('cluster config: {0}'.format(StringUtils.mask_passwords(ob_cluster)))
self.ob_cluster = ob_cluster
self.sys_connector = OBConnector(context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100)
self.sys_connector = OBConnector(
context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100
)
self.ob_cluster_name = ob_cluster.get("ob_cluster_name")
self.stdio.print('init cluster config complete')
return True
Expand Down
4 changes: 3 additions & 1 deletion handler/checker/check_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ def __init__(self, context, max_size, cluster):
self.stdio.verbose("obConnectorPool init success!")
try:
for i in range(max_size):
conn = OBConnector(context=context, ip=self.cluster.get("db_host"), port=self.cluster.get("db_port"), username=self.cluster.get("tenant_sys").get("user"), password=self.cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000)
conn = OBConnector(
context=context, ip=self.cluster.get("db_host"), port=self.cluster.get("db_port"), username=self.cluster.get("tenant_sys").get("user"), password=self.cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000
)
self.connections.put(conn)
self.stdio.verbose("obConnectorPool init success!")
except Exception as e:
Expand Down
8 changes: 6 additions & 2 deletions handler/display/display_scenes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def __init__(self, context, display_pack_dir='./', tasks_base_path="~/.obdiag/di

def init_config(self):
self.cluster = self.context.cluster_config
self.sys_connector = OBConnector(context=self.context, ip=self.cluster.get("db_host"), port=self.cluster.get("db_port"), username=self.cluster.get("tenant_sys").get("user"), password=self.cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100)
self.sys_connector = OBConnector(
context=self.context, ip=self.cluster.get("db_host"), port=self.cluster.get("db_port"), username=self.cluster.get("tenant_sys").get("user"), password=self.cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100
)
self.obproxy_nodes = self.context.obproxy_config['servers']
self.ob_nodes = self.context.cluster_config['servers']
new_nodes = Util.get_nodes_list(self.context, self.ob_nodes, self.stdio)
Expand Down Expand Up @@ -89,7 +91,9 @@ def execute(self):
self.stdio.error("Internal error :{0}".format(e))

def __init_db_connector(self):
self.db_connector = OBConnector(context=self.context, ip=self.db_conn.get("host"), port=self.db_conn.get("port"), username=self.db_conn.get("user"), password=self.db_conn.get("password"), database=self.db_conn.get("database"), stdio=self.stdio, timeout=100)
self.db_connector = OBConnector(
context=self.context, ip=self.db_conn.get("host"), port=self.db_conn.get("port"), username=self.db_conn.get("user"), password=self.db_conn.get("password"), database=self.db_conn.get("database"), stdio=self.stdio, timeout=100
)

def __init_db_conn(self, cli_connection_string):
try:
Expand Down
9 changes: 8 additions & 1 deletion handler/gather/gather_ash_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,14 @@ def __init__(self, context, gather_pack_dir='./'):
self.observer_nodes = self.context.cluster_config.get("servers")
try:
self.obconn = OBConnector(
context=self.context, ip=self.cluster.get("db_host"), port=self.cluster.get("db_port"), username=self.cluster.get("tenant_sys").get("user"), password=self.cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000, database="oceanbase"
context=self.context,
ip=self.cluster.get("db_host"),
port=self.cluster.get("db_port"),
username=self.cluster.get("tenant_sys").get("user"),
password=self.cluster.get("tenant_sys").get("password"),
stdio=self.stdio,
timeout=10000,
database="oceanbase",
)
except Exception as e:
self.stdio.error("Failed to connect to database: {0}".format(e))
Expand Down
8 changes: 6 additions & 2 deletions handler/gather/gather_plan_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ def __init__(self, context, gather_pack_dir='./', is_scene=False):
def init_config(self):
ob_cluster = self.context.cluster_config
self.ob_cluster = ob_cluster
self.sys_connector = OBConnector(context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100)
self.sys_connector = OBConnector(
context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=100
)
self.ob_cluster_name = ob_cluster.get("ob_cluster_name")
return True

Expand Down Expand Up @@ -92,7 +94,9 @@ def init_option(self):
return self.tenant_mode_detected()

def __init_db_connector(self):
self.db_connector = OBConnector(context=self.context, ip=self.db_conn.get("host"), port=self.db_conn.get("port"), username=self.db_conn.get("user"), password=self.db_conn.get("password"), database=self.db_conn.get("database"), stdio=self.stdio, timeout=100)
self.db_connector = OBConnector(
context=self.context, ip=self.db_conn.get("host"), port=self.db_conn.get("port"), username=self.db_conn.get("user"), password=self.db_conn.get("password"), database=self.db_conn.get("database"), stdio=self.stdio, timeout=100
)

def handle(self):
if not self.init_config():
Expand Down
4 changes: 3 additions & 1 deletion handler/gather/step/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def __init__(self, context, step, ob_cluster, report_path, task_variable_dict):
self.tenant_mode = None
self.sys_database = None
self.database = None
self.ob_connector = OBConnector(context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000)
self.ob_connector = OBConnector(
context=self.context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000
)
except Exception as e:
self.stdio.error("StepSQLHandler init fail. Please check the OBCLUSTER conf. OBCLUSTER: {0} Exception : {1} .".format(ob_cluster, e))
self.task_variable_dict = task_variable_dict
Expand Down
4 changes: 3 additions & 1 deletion telemetry/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ def set_cluster_conn(self, context, obcluster):
if obcluster is not None:
try:

self.cluster_conn = OBConnector(context=context, ip=obcluster.get("db_host"), port=obcluster.get("db_port"), username=obcluster.get("tenant_sys").get("user"), password=obcluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000)
self.cluster_conn = OBConnector(
context=context, ip=obcluster.get("db_host"), port=obcluster.get("db_port"), username=obcluster.get("tenant_sys").get("user"), password=obcluster.get("tenant_sys").get("password"), stdio=self.stdio, timeout=10000
)
self.threads.append(threading.Thread(None, self.get_cluster_info()))
# self.threads.append(threading.Thread(None, self.get_tenant_info()))
for thread in self.threads:
Expand Down

0 comments on commit dbcfd8f

Please sign in to comment.