The PATh Credit Accounting Service
keeps track of computing usage
for users with an allocation
on PATh hardware.
This repository contains collections of scripts and Elasticsearch templates
along with the cas_admin
commandline tool and Python library.
The CLI tool allows PATh admins to create accounts,
to add credits to accounts,
and to keep tabs on accounts.
The Python library provides functions
for calculating charges
and sending email reports to
account owners and PATh admins.
The cas_admin
tool provides the
administrative interface for adding, modifying, and viewing credit accounts
Available commands are:
cas_admin get accounts
- View credit account(s)cas_admin create account
- Create a credit accountcas_admin edit account
- Modify a credit account's owner or emailcas_admin add credits
- Add credits to a credit accountcas_admin get charges
- View credit charges for a given date
To get help on any of these commands, add --help
after the command, for example:
$ cas_admin create account --help
List accounts
$ cas_admin get accounts
Name Owner Project CpuCredits CpuCharges PctCpuUsed CpuRemain GpuCredits GpuCharges PctGpuUsed GpuRemain
PATh-Staff-Testing Jason Patton CHTC 1,100.0 69.4 6.3% 1,030.6 0.0 0.0 0.0% 0.0
Create a new account "AliceGroup" for account owner "Alice Smith" with CPU credits
$ cas_admin create account AliceGroup --owner "Alice Smith" --project ABC123 --email [email protected] --cpu_credits 50
account AliceGroup added.
Create a new account "AliceGroup" for account owner "Alice Smith" with CPU and GPU credits
$ cas_admin create account AliceGroup --owner "Alice Smith" --project ABC123 --email [email protected] --cpu_credits 50 --gpu_credits 50
account AliceGroup added.
List detailed information for account "AliceGroup"
$ cas_admin get accounts --name AliceGroup
Account Name: AliceGroup
Owner: Alice Smith
Owner Email: [email protected]
Owner Project: ABC123
CPU Credits: 50.00
CPU Charges: 0.00
Pct CPU Credits Used: 0.00%
CPU Credits Remaining: 50.00
GPU Credits: 0.00
GPU Charges: 0.00
Pct GPU Credits Used: 0.00%
GPU Credits Remaining: 0.00
Add 25 CPU credits to account "AliceGroup"
$ cas_admin add credits AliceGroup cpu 25
Account AliceGroup updated.
Remove 10 CPU credits from account "AliceGroup"
$ cas_admin add credits AliceGroup cpu -- -10
Account AliceGroup updated.
List all charges from Aug 23, 2022
$ cas_admin get charges --date 2022-08-23
Date Account User JobType Resource Charge
2022-08-23 PATh-Staff-Testing [email protected] cpu cpu 7.5
2022-08-23 PATh-Staff-Testing [email protected] cpu memory 0.0