| Crates.io | lab-resource-manager |
| lib.rs | lab-resource-manager |
| version | 1.0.0 |
| created_at | 2025-10-26 22:38:41.142118+00 |
| updated_at | 2026-01-13 20:56:17.166198+00 |
| description | GPU and room resource management system with Google Calendar and Slack integration |
| homepage | |
| repository | https://github.com/kano-lab/lab-resource-manager |
| max_upload_size | |
| id | 1901967 |
| size | 422,684 |
GPU and room resource usage management and notification system.
0-2,5,7-9This project follows Clean Architecture principles:
src/
├── domain/ # Domain layer (business logic)
│ ├── aggregates/ # Aggregates (ResourceUsage, IdentityLink)
│ ├── common/ # Shared Kernel (EmailAddress, etc.)
│ ├── ports/ # Ports (Repository, Notifier, ResourceCollectionAccess traits)
│ └── errors.rs # Domain errors
├── application/ # Application layer (use cases)
│ └── usecases/ # Notify, GrantAccess use cases
├── infrastructure/ # Infrastructure layer (external integrations)
│ ├── repositories/ # Repository implementations (Google Calendar, JSON file, etc.)
│ │ ├── resource_usage/ # ResourceUsage repository implementations
│ │ └── identity_link/ # IdentityLink repository implementations
│ ├── notifier/ # Notifier implementations (Slack, Mock, etc.)
│ ├── resource_collection_access/ # Access control service implementations (Google Calendar, etc.)
│ └── config/ # Configuration management
├── interface/ # Interface layer (adapters)
│ └── slack/ # Slack bot (Socket Mode + command handlers)
└── bin/ # Entry points
└── lab-resource-manager.rs # Slack bot for resource access management
For detailed setup instructions, see the Administrator Guide.
Download the latest release from GitHub Releases:
# Download and extract
curl -LO https://github.com/kano-lab/lab-resource-manager/releases/latest/download/lab-resource-manager-x86_64-unknown-linux-gnu.tar.gz
tar -xzf lab-resource-manager-x86_64-unknown-linux-gnu.tar.gz
# Install (requires root)
sudo bash deploy/install.sh
This installs:
/usr/local/bin/lab-resource-manager/etc/lab-resource-manager//var/lib/lab-resource-manager/cargo build --release
If upgrading from a Docker-based deployment, see Migration Guide.
# Default (repository implementation + configured notifications)
cargo run --bin watcher
# Use mock repository (for testing)
cargo run --bin watcher --repository mock
# Customize polling interval (default: 60 seconds)
cargo run --bin watcher --interval 30
--repository <google_calendar|mock>: Select repository implementation--interval <seconds>: Set polling intervalNotifier implementations are configured per resource in config/resources.toml.
The Slack bot allows users to register their email addresses and get access to all resource collections:
# Run the bot
cargo run --bin lab-resource-manager
Slack Commands:
/register-calendar <your-email@example.com> - Register your own email address and link to your Slack account/link-user <@slack_user> <email@example.com> - Link another user's email address to their Slack accountAdd to your Cargo.toml:
[dependencies]
lab-resource-manager = "0.1"
Example code (using Google Calendar implementation):
use lab_resource_manager::prelude::*;
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Load configuration
let config = load_config("config/resources.toml")?;
// Create repository implementation (using Google Calendar here)
let repository = GoogleCalendarUsageRepository::new(
"secrets/service-account.json",
config.clone(),
PathBuf::from("data/google_calendar_mappings.json"),
).await?;
// Create notification router (automatically handles all configured notifier implementations)
let notifier = NotificationRouter::new(config);
// Create and run use case
let usecase = NotifyResourceUsageChangesUseCase::new(repository, notifier).await?;
usecase.poll_once().await?;
Ok(())
}
See examples/ for more usage patterns.
# All tests
cargo test
# Specific module
cargo test resource_factory
# With output
cargo test -- --nocapture
# Development build
cargo build
# Release build
cargo build --release
cargo check
cargo clippy
cargo fmt
In resource usage titles, you can specify devices using the following formats:
0 → Device 00-2 → Devices 0, 1, 20,2,5 → Devices 0, 2, 50-1,6-7 → Devices 0, 1, 6, 7The ResourceFactory in the domain layer handles parsing these specifications.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Developed for laboratory resource management at Kano Lab.