Repository navigation
Expand file tree
/
Copy pathcoldfront-exporter-config.toml.example
More file actions
294 lines (265 loc) · 14.5 KB
/
Copy pathcoldfront-exporter-config.toml.example
File metadata and controls
294 lines (265 loc) · 14.5 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# coldfront-exporter-config.toml.example
#
# Example config for exporting ColdFront v1 database to yaml.
#
# Load order: --config <path> > env COLDFRONT_EXPORTER_CONFIG > ./coldfront-exporter-config.toml
# Every section is optional. Missing section = export all (no filtering).
# ---------------------------------------------------------------------------
# [export] — global pipeline settings
# ---------------------------------------------------------------------------
[export]
output_dir = "coldfront_yaml" # optional; overridden by --output on the command
overwrite = false # false = skip existing .yml files (current behavior)
timezone = "UTC" # used by base.py settings.configure (USE_TZ / TIME_ZONE)
# exporters = ["users", "groups", "projects", "allocations"] # run only these exporters
# exclude = ["slurm_accounts", "slurm_associations", "storage_quotas"] # skip these
# ---------------------------------------------------------------------------
# [models.<ModelName>] — global selection filters applied to Django querysets.
# Key = literal Django model name (User, Group, Project, Allocation, ResourceType, Resource, Publication, Grant).
# include / exclude are lists of clause dicts:
# field - model field or related lookup ("project__status__name")
# lookup - Django lookup (default "exact"; icontains, startswith, in, gt, lt, isnull, ...)
# value - scalar or list (for "in")
# Semantics: include clauses AND-ed; exclude clauses OR-ed;
# final = include AND NOT(OR exclude). If neither set -> export all.
# ---------------------------------------------------------------------------
[models.User]
# exclude = [{ field = "username", value = "admin" }]
# model = "django.contrib.auth.models.User" # optional: override the v1 model class
# (sites with customized schemas point the exporter at their actual class)
[models.Group]
# include = [{ field = "name", lookup = "startswith", value = "grp-" }]
[models.Project]
include = [{ field = "status__name", value = "Active" }] # the 2 active test projects
# exclude = [{ field = "title", value = "test" }]
[models.Allocation]
include = [
{ field = "status__name", value = "Active" },
{ field = "project__status__name", value = "Active" },
]
# Only generic ResourceTypes go to resources.yml; skip ones that map to
# dedicated v2 models loaded from slurm.conf / storage pipelines.
[models.ResourceType]
exclude = [
{ field = "name", value = "Cluster" },
{ field = "name", value = "Cluster Partition" },
{ field = "name", value = "Storage" },
]
[models.Resource]
exclude = [
{ field = "resource_type__name", value = "Cluster" },
{ field = "resource_type__name", value = "Cluster Partition" },
{ field = "resource_type__name", value = "Storage" },
]
# ---------------------------------------------------------------------------
# [exporters.<name>] — one per output YAML file.
# [exporters.<name>.model] — the v1 model this exporter loops over.
# name - literal Django model name (e.g. "Allocation")
# include - ADDITIONAL include clauses (AND-ed onto global [models.<Name>] include)
# exclude - ADDITIONAL exclude clauses (OR-ed onto global [models.<Name>] exclude)
# Effective queryset = global [models.<Name>] AND include AND NOT(OR exclude)
# Other scalar keys (e.g. share_type) are exporter options.
# [exporters.<name>.attributes] — v1 attribute -> v2 field/parse on the emitted record.
# field - v2 field or dotted path (e.g. attribute_data.x)
# parse - optional parse strategy: "regex" (uses pattern)
# pattern - regex for "regex"
# convert - optional unit conversion: "gb_to_bytes"
# format - optional format strategy: "cluster:name"
# [exporters.users.roles] / [exporters.groups.roles] — attach v2 role names
# to user/group records. Keys = literal v1 username / group name; value is a
# LIST of role names. Roles themselves are loaded separately (roles.yml);
# the exporter only emits the role strings, which the initializer resolves.
# ---------------------------------------------------------------------------
# --- users ---------------------------------------------------------------
[exporters.users]
# ignore_passwords = true # omit password_hash so initializer sets unusable password
# (sites with external authentication must not import v1 hashes)
[exporters.users.model]
name = "User"
[exporters.users.roles] # username -> list of v2 role name(s)
# "admin" = ["center_director"]
# "bob" = ["reviewer", "center_director"]
# --- groups --------------------------------------------------------------
[exporters.groups]
[exporters.groups.model]
name = "Group"
[exporters.groups.roles] # group name -> list of v2 role name(s)
# "pi" = ["principal_investigator"]
# --- resource_types ------------------------------------------------------
[exporters.resource_types]
[exporters.resource_types.model]
name = "ResourceType"
# --- resources -----------------------------------------------------------
# loops v1 Resource (top-level + children via parent_resource); emits generic v2 Resource records
[exporters.resources]
[exporters.resources.model]
name = "Resource"
[exporters.resources.attributes]
slurm_cluster = { field = "attribute_data.slurm_cluster" }
slurm_specs = { field = "attribute_data.slurm_specs" }
# --- projects ------------------------------------------------------------
[exporters.projects]
[exporters.projects.model]
name = "Project"
# --- allocations ----------------------------------------------------------
[exporters.allocations]
[exporters.allocations.model]
name = "Allocation"
# NOTE: v2 Allocation.attribute_data is NOT configured here. It must conform to
# the schema of the allocation's resource, so it's left to site hooks
# (post_serialize on Allocation) to decide what to emit.
# --- slurm_accounts -------------------------------------------------------
# v1 model = Allocation; emits v2 SlurmAccount records (only Cluster Partition allocations)
[exporters.slurm_accounts]
[exporters.slurm_accounts.model]
name = "Allocation"
include = [{ field = "resources__resource_type__name", value = "Cluster Partition" }]
[exporters.slurm_accounts.attributes]
slurm_account_name = { field = "name" } # -> SlurmAccount.name
slurm_specs = { field = "qos", parse = "regex", pattern = "QOS\\+?=(\\w+):?" }
# --- slurm_associations ----------------------------------------------------
# v1 model = Allocation; emits v2 SlurmAssociation records
[exporters.slurm_associations]
[exporters.slurm_associations.model]
name = "Allocation"
include = [{ field = "resources__resource_type__name", value = "Cluster Partition" }]
[exporters.slurm_associations.attributes]
slurm_user_specs = { field = "fairshare", parse = "regex", pattern = "Fairshare=(\\d+):?" }
slurm_account_name = { field = "slurm_account", format = "cluster:name" }
# --- storage_quotas --------------------------------------------------------
# v1 model = Allocation; emits v2 StorageQuota records (only Storage allocations)
[exporters.storage_quotas]
share_type = "nfs" # replaces StaticField(value="nfs")
[exporters.storage_quotas.model]
name = "Allocation"
include = [{ field = "resources__resource_type__name", value = "Storage" }]
[exporters.storage_quotas.attributes]
"Storage directory name" = { field = "path" }
"Storage Quota (GB)" = { field = "hard_limit_bytes", convert = "gb_to_bytes" }
# --- publications ----------------------------------------------------------
# v1 model = Publication; emits v2 ris.Publication records keyed by DOI.
# Records sharing a DOI are merged and their project slugs aggregated.
[exporters.publications]
# Map v1 PublicationSource.name -> v2 provider registry key.
# Keys are LITERAL v1 source names; "default" is the fallback.
# v2 keys: crossref, orcid, nsf, local, manual.
# source = { "doi" = "crossref", "manual" = "manual", default = "crossref" }
[exporters.publications.model]
name = "Publication"
# --- funding ----------------------------------------------------------------
# v1 model = Grant; emits v2 ris.Funding records keyed by (award_number, funding_agency).
[exporters.funding]
source = "nsf" # v2 provider registry key for all exported grants
# currency = "USD" # currency code appended to amount_awarded
[exporters.funding.model]
name = "Grant"
# ---------------------------------------------------------------------------
# [mappings.resource_names] — how to render v2 `resource_object` references.
# Keys = LITERAL v1 ResourceType.name (arbitrary per site).
# The v2 objects themselves are NOT exported here; they're loaded separately
# (e.g. slurm.conf -> SlurmCluster/SlurmPartition). This mapping only translates
# a v1 Resource into the v2 object string so allocations.yml can reference it.
# model - v2 content-type string ("slurm.slurmpartition", "ras.resource", ...)
# name - v2 name rule:
# "{name}" keep v1 name
# "literal" fixed v2 name
# { attribute = "slurm_cluster" } from a v1 resource attribute
# { transform = "lower_strip", strip = [...] } built-in transform
# { func = "dotted.path" } callable
# slug - optional slug template "{cluster}-{name}" (always slugify-ed)
# identifier - how to address the object: "name" | "slug"
# ("name" -> ":<name>", "slug" -> ":slug=<slug>"; matches initializer parser)
# cluster_name - for partitions: "parent" = resolve the v1 parent's name through
# its Cluster rule if one exists, else fall back to raw v1 parent name.
# Unlisted types fall back to ras.resource:{name}.
# ---------------------------------------------------------------------------
[mappings.resource_names]
[mappings.resource_names."Cluster"]
model = "slurm.slurmcluster"
name = { attribute = "slurm_cluster" } # dataset attr: "university-hpc", "chemistry", ...
identifier = "name"
# alt: name = { transform = "lower_strip", strip = [" Cluster"] } # "University HPC" -> "university hpc"
[mappings.resource_names."Cluster Partition"]
model = "slurm.slurmpartition"
name = { transform = "lower_strip", strip = [" Partition"] } # e.g. "Chemistry-cgray" -> "chemistry-cgray"
slug = "{cluster}-{name}"
identifier = "slug"
cluster_name = "parent" # {cluster} = parent's name via Cluster rule, else raw v1 parent name
[mappings.resource_names."Storage"]
model = "storage.storageresource"
name = "{name}" # "Budgetstorage", "ProjectStorage", "University Cloud Storage"
identifier = "name"
[mappings.resource_names."Cloud"]
model = "ras.resource"
name = "{name}" # "University Cloud"
identifier = "name"
[mappings.resource_names."Server"]
model = "ras.resource"
name = "{name}" # "server-cgray", "server-sfoster"
identifier = "name"
# unlisted types -> ras.resource:{name}
# ---------------------------------------------------------------------------
# [mappings.resource_overrides] — per-resource-name exceptions.
# Key = LITERAL v1 Resource.name (unique). Checked FIRST, before the type table.
# Supports: map a specific resource to a different v2 model AND/OR rename it.
# ---------------------------------------------------------------------------
# [mappings.resource_overrides]
# [mappings.resource_overrides."Faculty Cluster"]
# model = "slurm.slurmcluster"
# name = "faculty2"
#
# [mappings.resource_overrides."UB-HPC Academic Partitions"]
# model = "slurm.slurmcluster"
# name = "ub-hpc"
# ---------------------------------------------------------------------------
# [mappings.statuses.<Model>] — v1 status name -> v2 status string.
# Keys = LITERAL v1 status-choice names. "default" is the fallback.
# ---------------------------------------------------------------------------
[mappings.statuses.Allocation]
new = "requested"
active = "active"
denied = "denied"
expired = "expired"
approved = "approved"
revoked = "revoked"
"renewal requested" = "renew"
"inactive (renewed)" = "renew"
default = "renew"
# ---------------------------------------------------------------------------
# [mappings.statuses.<Model>] — v1 status name -> v2 status string.
# Keys = LITERAL v1 status-choice names. "default" is the fallback.
# ---------------------------------------------------------------------------
[mappings.statuses.Funding]
active = "active"
archived = "archived"
pending = "pending"
default = "active"
# ---------------------------------------------------------------------------
# [mappings.slugs] — slug rules. Two forms:
# format string with "{...}" placeholders -> supports ONLY {value} and {id}
# ({value} = the slug field, e.g. project title / resource name; {id} = primary key)
# allocations support only {id}. Any other placeholder falls back to the field slug.
# table { func = "dotted.path", ... } -> callable slug_func(instance, config) -> str
# (use this form for full access to any instance attribute)
# ---------------------------------------------------------------------------
[mappings.slugs]
allocation = "a{id:07d}" # current: slugify("a"+str(id).zfill(7))
project = { func = "coldfront_exporter_v1.slugs.slugify", field = "title" }
resource = { func = "coldfront_exporter_v1.slugs.slugify", field = "name" }
# custom: project = { func = "my_site.custom_project_slug" }
# ---------------------------------------------------------------------------
# [hooks.<exporter>] — ordered dotted-path python functions at each stage, keyed
# by EXPORTER NAME (the registry key / output file name), NOT by v1 model.
# Stages: pre_filter(queryset), post_filter(queryset),
# pre_serialize(instance)->dict, post_serialize(record, instance)->record,
# post_export(records)->records.
# Default hooks (UB behavior) live in the exporter classes; sites can disable or append.
# Because hooks are keyed by exporter, [hooks.slurm_accounts] fires only for
# slurm_accounts, not for allocations/associations/storage_quotas.
# ---------------------------------------------------------------------------
[hooks.projects]
# post_serialize = ["my_site.hooks.project_add_tags"]
[hooks.allocations]
# post_serialize = ["my_site.hooks.allocation_add_custom_fields"] # e.g. emit attribute_data
# [hooks.slurm_accounts]
# post_serialize = ["my_site.hooks.slurm_account_tag"]