This plugin provides integration with the CSCS Data Warehouse Data Intelligence (DWDI) system to report both computational and storage usage data to Waldur.
The plugin implements two separate backends to handle different types of accounting data:
cscs-dwdi-compute): Reports CPU and node hour usage from HPC clusterscscs-dwdi-storage): Reports storage space and inode usage from filesystemsThe compute backend queries the DWDI API for computational resource usage and reports:
API Endpoints Used:
/api/v1/compute/usage-month/account - Monthly usage data/api/v1/compute/usage-day/account - Daily usage dataThe storage backend queries the DWDI API for storage resource usage and reports:
API Endpoints Used:
/api/v1/storage/usage-month/filesystem_name/data_type - Monthly storage usage/api/v1/storage/usage-day/filesystem_name/data_type - Daily storage usagebackend_type: "cscs-dwdi-compute"
backend_settings:
cscs_dwdi_api_url: "https://dwdi.cscs.ch"
cscs_dwdi_client_id: "your_oidc_client_id"
cscs_dwdi_client_secret: "your_oidc_client_secret"
cscs_dwdi_oidc_token_url: "https://auth.cscs.ch/realms/cscs/protocol/openid-connect/token"
cscs_dwdi_oidc_scope: "openid" # Optional
backend_components:
nodeHours:
measured_unit: "node-hours"
unit_factor: 1
accounting_type: "usage"
label: "Node Hours"
cpuHours:
measured_unit: "cpu-hours"
unit_factor: 1
accounting_type: "usage"
label: "CPU Hours"
backend_type: "cscs-dwdi-storage"
backend_settings:
cscs_dwdi_api_url: "https://dwdi.cscs.ch"
cscs_dwdi_client_id: "your_oidc_client_id"
cscs_dwdi_client_secret: "your_oidc_client_secret"
cscs_dwdi_oidc_token_url: "https://auth.cscs.ch/realms/cscs/protocol/openid-connect/token"
# Storage-specific settings
storage_filesystem: "lustre"
storage_data_type: "projects"
storage_tenant: "cscs" # Optional
# Map Waldur resource IDs to storage paths
storage_path_mapping:
"project_123": "/store/projects/proj123"
"project_456": "/store/projects/proj456"
backend_components:
storage_space:
measured_unit: "GB"
unit_factor: 0.000000001 # Convert bytes to GB
accounting_type: "usage"
label: "Storage Space (GB)"
storage_inodes:
measured_unit: "count"
unit_factor: 1
accounting_type: "usage"
label: "File Count"
Both backends use OIDC client credentials flow for authentication with the DWDI API. You need:
cscs_dwdi_client_id: OIDC client identifiercscs_dwdi_client_secret: OIDC client secretcscs_dwdi_oidc_token_url: OIDC token endpoint URLcscs_dwdi_oidc_scope: OIDC scope (optional, defaults to “openid”)Both backends support SOCKS proxy for network connectivity. This is useful when the DWDI API is only accessible through a proxy or jump host.
Add the SOCKS proxy setting to your backend configuration:
backend_settings:
# ... other settings ...
socks_proxy: "socks5://localhost:12345" # SOCKS5 proxy URL
socks5://hostname:portsocks4://hostname:porthttp://hostname:portSSH Tunnel with SOCKS5:
# Create SSH tunnel to jump host
ssh -D 12345 -N user@jumphost.cscs.ch
# Configure backend to use tunnel
backend_settings:
socks_proxy: "socks5://localhost:12345"
HTTP Proxy:
backend_settings:
socks_proxy: "http://proxy.cscs.ch:8080"
For compute resources, the system uses account names as returned by the DWDI API. The Waldur resource
backend_id should match the account name in the cluster accounting system.
For storage resources, there are two options:
backend_id to the actual filesystem pathstorage_path_mapping setting to map resource IDs to pathsBoth backends are read-only and designed for usage reporting. They implement the _get_usage_report() method
but do not support:
See the examples/ directory for complete configuration examples:
cscs-dwdi-compute-config.yaml - Compute backend onlycscs-dwdi-storage-config.yaml - Storage backend onlycscs-dwdi-combined-config.yaml - Both backends in one configurationThe plugin is automatically discovered when the waldur-site-agent-cscs-dwdi package is installed alongside waldur-site-agent.
# Install all workspace packages including cscs-dwdi plugin
uv sync --all-packages
Run the test suite:
uv run pytest plugins/cscs-dwdi/tests/
This plugin is compatible with DWDI API version 1 (/api/v1/). It requires the following API endpoints to be available:
Compute API:
/api/v1/compute/usage-month/account/api/v1/compute/usage-day/accountStorage API:
/api/v1/storage/usage-month/filesystem_name/data_type/api/v1/storage/usage-day/filesystem_name/data_typestorage_filesystem and storage_data_type match available values in DWDIstorage_path_mapping if using custom resource IDsping() method to test API connectivitysocks_proxy setting)curl --proxy socks5://localhost:12345 https://dwdi.cscs.chplugins/cscs-dwdi/
├── pyproject.toml # Plugin configuration
├── README.md # This documentation
├── examples/ # Configuration examples
├── waldur_site_agent_cscs_dwdi/
│ ├── __init__.py # Package init
│ ├── backend.py # Backend implementations
│ └── client.py # CSCS-DWDI API client
└── tests/
└── test_cscs_dwdi.py # Plugin tests
CSCSDWDIComputeBackend: Compute usage reporting backendCSCSDWDIStorageBackend: Storage usage reporting backendCSCSDWDIClient: HTTP client for CSCS-DWDI API communicationTo extend the plugin:
CSCSDWDIClient to support more API endpointsclient.py