Skip to content

feat(BA-3150): Create Valkey client for artifact storages synchronization#6964

Closed
jopemachine wants to merge 16 commits into
mainfrom
feat/BA-3150
Closed

feat(BA-3150): Create Valkey client for artifact storages synchronization#6964
jopemachine wants to merge 16 commits into
mainfrom
feat/BA-3150

Conversation

@jopemachine

@jopemachine jopemachine commented Nov 27, 2025

Copy link
Copy Markdown
Member

resolves #6948 (BA-3150)

Checklist: (if applicable)

  • Mention to the original issue

📚 Documentation preview 📚: https://sorna--6964.org.readthedocs.build/en/6964/


📚 Documentation preview 📚: https://sorna-ko--6964.org.readthedocs.build/ko/6964/

@github-actions github-actions Bot added size:XL 500~ LoC comp:manager Related to Manager component comp:common Related to Common component labels Nov 27, 2025
@jopemachine jopemachine added this to the 25.18 milestone Nov 27, 2025
@jopemachine jopemachine marked this pull request as ready for review November 27, 2025 03:55
Copilot AI review requested due to automatic review settings November 27, 2025 03:55
Co-authored-by: octodog <mu001@lablup.com>
@github-actions github-actions Bot added the area:docs Documentations label Nov 27, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Valkey client for caching and synchronizing artifact storage configurations between the manager and storage-proxy components.

Key Changes:

  • Creates ValkeyArtifactStorageClient for caching object storage and VFS storage configurations
  • Moves ObjectStorageData and VFSStorageData types from manager-specific to common modules for shared access
  • Adds comprehensive test coverage for the new client functionality

Reviewed changes

Copilot reviewed 24 out of 28 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ai/backend/common/clients/valkey_client/valkey_artifact_storages/client.py Main client implementation with set/get/delete operations for both object and VFS storage types
src/ai/backend/common/clients/valkey_client/valkey_artifact_storages/__init__.py Package exports for the new client
src/ai/backend/common/data/object_storage/types.py Moved ObjectStorageData dataclass from manager to common for sharing
src/ai/backend/common/data/vfs_storage/types.py Moved VFSStorageData dataclass from manager to common for sharing
src/ai/backend/common/metrics/metric.py Added VALKEY_ARTIFACT_STORAGES layer type for metrics tracking
src/ai/backend/manager/services/vfs_storage/actions/*.py Updated imports to use common VFSStorageData
src/ai/backend/manager/services/object_storage/actions/*.py Updated imports to use common ObjectStorageData
src/ai/backend/manager/repositories/*/repository.py Updated imports for refactored data types
src/ai/backend/manager/repositories/*/db_source/db_source.py Updated imports for refactored data types
src/ai/backend/manager/models/*.py Updated imports for refactored data types
src/ai/backend/manager/api/gql/*.py Updated imports for refactored data types
src/ai/backend/manager/event_dispatcher/handlers/artifact_registry.py Updated imports for refactored data types
tests/common/clients/valkey_client/test_valkey_artifact_storage_client.py Comprehensive test suite covering all client operations
changes/6964.feature.md Changelog entry for the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

if "id" in data and isinstance(data["id"], str):
data["id"] = uuid.UUID(data["id"])
if "base_path" in data and isinstance(data["base_path"], str):
from pathlib import Path

Copilot AI Nov 27, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The Path import is done inline within the function, but Path is not imported at the module level. Consider adding from pathlib import Path at the top of the file with other imports to maintain consistency with import organization.

Copilot uses AI. Check for mistakes.
Comment thread changes/6964.feature.md
@@ -0,0 +1 @@
Add valkey client for artifact storages configuration sharing between manager and storage-proxy No newline at end of file

Copilot AI Nov 27, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog file is numbered 6964 but the PR description indicates this resolves issue #6948 (BA-3150). The changelog filename should match the GitHub issue number referenced in the PR.

Copilot uses AI. Check for mistakes.
return
self._closed = True
await self._client.disconnect()

Copilot AI Nov 27, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ping method is missing the @valkey_artifact_storages_resilience.apply() decorator that is applied to all other async methods in this class. This inconsistency means ping operations won't benefit from retry logic and metrics collection. Consider adding the decorator for consistency and resilience.

Suggested change
@valkey_artifact_storages_resilience.apply()

Copilot uses AI. Check for mistakes.
@jopemachine jopemachine marked this pull request as draft November 27, 2025 08:51
@jopemachine jopemachine marked this pull request as ready for review November 27, 2025 23:17
Comment on lines +182 to +187
@valkey_artifact_storages_resilience.apply()
async def set_vfs_storage(
self,
storage_id: uuid.UUID,
storage_data: VFSStorageStatefulData,
) -> None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems better to group VFSStorageStatefulData and ObjectStorageStatefulData into a common ABC and store values with hset, rather than storing each object storage separately.
The current method seems to lack scalability.

Comment thread src/ai/backend/common/clients/valkey_client/valkey_artifact_storages/client.py Outdated
Comment thread src/ai/backend/common/clients/valkey_client/valkey_artifact_storages/client.py Outdated
Comment thread src/ai/backend/common/clients/valkey_client/valkey_artifact_storages/client.py Outdated
Comment thread src/ai/backend/common/data/storage/types.py Outdated
@jopemachine jopemachine marked this pull request as draft December 1, 2025 04:34
@jopemachine

jopemachine commented Dec 5, 2025

Copy link
Copy Markdown
Member Author

It will be replaced by another PR
#7140

@jopemachine jopemachine closed this Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Valkey client for artifact storage synchronization

3 participants