qdrant-operator 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/PKG-INFO +1 -1
  2. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/pyproject.toml +1 -1
  3. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/pyproject.toml.orig +1 -1
  4. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/helm_adapter.py +24 -3
  5. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/s3_adapter.py +14 -1
  6. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/LICENSE +0 -0
  7. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/README.md +0 -0
  8. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/__init__.py +0 -0
  9. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/container.py +0 -0
  10. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/domain.py +0 -0
  11. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/handlers.py +0 -0
  12. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/jwt_adapter.py +0 -0
  13. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/kubernetes_adapter.py +0 -0
  14. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/main.py +0 -0
  15. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/ports.py +0 -0
  16. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/py.typed +0 -0
  17. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/qdrant_adapter.py +0 -0
  18. {qdrant_operator-0.3.1 → qdrant_operator-0.3.2}/src/qdrant_operator/usecases.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qdrant-operator
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Kubernetes operator for Qdrant vector database
5
5
  Keywords: kubernetes,operator,qdrant,kopf,vector-database
6
6
  Author: Mohamed Tahrioui
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qdrant-operator"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "Kubernetes operator for Qdrant vector database"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "qdrant-operator"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "Kubernetes operator for Qdrant vector database"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -30,6 +30,7 @@ class HelmAdapter:
30
30
  chart_version: str,
31
31
  values: Mapping[str, Any],
32
32
  ) -> None:
33
+ await self.recover_pending(release_name, namespace)
33
34
  await self.run(
34
35
  "upgrade",
35
36
  "--install",
@@ -53,11 +54,31 @@ class HelmAdapter:
53
54
  logger.info("helm release uninstalled", release=release_name, namespace=namespace)
54
55
 
55
56
  async def release_exists(self, release_name: str, namespace: str) -> bool:
57
+ return bool(await self.release_status(release_name, namespace))
58
+
59
+ async def release_status(self, release_name: str, namespace: str) -> str:
60
+ """Helm's release status (deployed, failed, pending-upgrade, ...), empty when absent."""
56
61
  try:
57
- await self.run("status", release_name, "--namespace", namespace, "--output", "json")
62
+ output = await self.run(
63
+ "status", release_name, "--namespace", namespace, "--output", "json"
64
+ )
58
65
  except HelmError:
59
- return False
60
- return True
66
+ return ""
67
+ return str(json.loads(output).get("info", {}).get("status", ""))
68
+
69
+ async def recover_pending(self, release_name: str, namespace: str) -> None:
70
+ """Roll back a release another helm process left mid-operation, or every upgrade fails.
71
+
72
+ Helm refuses to touch a release in a pending-* state ("another operation is in
73
+ progress"); that state is what a killed operator leaves behind.
74
+ """
75
+ status = await self.release_status(release_name, namespace)
76
+ if not status.startswith("pending-"):
77
+ return
78
+ logger.warning(
79
+ "helm release left pending, rolling back", release=release_name, status=status
80
+ )
81
+ await self.run("rollback", release_name, "--namespace", namespace)
61
82
 
62
83
  async def run(self, *args: str, stdin: bytes | None = None) -> str:
63
84
  command = ["helm", *args, *self.kubeconfig_args()]
@@ -7,6 +7,7 @@ from dataclasses import dataclass
7
7
  from typing import Any
8
8
 
9
9
  import aioboto3
10
+ from boto3.s3.transfer import TransferConfig
10
11
  from botocore.config import Config
11
12
  from loguru import logger
12
13
 
@@ -14,6 +15,8 @@ from qdrant_operator.domain import S3Credentials
14
15
  from qdrant_operator.domain import S3StorageSpec
15
16
 
16
17
  DELETE_BATCH_SIZE = 1000
18
+ UPLOAD_PART_BYTES = 8 * 1024 * 1024
19
+ UPLOAD_CONCURRENCY = 2
17
20
 
18
21
 
19
22
  @dataclass
@@ -66,7 +69,17 @@ class S3Adapter:
66
69
  ) -> int:
67
70
  reader = ChunkReader(chunks, bytearray())
68
71
  async with self.client(storage, credentials) as s3:
69
- await s3.upload_fileobj(reader, storage.bucket, key)
72
+ await s3.upload_fileobj(
73
+ reader,
74
+ storage.bucket,
75
+ key,
76
+ Config=TransferConfig(
77
+ multipart_threshold=UPLOAD_PART_BYTES,
78
+ multipart_chunksize=UPLOAD_PART_BYTES,
79
+ max_concurrency=UPLOAD_CONCURRENCY,
80
+ max_io_queue=UPLOAD_CONCURRENCY,
81
+ ),
82
+ )
70
83
  logger.info("s3 upload complete", uri=storage.uri(key), bytes=reader.total)
71
84
  return reader.total
72
85
 
File without changes