From 1a9d12741a74114c4328e09d3a169ab299cb8e1c Mon Sep 17 00:00:00 2001 From: -LAN- Date: Tue, 24 Dec 2024 15:28:54 +0800 Subject: [PATCH] fix: refactor create_clusters function to use keyword arguments for clarity and maintainability Signed-off-by: -LAN- --- api/schedule/create_tidb_serverless_task.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/schedule/create_tidb_serverless_task.py b/api/schedule/create_tidb_serverless_task.py index eac5fabb6088ce..1c985461c6aa2e 100644 --- a/api/schedule/create_tidb_serverless_task.py +++ b/api/schedule/create_tidb_serverless_task.py @@ -36,14 +36,15 @@ def create_tidb_serverless_task(): def create_clusters(batch_size): try: + # TODO: maybe we can set the default value for the following parameters in the config file new_clusters = TidbService.batch_create_tidb_serverless_cluster( - batch_size, - dify_config.TIDB_PROJECT_ID or "", - dify_config.TIDB_API_URL or "", - dify_config.TIDB_IAM_API_URL or "", - dify_config.TIDB_PUBLIC_KEY or "", - dify_config.TIDB_PRIVATE_KEY or "", - dify_config.TIDB_REGION or "", + batch_size=batch_size, + project_id=dify_config.TIDB_PROJECT_ID or "", + api_url=dify_config.TIDB_API_URL or "", + iam_url=dify_config.TIDB_IAM_API_URL or "", + public_key=dify_config.TIDB_PUBLIC_KEY or "", + private_key=dify_config.TIDB_PRIVATE_KEY or "", + region=dify_config.TIDB_REGION or "", ) for new_cluster in new_clusters: tidb_auth_binding = TidbAuthBinding(