lablup / lablup/backend.ai

Implement bulk user purge functionality across all layers

Open
#6,033 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Overview

Implement bulk user purge functionality to allow administrators to efficiently purge multiple users at once. This feature will be implemented across the GraphQL API, service, and repository layers.

## Background

Currently, the system only supports purging users one at a time through the `PurgeUser` mutation. For administrative efficiency, we need to support bulk operations that can purge multiple users in a single request.

## Architecture

The implementation will follow the existing layered architecture:

- **GraphQL Layer**: New Strawberry-based mutation in `/src/ai/backend/manager/api/gql`
- **Service Layer**: New bulk action in `/src/ai/backend/manager/services/user/service.py`
- **Repository Layer**: Efficient batch processing for database operations

## Key Requirements

1. Atomic operations - all users are purged or none (transaction safety)
1. Performance optimization for bulk operations
1. Comprehensive error handling and reporting
1. Maintain consistency with existing purge_user behavior
1. Support the same vFolder treatment policies as single user purge

## Implementation Tasks

- [ ] Create BulkPurgeUser GraphQL mutation using Strawberry
- [ ] Implement bulk_purge_user service action
- [ ] Add repository methods for efficient bulk user purging
- [ ] Add comprehensive tests for all layers
- [ ] Update API documentation

## Acceptance Criteria

- Administrators can purge multiple users in a single API call
- The operation is transactionally safe
- Performance is optimized for bulk operations
- Error handling provides clear feedback for partial failures
- All existing purge policies (vFolder treatment, endpoint delegation) are supported

JIRA Issue: BA-2510

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.