Lab Service | Kamiwaza Docs
Documentation for Kamiwaza 0.12.0
This is documentation for Kamiwaza 0.12.0, which is no longer actively maintained. For the current GA release, see 1.0.1.
Overview
The Lab Service (LabService) provides comprehensive lab environment management for the Kamiwaza AI Platform. Located in kamiwaza_sdk/services/lab.py, this service handles the creation, management, and deletion of lab environments for development and experimentation.
Key Features
- Lab Environment Management
- Lab Creation and Deletion
- Lab Information Retrieval
- Resource Management
Lab Management
Available Methods
list_labs() -> List[Lab]: List all labscreate_lab(lab: CreateLab) -> Lab: Create new labget_lab(lab_id: UUID) -> Lab: Get lab infodelete_lab(lab_id: UUID) -> None: Delete lab
# List all labs
labs = client.lab.list_labs()
for lab in labs:
print(f"Lab: {lab.name} (ID: {lab.id})")
# Create new lab
lab = client.lab.create_lab(CreateLab(
name="development-lab",
description="Development environment",
resources={
"cpu": 4,
"memory": "16Gi",
"gpu": 1
}
))
# Get lab details
lab = client.lab.get_lab(lab_id)
print(f"Lab Status: {lab.status}")
print(f"Resources: {lab.resources}")
# Delete lab
client.lab.delete_lab(lab_id)
Integration with Other Services
The Lab Service works in conjunction with:
- Cluster Service
- For resource allocation
- Authentication Service
- For access control
- Activity Service
- For tracking lab usage
Error Handling
The service includes built-in error handling for common scenarios:
try:
lab = client.lab.create_lab(lab_config)
except ResourceError:
print("Insufficient resources")
except QuotaError:
print("Lab quota exceeded")
except APIError as e:
print(f"Operation failed: {e}")
Best Practices
- Clean up unused labs
- Use descriptive lab names
- Monitor resource usage
- Implement proper error handling
- Set appropriate resource limits
- Document lab purposes
- Regular status checks
- Maintain lab inventory
Performance Considerations
- Resource allocation affects startup time
- Concurrent lab limits
- Resource quotas
- Network bandwidth requirements
- Storage requirements
Lab States
Labs can be in various states:
- Creating
- Initial setup
- Resource allocation
- Running
- Fully operational
- Resources allocated
- Stopping
- Cleanup in progress
- Stopped
- Resources released
- Failed
- Setup or operation failed