-
Notifications
You must be signed in to change notification settings - Fork 0
/
local.py
49 lines (39 loc) · 1.51 KB
/
local.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import pwd
"""
This example is using MagicCastle and FreeIPA
https://github.com/ComputeCanada/magic_castle/
"""
def compute_allocations_by_user(username):
"""
return the compute allocations for a user as a list of dictionaries with the following keys:
- name: the name of the allocation
- cpu: the number of cpu allocated to the user (optional)
- gpu: the number of gpu allocated to the user (optional)
"""
return [{'name': 'def-sponsor00', 'cpu': 1, }]
def compute_allocations_by_account(account):
"""
return the compute allocations for a user as a list of dictionaries with the following keys:
- name: the name of the allocation
- cpu: the number of cpu allocated to the user (optional)
- gpu: the number of gpu allocated to the user (optional)
"""
return [{'name': 'def-sponsor00', 'cpu': 1, }]
def storage_allocations(username):
"""
return the storage allocations for a user as a list of dictionaries with the following keys:
- name: the name of the allocation
- type: the type of the allocation (home, scratch, project or nearline as an example)
- quota_bytes: the size of the allocation in bytes
- quota_inodes: the inodes quota of the allocation
"""
return [{'name': 'def-sponsor00', 'type': 'home', 'quota_bytes': 1000000000000, 'quota_inodes': 1000000}]
#def username_to_uid(username):
# """return the uid of a username"""
# return 60005
#
#
#def uid_to_username(uid):
# """return the username of a uid"""
# return "user01"
#