Lab Service | Kamiwaza Docs

Documentation for Kamiwaza 0.9.3

This is documentation for Kamiwaza 0.9.3, which is no longer actively maintained. For the current GA release, see 1.0.1.

Version: 0.9.3

Overview

The Lab Service (LabService) provides comprehensive lab environment management for the Kamiwaza AI Platform. Located in kamiwaza_client/services/lab.py, this service handles the creation, management, and deletion of lab environments for development and experimentation.

Key Features

Lab Management

Available Methods

# 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:

  1. Cluster Service
    • For resource allocation
  2. Authentication Service
    • For access control
  3. 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

  1. Clean up unused labs
  2. Use descriptive lab names
  3. Monitor resource usage
  4. Implement proper error handling
  5. Set appropriate resource limits
  6. Document lab purposes
  7. Regular status checks
  8. Maintain lab inventory

Performance Considerations

Lab States

Labs can be in various states:

  1. Creating
    • Initial setup
    • Resource allocation
  2. Running
    • Fully operational
    • Resources allocated
  3. Stopping
    • Cleanup in progress
  4. Stopped
    • Resources released
  5. Failed
    • Setup or operation failed