Merge remote-tracking branch 'origin/main' into feat/queue-based-graph-engine

This commit is contained in:
-LAN-
2025-09-03 11:56:05 +08:00
83 changed files with 2377 additions and 2351 deletions

View File

@ -139,7 +139,7 @@ class ClickZettaVolumeStorage(BaseStorage):
schema=self._config.schema_name,
)
logger.debug("ClickZetta connection established")
except Exception as e:
except Exception:
logger.exception("Failed to connect to ClickZetta")
raise
@ -150,7 +150,7 @@ class ClickZettaVolumeStorage(BaseStorage):
self._connection, self._config.volume_type, self._config.volume_name
)
logger.debug("Permission manager initialized")
except Exception as e:
except Exception:
logger.exception("Failed to initialize permission manager")
raise
@ -213,7 +213,7 @@ class ClickZettaVolumeStorage(BaseStorage):
if fetch:
return cursor.fetchall()
return None
except Exception as e:
except Exception:
logger.exception("SQL execution failed: %s", sql)
raise
@ -349,7 +349,7 @@ class ClickZettaVolumeStorage(BaseStorage):
# Find the downloaded file (may be in subdirectories)
downloaded_file = None
for root, dirs, files in os.walk(temp_dir):
for root, _, files in os.walk(temp_dir):
for file in files:
if file == filename or file == os.path.basename(filename):
downloaded_file = Path(root) / file
@ -524,6 +524,6 @@ class ClickZettaVolumeStorage(BaseStorage):
logger.debug("Scanned %d items in path %s", len(result), path)
return result
except Exception as e:
except Exception:
logger.exception("Error scanning path %s", path)
return []

View File

@ -1,6 +1,6 @@
"""ClickZetta Volume file lifecycle management
This module provides file lifecycle management features including version control, automatic cleanup, backup and restore.
This module provides file lifecycle management features including version control, automatic cleanup, backup and restore
Supports complete lifecycle management for knowledge base files.
"""
@ -145,7 +145,7 @@ class FileLifecycleManager:
logger.info("File %s saved with lifecycle management, version %s", filename, new_version)
return file_metadata
except Exception as e:
except Exception:
logger.exception("Failed to save file with lifecycle")
raise
@ -163,7 +163,7 @@ class FileLifecycleManager:
if filename in metadata_dict:
return FileMetadata.from_dict(metadata_dict[filename])
return None
except Exception as e:
except Exception:
logger.exception("Failed to get file metadata for %s", filename)
return None
@ -192,7 +192,7 @@ class FileLifecycleManager:
# Parse version number
version_str = file_path.split(".v")[-1].split(".")[0]
try:
version_num = int(version_str)
_ = int(version_str)
# Simplified processing here, should actually read metadata from version file
# Temporarily create basic metadata information
except ValueError:
@ -203,7 +203,7 @@ class FileLifecycleManager:
return sorted(versions, key=lambda x: x.version or 0, reverse=True)
except Exception as e:
except Exception:
logger.exception("Failed to list file versions for %s", filename)
return []
@ -237,7 +237,7 @@ class FileLifecycleManager:
self.save_with_lifecycle(filename, version_data, {"restored_from": str(version)})
return True
except Exception as e:
except Exception:
logger.exception("Failed to restore %s to version %s", filename, version)
return False
@ -270,7 +270,7 @@ class FileLifecycleManager:
logger.info("File %s archived successfully", filename)
return True
except Exception as e:
except Exception:
logger.exception("Failed to archive file %s", filename)
return False
@ -314,7 +314,7 @@ class FileLifecycleManager:
logger.info("File %s soft deleted successfully", filename)
return True
except Exception as e:
except Exception:
logger.exception("Failed to soft delete file %s", filename)
return False
@ -372,7 +372,7 @@ class FileLifecycleManager:
return cleaned_count
except Exception as e:
except Exception:
logger.exception("Failed to cleanup old versions")
return 0
@ -427,7 +427,7 @@ class FileLifecycleManager:
return stats
except Exception as e:
except Exception:
logger.exception("Failed to get storage statistics")
return {}
@ -465,7 +465,7 @@ class FileLifecycleManager:
metadata_content = json.dumps(metadata_dict, indent=2, ensure_ascii=False)
self._storage.save(self._metadata_file, metadata_content.encode("utf-8"))
logger.debug("Metadata saved successfully")
except Exception as e:
except Exception:
logger.exception("Failed to save metadata")
raise
@ -508,7 +508,7 @@ class FileLifecycleManager:
result = self._permission_manager.validate_operation(mapped_operation, self._dataset_id)
return bool(result)
except Exception as e:
except Exception:
logger.exception("Permission check failed for %s operation %s", filename, operation)
# Safe default: deny access when permission check fails
return False

View File

@ -84,7 +84,7 @@ class VolumePermissionManager:
logger.warning("Unknown volume type: %s", self._volume_type)
return False
except Exception as e:
except Exception:
logger.exception("Permission check failed")
return False
@ -119,7 +119,7 @@ class VolumePermissionManager:
)
return False
except Exception as e:
except Exception:
logger.exception("User Volume permission check failed")
# For User Volume, if permission check fails, it might be a configuration issue,
# provide friendlier error message
@ -159,7 +159,7 @@ class VolumePermissionManager:
return has_permission
except Exception as e:
except Exception:
logger.exception("Table volume permission check failed for %s", table_name)
return False
@ -217,7 +217,7 @@ class VolumePermissionManager:
return has_permission
except Exception as e:
except Exception:
logger.exception("External volume permission check failed for %s", self._volume_name)
logger.info("External Volume permission check failed, but permission checking is disabled in this version")
return False
@ -293,7 +293,7 @@ class VolumePermissionManager:
if result:
self._current_username = result[0]
return str(self._current_username)
except Exception as e:
except Exception:
logger.exception("Failed to get current username")
return "unknown"
@ -317,7 +317,7 @@ class VolumePermissionManager:
for grant in grants:
if len(grant) >= 3: # Typical format: (privilege, object_type, object_name, ...)
privilege = grant[0].upper()
object_type = grant[1].upper() if len(grant) > 1 else ""
_ = grant[1].upper() if len(grant) > 1 else ""
# Collect all relevant permissions
if privilege in ["SELECT", "INSERT", "UPDATE", "DELETE", "ALL"]:
@ -522,7 +522,7 @@ class VolumePermissionManager:
logger.warning("Unknown volume type for permission inheritance: %s", self._volume_type)
return False
except Exception as e:
except Exception:
logger.exception("Permission inheritance check failed")
return False