datavo-cli 0.22.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datavo_cli/__init__.py +3 -0
- datavo_cli/client_factory.py +172 -0
- datavo_cli/commands/__init__.py +36 -0
- datavo_cli/commands/auth.py +94 -0
- datavo_cli/commands/config.py +93 -0
- datavo_cli/commands/dataset.py +198 -0
- datavo_cli/commands/events.py +48 -0
- datavo_cli/commands/jobpool.py +50 -0
- datavo_cli/commands/sample.py +29 -0
- datavo_cli/commands/sample_store.py +97 -0
- datavo_cli/commands/source_import.py +38 -0
- datavo_cli/commands/split_set.py +79 -0
- datavo_cli/commands/stats.py +22 -0
- datavo_cli/commands/team.py +191 -0
- datavo_cli/commands/user.py +67 -0
- datavo_cli/config_store.py +200 -0
- datavo_cli/diagnostics.py +77 -0
- datavo_cli/errors.py +49 -0
- datavo_cli/main.py +90 -0
- datavo_cli/parsers.py +411 -0
- datavo_cli/render.py +390 -0
- datavo_cli/utils.py +55 -0
- datavo_cli-0.22.0.dist-info/METADATA +51 -0
- datavo_cli-0.22.0.dist-info/RECORD +28 -0
- datavo_cli-0.22.0.dist-info/WHEEL +5 -0
- datavo_cli-0.22.0.dist-info/entry_points.txt +2 -0
- datavo_cli-0.22.0.dist-info/licenses/LICENSE +201 -0
- datavo_cli-0.22.0.dist-info/top_level.txt +1 -0
datavo_cli/parsers.py
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _add_format_argument(parser: argparse.ArgumentParser) -> None:
|
|
7
|
+
parser.add_argument("--format", choices=("plain", "json"), default="plain", help="output format")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _add_key_group_argument(parser: argparse.ArgumentParser) -> None:
|
|
11
|
+
parser.add_argument("--key-group", action="append", dest="key_groups", help="repeatable key group selector")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def build_root_parser() -> argparse.ArgumentParser:
|
|
15
|
+
parser = argparse.ArgumentParser(description="Datavo CLI", formatter_class=argparse.RawTextHelpFormatter)
|
|
16
|
+
parser.add_argument(
|
|
17
|
+
"--verbose",
|
|
18
|
+
"-v",
|
|
19
|
+
action="store_true",
|
|
20
|
+
help="show full error detail (raw response body) — also via DATAVO_VERBOSE=1",
|
|
21
|
+
)
|
|
22
|
+
subparsers = parser.add_subparsers(dest="command")
|
|
23
|
+
|
|
24
|
+
config = subparsers.add_parser("config", help="manage CLI profiles")
|
|
25
|
+
config_sub = config.add_subparsers(dest="config_command")
|
|
26
|
+
config_show = config_sub.add_parser("show", help="show the active or selected profile")
|
|
27
|
+
config_show.add_argument("profile", nargs="?", help="optional profile name")
|
|
28
|
+
_add_format_argument(config_show)
|
|
29
|
+
config_list = config_sub.add_parser("list", help="list profiles")
|
|
30
|
+
_add_format_argument(config_list)
|
|
31
|
+
config_use = config_sub.add_parser("use", help="set the active profile")
|
|
32
|
+
config_use.add_argument("profile", help="profile name")
|
|
33
|
+
_add_format_argument(config_use)
|
|
34
|
+
config_set = config_sub.add_parser("set", help="create or update a profile")
|
|
35
|
+
config_set.add_argument("profile", nargs="?", help="profile name (defaults to the URL hostname)")
|
|
36
|
+
config_set.add_argument("--url", required=True, help="Datavo API base URL")
|
|
37
|
+
_add_format_argument(config_set)
|
|
38
|
+
config_remove = config_sub.add_parser("remove", help="remove a profile")
|
|
39
|
+
config_remove.add_argument("profile", help="profile name")
|
|
40
|
+
_add_format_argument(config_remove)
|
|
41
|
+
|
|
42
|
+
auth = subparsers.add_parser("auth", help="manage authentication")
|
|
43
|
+
auth_sub = auth.add_subparsers(dest="auth_command")
|
|
44
|
+
auth_login = auth_sub.add_parser("login", help="log in")
|
|
45
|
+
auth_login.add_argument("--token", help="store a bearer token directly")
|
|
46
|
+
auth_login.add_argument("--msal", action="store_true", help="log in via MSAL (interactive browser by default; set DATAVO_MSAL_DEVICE_FLOW=1 to use device code)")
|
|
47
|
+
auth_login.add_argument("--msal-browser", action="store_true", help="force MSAL interactive browser flow (no device-code fallback)")
|
|
48
|
+
auth_login.add_argument("--tenant-id", help="Entra tenant id override")
|
|
49
|
+
auth_login.add_argument("--client-id", help="Entra public client id override")
|
|
50
|
+
auth_login.add_argument("--scope", action="append", help="repeatable MSAL scope override")
|
|
51
|
+
_add_format_argument(auth_login)
|
|
52
|
+
auth_status = auth_sub.add_parser("status", help="show current auth state")
|
|
53
|
+
_add_format_argument(auth_status)
|
|
54
|
+
auth_logout = auth_sub.add_parser("logout", help="clear the stored token and MSAL cache")
|
|
55
|
+
_add_format_argument(auth_logout)
|
|
56
|
+
|
|
57
|
+
sample_store = subparsers.add_parser("sample-store", help="manage sample stores")
|
|
58
|
+
sample_store_sub = sample_store.add_subparsers(dest="sample_store_command")
|
|
59
|
+
sample_store_create = sample_store_sub.add_parser("create", help="create a sample store")
|
|
60
|
+
sample_store_create.add_argument("name", help="sample store name")
|
|
61
|
+
sample_store_create.add_argument("--hidden", action="store_true", help="hide from default catalog lists")
|
|
62
|
+
sample_store_create.add_argument(
|
|
63
|
+
"--team", help="owning team (default: your default team)"
|
|
64
|
+
)
|
|
65
|
+
_add_format_argument(sample_store_create)
|
|
66
|
+
sample_store_list = sample_store_sub.add_parser("list", help="list sample stores")
|
|
67
|
+
sample_store_list.add_argument("--query", "-q", help="name search")
|
|
68
|
+
sample_store_list.add_argument("--include-archived", action="store_true", help="include archived stores")
|
|
69
|
+
sample_store_list.add_argument("--include-hidden", action="store_true", help="include hidden stores")
|
|
70
|
+
_add_format_argument(sample_store_list)
|
|
71
|
+
sample_store_get = sample_store_sub.add_parser("get", help="get sample store details")
|
|
72
|
+
sample_store_get.add_argument("name", help="sample store name")
|
|
73
|
+
_add_format_argument(sample_store_get)
|
|
74
|
+
sample_store_delete = sample_store_sub.add_parser("delete", help="delete a sample store")
|
|
75
|
+
sample_store_delete.add_argument("name", help="sample store name")
|
|
76
|
+
_add_format_argument(sample_store_delete)
|
|
77
|
+
sample_store_transfer = sample_store_sub.add_parser("transfer", help="transfer a whole sample store")
|
|
78
|
+
sample_store_transfer.add_argument("source", help="source sample store name")
|
|
79
|
+
sample_store_transfer.add_argument("--target", required=True, help="target sample store name")
|
|
80
|
+
sample_store_transfer.add_argument("--keep-source", action="store_true", help="leave the emptied source store in place")
|
|
81
|
+
sample_store_transfer.add_argument("--reason", help="transfer reason")
|
|
82
|
+
sample_store_transfer.add_argument("--event-id", dest="created_event_id", help="existing event to link")
|
|
83
|
+
sample_store_transfer.add_argument("--idempotency-key", help="idempotency key")
|
|
84
|
+
_add_format_argument(sample_store_transfer)
|
|
85
|
+
|
|
86
|
+
sample_store_copy = sample_store_sub.add_parser(
|
|
87
|
+
"copy",
|
|
88
|
+
help="copy a bounded set of samples into a brand-new store (quick tests / seeding)",
|
|
89
|
+
)
|
|
90
|
+
sample_store_copy.add_argument("target", help="new sample store name (must not exist)")
|
|
91
|
+
copy_source = sample_store_copy.add_mutually_exclusive_group(required=True)
|
|
92
|
+
copy_source.add_argument("--source-store", help="copy from this sample store")
|
|
93
|
+
copy_source.add_argument("--source-dataset", help="copy from this dataset (name or id)")
|
|
94
|
+
sample_store_copy.add_argument(
|
|
95
|
+
"--has-key",
|
|
96
|
+
dest="has_keys",
|
|
97
|
+
action="append",
|
|
98
|
+
default=[],
|
|
99
|
+
help="only samples that have this key (repeatable); filters --source-store",
|
|
100
|
+
)
|
|
101
|
+
sample_store_copy.add_argument(
|
|
102
|
+
"--key",
|
|
103
|
+
dest="keys",
|
|
104
|
+
action="append",
|
|
105
|
+
default=[],
|
|
106
|
+
help="restrict the copy to this key (repeatable); default copies all keys",
|
|
107
|
+
)
|
|
108
|
+
sample_store_copy.add_argument("--limit", type=int, required=True, help="max samples to copy")
|
|
109
|
+
sample_store_copy.add_argument("--randomize", action="store_true", help="take a random subset of the matches")
|
|
110
|
+
sample_store_copy.add_argument("--seed", type=int, default=0, help="seed for --randomize (repeatable picks)")
|
|
111
|
+
sample_store_copy.add_argument("--hidden", action="store_true", help="hide the new store from default catalog lists")
|
|
112
|
+
sample_store_copy.add_argument("--reason", help="copy reason")
|
|
113
|
+
sample_store_copy.add_argument("--idempotency-key", help="idempotency key")
|
|
114
|
+
_add_format_argument(sample_store_copy)
|
|
115
|
+
|
|
116
|
+
sample_store_archive = sample_store_sub.add_parser("archive", help="archive a sample store (required before delete)")
|
|
117
|
+
sample_store_archive.add_argument("name", help="sample store name")
|
|
118
|
+
_add_format_argument(sample_store_archive)
|
|
119
|
+
sample_store_restore = sample_store_sub.add_parser("restore", help="restore an archived sample store")
|
|
120
|
+
sample_store_restore.add_argument("name", help="sample store name")
|
|
121
|
+
_add_format_argument(sample_store_restore)
|
|
122
|
+
sample_store_operations = sample_store_sub.add_parser("operations", help="inspect and revert the store operation log")
|
|
123
|
+
operations_sub = sample_store_operations.add_subparsers(dest="operations_command")
|
|
124
|
+
operations_list = operations_sub.add_parser("list", help="list the store's operation log (oldest first)")
|
|
125
|
+
operations_list.add_argument("name", help="sample store name")
|
|
126
|
+
# The log is unbounded — one entry per grow or attach — so it can be paged. The
|
|
127
|
+
# defaults stay the whole log, oldest-first, which is what the guide teaches.
|
|
128
|
+
operations_list.add_argument("--offset", type=int, default=0, help="skip this many operations")
|
|
129
|
+
operations_list.add_argument(
|
|
130
|
+
"--limit", type=int, default=None, help="return at most this many (default: the whole log)"
|
|
131
|
+
)
|
|
132
|
+
operations_list.add_argument(
|
|
133
|
+
"--order",
|
|
134
|
+
choices=("oldest", "newest"),
|
|
135
|
+
default="oldest",
|
|
136
|
+
help="oldest first (default), or newest first to read what happened last",
|
|
137
|
+
)
|
|
138
|
+
_add_format_argument(operations_list)
|
|
139
|
+
operations_remove = operations_sub.add_parser("remove", help="remove/revert one operation by id")
|
|
140
|
+
operations_remove.add_argument("name", help="sample store name")
|
|
141
|
+
operations_remove.add_argument("op_id", help="operation id (from `operations list`)")
|
|
142
|
+
_add_format_argument(operations_remove)
|
|
143
|
+
|
|
144
|
+
source_import = subparsers.add_parser("source-import", help="manage source imports (admin surgery)")
|
|
145
|
+
source_import_sub = source_import.add_subparsers(dest="source_import_command")
|
|
146
|
+
source_import_delete = source_import_sub.add_parser(
|
|
147
|
+
"delete",
|
|
148
|
+
help="delete a single committed source import and all samples it owns",
|
|
149
|
+
)
|
|
150
|
+
source_import_delete.add_argument("--id", dest="source_import_id", help="source import id")
|
|
151
|
+
source_import_delete.add_argument(
|
|
152
|
+
"--sample-store", help="sample store (with --operation-id) to resolve the import"
|
|
153
|
+
)
|
|
154
|
+
source_import_delete.add_argument(
|
|
155
|
+
"--operation-id",
|
|
156
|
+
help="the import's operation id (with --sample-store) to resolve the import",
|
|
157
|
+
)
|
|
158
|
+
source_import_delete.add_argument(
|
|
159
|
+
"--source-ref",
|
|
160
|
+
help="deprecated spelling of --operation-id",
|
|
161
|
+
)
|
|
162
|
+
source_import_delete.add_argument(
|
|
163
|
+
"--dry-run",
|
|
164
|
+
action="store_true",
|
|
165
|
+
help="report what would be deleted without deleting anything",
|
|
166
|
+
)
|
|
167
|
+
source_import_delete.add_argument(
|
|
168
|
+
"--yes",
|
|
169
|
+
action="store_true",
|
|
170
|
+
help="actually delete (without this the command only does a dry run)",
|
|
171
|
+
)
|
|
172
|
+
_add_format_argument(source_import_delete)
|
|
173
|
+
|
|
174
|
+
sample = subparsers.add_parser("sample", help="inspect samples")
|
|
175
|
+
sample_sub = sample.add_subparsers(dest="sample_command")
|
|
176
|
+
sample_get = sample_sub.add_parser("get", help="get sample details and available keys")
|
|
177
|
+
sample_get.add_argument("sample_id", help="sample id")
|
|
178
|
+
_add_format_argument(sample_get)
|
|
179
|
+
sample_history = sample_sub.add_parser("history", help="show sample key revision history")
|
|
180
|
+
sample_history.add_argument("sample_id", help="sample id")
|
|
181
|
+
sample_history.add_argument("--key", help="optional key filter")
|
|
182
|
+
sample_history.add_argument("--as-of", dest="as_of", help="resolve history at or before this ISO timestamp")
|
|
183
|
+
sample_history.add_argument("--producer-id", help="optional producer filter")
|
|
184
|
+
_add_format_argument(sample_history)
|
|
185
|
+
|
|
186
|
+
events = subparsers.add_parser("events", help="manage Datavo events")
|
|
187
|
+
events_sub = events.add_subparsers(dest="events_command")
|
|
188
|
+
events_create = events_sub.add_parser("create", help="create an event")
|
|
189
|
+
events_create.add_argument("--type", dest="event_type", required=True, help="event type")
|
|
190
|
+
events_create.add_argument("--source", default="external", help="event source")
|
|
191
|
+
events_create.add_argument("--jobpool-run-id", help="JobPool run id")
|
|
192
|
+
events_create.add_argument("--idempotency-key", help="idempotency key")
|
|
193
|
+
events_create.add_argument("--param", action="append", default=[], help="event param as key=value")
|
|
194
|
+
_add_format_argument(events_create)
|
|
195
|
+
events_list = events_sub.add_parser("list", help="list events")
|
|
196
|
+
events_list.add_argument("--type", dest="event_type", help="event type filter")
|
|
197
|
+
events_list.add_argument("--param", action="append", default=[], help="param filter as key=value")
|
|
198
|
+
_add_format_argument(events_list)
|
|
199
|
+
events_get = events_sub.add_parser("get", help="get one event")
|
|
200
|
+
events_get.add_argument("event_id", help="event id")
|
|
201
|
+
_add_format_argument(events_get)
|
|
202
|
+
|
|
203
|
+
stats = subparsers.add_parser("stats", help="manage persisted statistics")
|
|
204
|
+
stats_sub = stats.add_subparsers(dest="stats_command")
|
|
205
|
+
stats_rebuild = stats_sub.add_parser("rebuild", help="rebuild persisted stats projections")
|
|
206
|
+
stats_scope = stats_rebuild.add_mutually_exclusive_group(required=True)
|
|
207
|
+
stats_scope.add_argument("--sample-store", help="rebuild one sample store")
|
|
208
|
+
|
|
209
|
+
# ---- teams and sharing -------------------------------------------------
|
|
210
|
+
teams = subparsers.add_parser("teams", help="manage teams and your default team")
|
|
211
|
+
teams_sub = teams.add_subparsers(dest="teams_command")
|
|
212
|
+
teams_list = teams_sub.add_parser("list", help="list teams")
|
|
213
|
+
teams_list.add_argument("--include-archived", action="store_true")
|
|
214
|
+
_add_format_argument(teams_list)
|
|
215
|
+
teams_show = teams_sub.add_parser("show", help="show one team and its members")
|
|
216
|
+
teams_show.add_argument("team", help="team slug")
|
|
217
|
+
_add_format_argument(teams_show)
|
|
218
|
+
teams_create = teams_sub.add_parser("create", help="create a team (admin)")
|
|
219
|
+
teams_create.add_argument("team", help="team slug")
|
|
220
|
+
teams_create.add_argument("--display-name", help="human-readable name")
|
|
221
|
+
_add_format_argument(teams_create)
|
|
222
|
+
teams_rename = teams_sub.add_parser("rename", help="rename a team (admin)")
|
|
223
|
+
teams_rename.add_argument("team", help="team slug")
|
|
224
|
+
teams_rename.add_argument("--display-name", required=True)
|
|
225
|
+
_add_format_argument(teams_rename)
|
|
226
|
+
teams_archive = teams_sub.add_parser(
|
|
227
|
+
"archive", help="archive a team (admin; refused while it owns resources)"
|
|
228
|
+
)
|
|
229
|
+
teams_archive.add_argument("team", help="team slug")
|
|
230
|
+
_add_format_argument(teams_archive)
|
|
231
|
+
teams_members = teams_sub.add_parser("members", help="manage membership (admin)")
|
|
232
|
+
teams_members_sub = teams_members.add_subparsers(dest="members_command")
|
|
233
|
+
teams_members_add = teams_members_sub.add_parser("add", help="add a member")
|
|
234
|
+
teams_members_add.add_argument("team", help="team slug")
|
|
235
|
+
teams_members_add.add_argument("user", help="user id")
|
|
236
|
+
_add_format_argument(teams_members_add)
|
|
237
|
+
teams_members_remove = teams_members_sub.add_parser("remove", help="remove a member")
|
|
238
|
+
teams_members_remove.add_argument("team", help="team slug")
|
|
239
|
+
teams_members_remove.add_argument("user", help="user id")
|
|
240
|
+
_add_format_argument(teams_members_remove)
|
|
241
|
+
|
|
242
|
+
def _add_resource_target(sub) -> None:
|
|
243
|
+
sub.add_argument("resource", choices=["store", "dataset", "split-set"])
|
|
244
|
+
sub.add_argument("name", help="store name, dataset name, or split-set name")
|
|
245
|
+
sub.add_argument("--dataset", help="parent dataset (required for split-set)")
|
|
246
|
+
|
|
247
|
+
share = subparsers.add_parser("share", help="share a resource with a team")
|
|
248
|
+
_add_resource_target(share)
|
|
249
|
+
share.add_argument("--to", help="team slug to share with")
|
|
250
|
+
share.add_argument("--level", choices=["read", "write"], default="read")
|
|
251
|
+
share.add_argument("--list", action="store_true", help="show current grants instead")
|
|
252
|
+
_add_format_argument(share)
|
|
253
|
+
|
|
254
|
+
unshare = subparsers.add_parser("unshare", help="revoke a team's access to a resource")
|
|
255
|
+
_add_resource_target(unshare)
|
|
256
|
+
unshare.add_argument("--to", required=True, help="team slug to revoke")
|
|
257
|
+
_add_format_argument(unshare)
|
|
258
|
+
|
|
259
|
+
transfer = subparsers.add_parser(
|
|
260
|
+
"transfer",
|
|
261
|
+
help="hand ownership to another team — IRREVERSIBLE, the current team keeps nothing",
|
|
262
|
+
)
|
|
263
|
+
_add_resource_target(transfer)
|
|
264
|
+
transfer.add_argument("--to", required=True, help="destination team slug")
|
|
265
|
+
transfer.add_argument(
|
|
266
|
+
"--yes-i-understand-this-is-irreversible",
|
|
267
|
+
action="store_true",
|
|
268
|
+
help="skip the typed confirmation; the transfer still cannot be undone",
|
|
269
|
+
)
|
|
270
|
+
_add_format_argument(transfer)
|
|
271
|
+
|
|
272
|
+
# ---- user management ---------------------------------------------------
|
|
273
|
+
users = subparsers.add_parser("users", help="manage users and their role overrides (admin)")
|
|
274
|
+
users_sub = users.add_subparsers(dest="users_command")
|
|
275
|
+
users_list = users_sub.add_parser(
|
|
276
|
+
"list", help="list users with their baseline and effective role"
|
|
277
|
+
)
|
|
278
|
+
users_list.add_argument("--query", help="filter by name or address")
|
|
279
|
+
users_list.add_argument("--offset", type=int, default=0)
|
|
280
|
+
users_list.add_argument("--limit", type=int, default=100)
|
|
281
|
+
_add_format_argument(users_list)
|
|
282
|
+
users_show = users_sub.add_parser("show", help="show one user")
|
|
283
|
+
users_show.add_argument("user", help="user id")
|
|
284
|
+
_add_format_argument(users_show)
|
|
285
|
+
users_set_role = users_sub.add_parser("set-role", help="set a user's role override (admin)")
|
|
286
|
+
users_set_role.add_argument("user", help="user id")
|
|
287
|
+
users_set_role.add_argument(
|
|
288
|
+
"role", choices=["reader", "contributor", "sample_store_manager", "admin"]
|
|
289
|
+
)
|
|
290
|
+
_add_format_argument(users_set_role)
|
|
291
|
+
users_clear_role = users_sub.add_parser(
|
|
292
|
+
"clear-role", help="clear a user's override, back to the Entra baseline (admin)"
|
|
293
|
+
)
|
|
294
|
+
users_clear_role.add_argument("user", help="user id")
|
|
295
|
+
_add_format_argument(users_clear_role)
|
|
296
|
+
|
|
297
|
+
stats_scope.add_argument("--dataset", help="rebuild one dataset")
|
|
298
|
+
stats_scope.add_argument("--all", action="store_true", help="rebuild every sample store and dataset")
|
|
299
|
+
_add_format_argument(stats_rebuild)
|
|
300
|
+
|
|
301
|
+
dataset = subparsers.add_parser("dataset", help="manage datasets")
|
|
302
|
+
dataset_sub = dataset.add_subparsers(dest="dataset_command")
|
|
303
|
+
dataset_preview = dataset_sub.add_parser("preview", help="preview a dataset spec")
|
|
304
|
+
dataset_preview.add_argument("--spec", required=True, help="YAML or JSON request file, or - for stdin")
|
|
305
|
+
_add_format_argument(dataset_preview)
|
|
306
|
+
dataset_create = dataset_sub.add_parser("create", help="create a dataset")
|
|
307
|
+
dataset_create.add_argument("--spec", required=True, help="YAML or JSON request file, or - for stdin")
|
|
308
|
+
dataset_create.add_argument(
|
|
309
|
+
"--wait",
|
|
310
|
+
action="store_true",
|
|
311
|
+
help="poll until the dataset is materialized (ready) instead of returning the planning response",
|
|
312
|
+
)
|
|
313
|
+
_add_format_argument(dataset_create)
|
|
314
|
+
dataset_list = dataset_sub.add_parser("list", help="list datasets")
|
|
315
|
+
dataset_list.add_argument("--query", "-q", help="name search")
|
|
316
|
+
dataset_list.add_argument("--key", action="append", dest="keys", help="only datasets containing this key; repeatable (AND)")
|
|
317
|
+
dataset_list.add_argument("--include-archived", action="store_true", help="include archived datasets")
|
|
318
|
+
dataset_list.add_argument("--include-split-children", action="store_true", help="include split-set-generated datasets")
|
|
319
|
+
dataset_list.add_argument("--offset", type=int, default=0, help="pagination offset")
|
|
320
|
+
dataset_list.add_argument("--limit", type=int, default=20, help="max datasets to return")
|
|
321
|
+
_add_format_argument(dataset_list)
|
|
322
|
+
dataset_get = dataset_sub.add_parser("get", help="get dataset details")
|
|
323
|
+
dataset_get.add_argument("name", help="dataset name")
|
|
324
|
+
_add_format_argument(dataset_get)
|
|
325
|
+
dataset_archive = dataset_sub.add_parser("archive", help="archive a dataset (required before delete)")
|
|
326
|
+
dataset_archive.add_argument("name", help="dataset name")
|
|
327
|
+
_add_format_argument(dataset_archive)
|
|
328
|
+
dataset_restore = dataset_sub.add_parser("restore", help="restore an archived dataset")
|
|
329
|
+
dataset_restore.add_argument("name", help="dataset name")
|
|
330
|
+
_add_format_argument(dataset_restore)
|
|
331
|
+
dataset_delete = dataset_sub.add_parser("delete", help="delete an archived dataset")
|
|
332
|
+
dataset_delete.add_argument("name", help="dataset name")
|
|
333
|
+
_add_format_argument(dataset_delete)
|
|
334
|
+
dataset_add_key_group = dataset_sub.add_parser("add-key-group", help="add a key group to a dataset")
|
|
335
|
+
dataset_add_key_group.add_argument("name", help="dataset name")
|
|
336
|
+
dataset_add_key_group.add_argument("--spec", required=True, help="YAML or JSON request file, or - for stdin")
|
|
337
|
+
_add_format_argument(dataset_add_key_group)
|
|
338
|
+
dataset_pull = dataset_sub.add_parser("pull", help="download dataset shard tars")
|
|
339
|
+
dataset_pull.add_argument("name", help="dataset name")
|
|
340
|
+
dataset_pull.add_argument("--output-dir", required=True, help="local directory for downloaded shards")
|
|
341
|
+
dataset_pull.add_argument("--overwrite", action="store_true", help="overwrite existing files")
|
|
342
|
+
_add_key_group_argument(dataset_pull)
|
|
343
|
+
_add_format_argument(dataset_pull)
|
|
344
|
+
|
|
345
|
+
split_set = subparsers.add_parser("split-set", help="manage dataset train/validation/test split sets")
|
|
346
|
+
split_set_sub = split_set.add_subparsers(dest="split_set_command")
|
|
347
|
+
split_set_preview = split_set_sub.add_parser("preview", help="preview a split-set spec (no writes)")
|
|
348
|
+
split_set_preview.add_argument("dataset", help="parent dataset name")
|
|
349
|
+
split_set_preview.add_argument("--spec", required=True, help="YAML or JSON request file, or - for stdin")
|
|
350
|
+
_add_format_argument(split_set_preview)
|
|
351
|
+
split_set_create = split_set_sub.add_parser("create", help="create a split set from a spec")
|
|
352
|
+
split_set_create.add_argument("dataset", help="parent dataset name")
|
|
353
|
+
split_set_create.add_argument("--spec", required=True, help="YAML or JSON request file, or - for stdin")
|
|
354
|
+
_add_format_argument(split_set_create)
|
|
355
|
+
split_set_list = split_set_sub.add_parser("list", help="list split sets under a parent dataset")
|
|
356
|
+
split_set_list.add_argument("dataset", help="parent dataset name")
|
|
357
|
+
split_set_list.add_argument("--include-archived", action="store_true", help="include archived split sets")
|
|
358
|
+
_add_format_argument(split_set_list)
|
|
359
|
+
split_set_splits = split_set_sub.add_parser("splits", help="list the datasets generated by split sets")
|
|
360
|
+
split_set_splits.add_argument("dataset", help="parent dataset name")
|
|
361
|
+
split_set_splits.add_argument("--split-set", help="only show one split set's generated datasets")
|
|
362
|
+
split_set_splits.add_argument("--include-archived", action="store_true", help="include archived split sets")
|
|
363
|
+
_add_format_argument(split_set_splits)
|
|
364
|
+
split_set_get = split_set_sub.add_parser("get", help="get one split set's details")
|
|
365
|
+
split_set_get.add_argument("dataset", help="parent dataset name")
|
|
366
|
+
split_set_get.add_argument("split_set", help="split set name")
|
|
367
|
+
_add_format_argument(split_set_get)
|
|
368
|
+
split_set_archive = split_set_sub.add_parser("archive", help="archive a split set (required before delete)")
|
|
369
|
+
split_set_archive.add_argument("dataset", help="parent dataset name")
|
|
370
|
+
split_set_archive.add_argument("split_set", help="split set name")
|
|
371
|
+
_add_format_argument(split_set_archive)
|
|
372
|
+
split_set_restore = split_set_sub.add_parser("restore", help="restore an archived split set")
|
|
373
|
+
split_set_restore.add_argument("dataset", help="parent dataset name")
|
|
374
|
+
split_set_restore.add_argument("split_set", help="split set name")
|
|
375
|
+
_add_format_argument(split_set_restore)
|
|
376
|
+
split_set_delete = split_set_sub.add_parser("delete", help="delete an archived split set")
|
|
377
|
+
split_set_delete.add_argument("dataset", help="parent dataset name")
|
|
378
|
+
split_set_delete.add_argument("split_set", help="split set name")
|
|
379
|
+
_add_format_argument(split_set_delete)
|
|
380
|
+
|
|
381
|
+
render_cache = subparsers.add_parser(
|
|
382
|
+
"render-dataset-cache",
|
|
383
|
+
help="render the datavo adapters block (name + config) for a JobPool worker spec",
|
|
384
|
+
)
|
|
385
|
+
render_cache.add_argument("--disk", required=True, help="worker disk name backing the cache")
|
|
386
|
+
render_cache.add_argument("--host-path", required=True, help="host path of the cache disk")
|
|
387
|
+
render_cache.add_argument("--mount", required=True, help="in-container mount path of the cache disk")
|
|
388
|
+
render_cache.add_argument(
|
|
389
|
+
"--tier",
|
|
390
|
+
action="append",
|
|
391
|
+
dest="tiers",
|
|
392
|
+
required=True,
|
|
393
|
+
metavar="TYPE[,max_bytes][,name]",
|
|
394
|
+
help="cache tier, fastest-first; repeat for multiple (e.g. folder,32GB,local)",
|
|
395
|
+
)
|
|
396
|
+
render_cache.add_argument(
|
|
397
|
+
"--token-alias",
|
|
398
|
+
default="datavo_token",
|
|
399
|
+
help="accepted for backward compatibility; no longer emitted into the spec "
|
|
400
|
+
"(the adapter resolves the alias at runtime via DATAVO_TOKEN_ALIAS/default)",
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
warm = subparsers.add_parser("warm", help="pre-populate a cache tier for a dataset/selection")
|
|
404
|
+
warm.add_argument("dataset", help="dataset or split name to warm")
|
|
405
|
+
warm.add_argument("--key", action="append", dest="keys", help="key to warm; repeat for multiple")
|
|
406
|
+
warm.add_argument("--cache-config", help="path to a shards.yaml cache config (else the default)")
|
|
407
|
+
|
|
408
|
+
version = subparsers.add_parser("version", help="print version information")
|
|
409
|
+
_add_format_argument(version)
|
|
410
|
+
|
|
411
|
+
return parser
|