add script and make while we're at it for os clear
This commit is contained in:
parent
19c96140a6
commit
8afd2e4d45
2 changed files with 40 additions and 0 deletions
4
Makefile
4
Makefile
|
|
@ -376,6 +376,10 @@ db-reset:
|
||||||
curl -X DELETE "http://localhost:9200/knowledge_filters" -u admin:$${OPENSEARCH_PASSWORD} || true
|
curl -X DELETE "http://localhost:9200/knowledge_filters" -u admin:$${OPENSEARCH_PASSWORD} || true
|
||||||
@echo "Indices reset. Restart backend to recreate."
|
@echo "Indices reset. Restart backend to recreate."
|
||||||
|
|
||||||
|
clear-os-data:
|
||||||
|
@echo "🧹 Clearing OpenSearch data directory..."
|
||||||
|
@uv run python scripts/clear_opensearch_data.py
|
||||||
|
|
||||||
# Flow management
|
# Flow management
|
||||||
flow-upload:
|
flow-upload:
|
||||||
@echo "📁 Uploading flow to Langflow..."
|
@echo "📁 Uploading flow to Langflow..."
|
||||||
|
|
|
||||||
36
scripts/clear_opensearch_data.py
Normal file
36
scripts/clear_opensearch_data.py
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Clear OpenSearch data directory using container with proper permissions."""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Add parent directory to path to import from src
|
||||||
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
|
from src.tui.managers.container_manager import ContainerManager
|
||||||
|
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
"""Clear OpenSearch data directory."""
|
||||||
|
cm = ContainerManager()
|
||||||
|
|
||||||
|
opensearch_data_path = Path("opensearch-data")
|
||||||
|
if not opensearch_data_path.exists():
|
||||||
|
print("opensearch-data directory does not exist")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
print("Clearing OpenSearch data directory...")
|
||||||
|
|
||||||
|
async for success, message in cm.clear_opensearch_data_volume():
|
||||||
|
print(message)
|
||||||
|
if not success and "failed" in message.lower():
|
||||||
|
return 1
|
||||||
|
|
||||||
|
print("✅ OpenSearch data cleared successfully")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
exit_code = asyncio.run(main())
|
||||||
|
sys.exit(exit_code)
|
||||||
Loading…
Add table
Reference in a new issue