make logging not use f-str, change others to f-str (#22882)
This commit is contained in:
@@ -78,7 +78,7 @@ class PluginMigration:
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
logger.exception(f"Failed to process tenant {tenant_id}")
|
||||
logger.exception("Failed to process tenant %s", tenant_id)
|
||||
|
||||
futures = []
|
||||
|
||||
@@ -136,7 +136,7 @@ class PluginMigration:
|
||||
try:
|
||||
tenants.append(tenant_id)
|
||||
except Exception:
|
||||
logger.exception(f"Failed to process tenant {tenant_id}")
|
||||
logger.exception("Failed to process tenant %s", tenant_id)
|
||||
continue
|
||||
|
||||
futures.append(
|
||||
@@ -273,7 +273,7 @@ class PluginMigration:
|
||||
result.append(ToolProviderID(tool_entity.provider_id).plugin_id)
|
||||
|
||||
except Exception:
|
||||
logger.exception(f"Failed to process tool {tool}")
|
||||
logger.exception("Failed to process tool %s", tool)
|
||||
continue
|
||||
|
||||
return result
|
||||
@@ -301,7 +301,7 @@ class PluginMigration:
|
||||
plugins: dict[str, str] = {}
|
||||
plugin_ids = []
|
||||
plugin_not_exist = []
|
||||
logger.info(f"Extracting unique plugins from {extracted_plugins}")
|
||||
logger.info("Extracting unique plugins from %s", extracted_plugins)
|
||||
with open(extracted_plugins) as f:
|
||||
for line in f:
|
||||
data = json.loads(line)
|
||||
@@ -318,7 +318,7 @@ class PluginMigration:
|
||||
else:
|
||||
plugin_not_exist.append(plugin_id)
|
||||
except Exception:
|
||||
logger.exception(f"Failed to fetch plugin unique identifier for {plugin_id}")
|
||||
logger.exception("Failed to fetch plugin unique identifier for %s", plugin_id)
|
||||
plugin_not_exist.append(plugin_id)
|
||||
|
||||
with ThreadPoolExecutor(max_workers=10) as executor:
|
||||
@@ -339,7 +339,7 @@ class PluginMigration:
|
||||
|
||||
# use a fake tenant id to install all the plugins
|
||||
fake_tenant_id = uuid4().hex
|
||||
logger.info(f"Installing {len(plugins['plugins'])} plugin instances for fake tenant {fake_tenant_id}")
|
||||
logger.info("Installing %s plugin instances for fake tenant %s", len(plugins["plugins"]), fake_tenant_id)
|
||||
|
||||
thread_pool = ThreadPoolExecutor(max_workers=workers)
|
||||
|
||||
@@ -348,7 +348,7 @@ class PluginMigration:
|
||||
plugin_install_failed.extend(response.get("failed", []))
|
||||
|
||||
def install(tenant_id: str, plugin_ids: list[str]) -> None:
|
||||
logger.info(f"Installing {len(plugin_ids)} plugins for tenant {tenant_id}")
|
||||
logger.info("Installing %s plugins for tenant %s", len(plugin_ids), tenant_id)
|
||||
# fetch plugin already installed
|
||||
installed_plugins = manager.list_plugins(tenant_id)
|
||||
installed_plugins_ids = [plugin.plugin_id for plugin in installed_plugins]
|
||||
@@ -408,7 +408,7 @@ class PluginMigration:
|
||||
|
||||
installation = manager.list_plugins(fake_tenant_id)
|
||||
except Exception:
|
||||
logger.exception(f"Failed to get installation for tenant {fake_tenant_id}")
|
||||
logger.exception("Failed to get installation for tenant %s", fake_tenant_id)
|
||||
|
||||
Path(output_file).write_text(
|
||||
json.dumps(
|
||||
@@ -491,7 +491,9 @@ class PluginMigration:
|
||||
else:
|
||||
failed.append(reverse_map[plugin.plugin_unique_identifier])
|
||||
logger.error(
|
||||
f"Failed to install plugin {plugin.plugin_unique_identifier}, error: {plugin.message}"
|
||||
"Failed to install plugin %s, error: %s",
|
||||
plugin.plugin_unique_identifier,
|
||||
plugin.message,
|
||||
)
|
||||
|
||||
done = True
|
||||
|
Reference in New Issue
Block a user