datachain 0.8.8__py3-none-any.whl → 0.8.9__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.
Potentially problematic release.
This version of datachain might be problematic. Click here for more details.
- datachain/cli/__init__.py +12 -4
- datachain/cli/commands/datasets.py +2 -3
- datachain/cli/parser/__init__.py +51 -69
- datachain/cli/parser/job.py +20 -25
- datachain/cli/parser/studio.py +22 -46
- datachain/cli/parser/utils.py +1 -1
- datachain/client/local.py +1 -1
- datachain/lib/arrow.py +1 -1
- datachain/lib/convert/unflatten.py +1 -2
- datachain/lib/dc.py +23 -4
- datachain/lib/file.py +27 -4
- datachain/lib/listing.py +4 -4
- datachain/lib/pytorch.py +3 -1
- datachain/lib/udf.py +56 -20
- datachain/model/bbox.py +9 -9
- datachain/model/pose.py +9 -9
- datachain/model/segment.py +6 -6
- datachain/progress.py +0 -13
- datachain/query/dataset.py +12 -10
- datachain/studio.py +15 -9
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/METADATA +4 -3
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/RECORD +26 -26
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/LICENSE +0 -0
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/WHEEL +0 -0
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/entry_points.txt +0 -0
- {datachain-0.8.8.dist-info → datachain-0.8.9.dist-info}/top_level.txt +0 -0
datachain/cli/__init__.py
CHANGED
|
@@ -39,6 +39,10 @@ def main(argv: Optional[list[str]] = None) -> int:
|
|
|
39
39
|
if args.command in ("internal-run-udf", "internal-run-udf-worker"):
|
|
40
40
|
return handle_udf(args.command)
|
|
41
41
|
|
|
42
|
+
if args.command is None:
|
|
43
|
+
datachain_parser.print_help(sys.stderr)
|
|
44
|
+
return 1
|
|
45
|
+
|
|
42
46
|
logger.addHandler(logging.StreamHandler())
|
|
43
47
|
logging_level = get_logging_level(args)
|
|
44
48
|
logger.setLevel(logging_level)
|
|
@@ -120,12 +124,17 @@ def handle_clone_command(args, catalog):
|
|
|
120
124
|
recursive=bool(args.recursive),
|
|
121
125
|
no_glob=args.no_glob,
|
|
122
126
|
no_cp=args.no_cp,
|
|
123
|
-
edatachain=args.edatachain,
|
|
124
|
-
edatachain_file=args.edatachain_file,
|
|
125
127
|
)
|
|
126
128
|
|
|
127
129
|
|
|
128
130
|
def handle_dataset_command(args, catalog):
|
|
131
|
+
if args.datasets_cmd is None:
|
|
132
|
+
print(
|
|
133
|
+
f"Use 'datachain {args.command} --help' to see available options",
|
|
134
|
+
file=sys.stderr,
|
|
135
|
+
)
|
|
136
|
+
return 1
|
|
137
|
+
|
|
129
138
|
dataset_commands = {
|
|
130
139
|
"pull": lambda: catalog.pull_dataset(
|
|
131
140
|
args.dataset,
|
|
@@ -134,8 +143,6 @@ def handle_dataset_command(args, catalog):
|
|
|
134
143
|
local_ds_version=args.local_version,
|
|
135
144
|
cp=args.cp,
|
|
136
145
|
force=bool(args.force),
|
|
137
|
-
edatachain=args.edatachain,
|
|
138
|
-
edatachain_file=args.edatachain_file,
|
|
139
146
|
),
|
|
140
147
|
"edit": lambda: edit_dataset(
|
|
141
148
|
catalog,
|
|
@@ -187,6 +194,7 @@ def handle_dataset_command(args, catalog):
|
|
|
187
194
|
handler = dataset_commands.get(args.datasets_cmd)
|
|
188
195
|
if handler:
|
|
189
196
|
return handler()
|
|
197
|
+
|
|
190
198
|
raise Exception(f"Unexpected command {args.datasets_cmd}")
|
|
191
199
|
|
|
192
200
|
|
|
@@ -11,6 +11,7 @@ if TYPE_CHECKING:
|
|
|
11
11
|
from datachain.cli.utils import determine_flavors
|
|
12
12
|
from datachain.config import Config
|
|
13
13
|
from datachain.error import DatasetNotFoundError
|
|
14
|
+
from datachain.studio import list_datasets as list_datasets_studio
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
def list_datasets(
|
|
@@ -20,14 +21,12 @@ def list_datasets(
|
|
|
20
21
|
all: bool = True,
|
|
21
22
|
team: Optional[str] = None,
|
|
22
23
|
):
|
|
23
|
-
from datachain.studio import list_datasets
|
|
24
|
-
|
|
25
24
|
token = Config().read().get("studio", {}).get("token")
|
|
26
25
|
all, local, studio = determine_flavors(studio, local, all, token)
|
|
27
26
|
|
|
28
27
|
local_datasets = set(list_datasets_local(catalog)) if all or local else set()
|
|
29
28
|
studio_datasets = (
|
|
30
|
-
set(
|
|
29
|
+
set(list_datasets_studio(team=team)) if (all or studio) and token else set()
|
|
31
30
|
)
|
|
32
31
|
|
|
33
32
|
rows = [
|
datachain/cli/parser/__init__.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import argparse
|
|
1
2
|
from argparse import ArgumentParser
|
|
2
3
|
from importlib.metadata import PackageNotFoundError, version
|
|
3
4
|
|
|
@@ -18,7 +19,8 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
18
19
|
__version__ = "unknown"
|
|
19
20
|
|
|
20
21
|
parser = ArgumentParser(
|
|
21
|
-
description="DataChain: Wrangle unstructured AI data at scale",
|
|
22
|
+
description="DataChain: Wrangle unstructured AI data at scale.",
|
|
23
|
+
prog="datachain",
|
|
22
24
|
)
|
|
23
25
|
parser.add_argument("-V", "--version", action="version", version=__version__)
|
|
24
26
|
|
|
@@ -31,13 +33,13 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
31
33
|
parent_parser.add_argument(
|
|
32
34
|
"--anon",
|
|
33
35
|
action="store_true",
|
|
34
|
-
help="
|
|
36
|
+
help="anon flag for remote storage (like awscli's --no-sign-request)",
|
|
35
37
|
)
|
|
36
38
|
parent_parser.add_argument(
|
|
37
39
|
"-u", "--update", action="count", default=0, help="Update cache"
|
|
38
40
|
)
|
|
39
41
|
parent_parser.add_argument(
|
|
40
|
-
"-v", "--verbose", action="count", default=0, help="
|
|
42
|
+
"-v", "--verbose", action="count", default=0, help="Be verbose"
|
|
41
43
|
)
|
|
42
44
|
parent_parser.add_argument(
|
|
43
45
|
"-q", "--quiet", action="count", default=0, help="Be quiet"
|
|
@@ -46,24 +48,23 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
46
48
|
"--debug-sql",
|
|
47
49
|
action="store_true",
|
|
48
50
|
default=False,
|
|
49
|
-
help=
|
|
51
|
+
help=argparse.SUPPRESS,
|
|
50
52
|
)
|
|
51
53
|
parent_parser.add_argument(
|
|
52
54
|
"--pdb",
|
|
53
55
|
action="store_true",
|
|
54
56
|
default=False,
|
|
55
|
-
help=
|
|
57
|
+
help=argparse.SUPPRESS,
|
|
56
58
|
)
|
|
57
59
|
|
|
58
60
|
subp = parser.add_subparsers(
|
|
59
61
|
title="Available Commands",
|
|
60
62
|
metavar="command",
|
|
61
63
|
dest="command",
|
|
62
|
-
help=f"Use `{parser.prog} command --help` for command-specific help
|
|
63
|
-
required=True,
|
|
64
|
+
help=f"Use `{parser.prog} command --help` for command-specific help",
|
|
64
65
|
)
|
|
65
66
|
parse_cp = subp.add_parser(
|
|
66
|
-
"cp", parents=[parent_parser], description="Copy data files from the cloud"
|
|
67
|
+
"cp", parents=[parent_parser], description="Copy data files from the cloud."
|
|
67
68
|
)
|
|
68
69
|
add_sources_arg(parse_cp).complete = shtab.DIR # type: ignore[attr-defined]
|
|
69
70
|
parse_cp.add_argument("output", type=str, help="Output")
|
|
@@ -72,7 +73,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
72
73
|
"--force",
|
|
73
74
|
default=False,
|
|
74
75
|
action="store_true",
|
|
75
|
-
help="Force creating
|
|
76
|
+
help="Force creating files even if they already exist",
|
|
76
77
|
)
|
|
77
78
|
parse_cp.add_argument(
|
|
78
79
|
"-r",
|
|
@@ -90,7 +91,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
90
91
|
)
|
|
91
92
|
|
|
92
93
|
parse_clone = subp.add_parser(
|
|
93
|
-
"clone", parents=[parent_parser], description="Copy data files from the cloud"
|
|
94
|
+
"clone", parents=[parent_parser], description="Copy data files from the cloud."
|
|
94
95
|
)
|
|
95
96
|
add_sources_arg(parse_clone).complete = shtab.DIR # type: ignore[attr-defined]
|
|
96
97
|
parse_clone.add_argument("output", type=str, help="Output")
|
|
@@ -121,16 +122,6 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
121
122
|
action="store_true",
|
|
122
123
|
help="Do not copy files, just create a dataset",
|
|
123
124
|
)
|
|
124
|
-
parse_clone.add_argument(
|
|
125
|
-
"--edatachain",
|
|
126
|
-
default=False,
|
|
127
|
-
action="store_true",
|
|
128
|
-
help="Create a .edatachain file",
|
|
129
|
-
)
|
|
130
|
-
parse_clone.add_argument(
|
|
131
|
-
"--edatachain-file",
|
|
132
|
-
help="Use a different filename for the resulting .edatachain file",
|
|
133
|
-
)
|
|
134
125
|
|
|
135
126
|
add_studio_parser(subp, parent_parser)
|
|
136
127
|
add_jobs_parser(subp, parent_parser)
|
|
@@ -139,22 +130,22 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
139
130
|
"dataset",
|
|
140
131
|
aliases=["ds"],
|
|
141
132
|
parents=[parent_parser],
|
|
142
|
-
description="Commands for managing
|
|
133
|
+
description="Commands for managing datasets.",
|
|
143
134
|
)
|
|
144
135
|
datasets_subparser = datasets_parser.add_subparsers(
|
|
145
136
|
dest="datasets_cmd",
|
|
146
|
-
help="Use `datachain
|
|
137
|
+
help="Use `datachain dataset CMD --help` to display command-specific help",
|
|
147
138
|
)
|
|
148
139
|
|
|
149
140
|
parse_pull = datasets_subparser.add_parser(
|
|
150
141
|
"pull",
|
|
151
142
|
parents=[parent_parser],
|
|
152
|
-
description="Pull specific dataset version from
|
|
143
|
+
description="Pull specific dataset version from Studio.",
|
|
153
144
|
)
|
|
154
145
|
parse_pull.add_argument(
|
|
155
146
|
"dataset",
|
|
156
147
|
type=str,
|
|
157
|
-
help="Name and version of remote dataset created in
|
|
148
|
+
help="Name and version of remote dataset created in Studio",
|
|
158
149
|
)
|
|
159
150
|
parse_pull.add_argument("-o", "--output", type=str, help="Output")
|
|
160
151
|
parse_pull.add_argument(
|
|
@@ -178,16 +169,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
178
169
|
action="store_true",
|
|
179
170
|
help="Copy actual files after pulling remote dataset into local DB",
|
|
180
171
|
)
|
|
181
|
-
|
|
182
|
-
"--edatachain",
|
|
183
|
-
default=False,
|
|
184
|
-
action="store_true",
|
|
185
|
-
help="Create .edatachain file",
|
|
186
|
-
)
|
|
187
|
-
parse_pull.add_argument(
|
|
188
|
-
"--edatachain-file",
|
|
189
|
-
help="Use a different filename for the resulting .edatachain file",
|
|
190
|
-
)
|
|
172
|
+
|
|
191
173
|
parse_pull.add_argument(
|
|
192
174
|
"--local-name",
|
|
193
175
|
action="store",
|
|
@@ -202,7 +184,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
202
184
|
)
|
|
203
185
|
|
|
204
186
|
parse_edit_dataset = datasets_subparser.add_parser(
|
|
205
|
-
"edit", parents=[parent_parser], description="Edit dataset metadata"
|
|
187
|
+
"edit", parents=[parent_parser], description="Edit dataset metadata."
|
|
206
188
|
)
|
|
207
189
|
parse_edit_dataset.add_argument("name", type=str, help="Dataset name")
|
|
208
190
|
parse_edit_dataset.add_argument(
|
|
@@ -244,41 +226,41 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
244
226
|
"--team",
|
|
245
227
|
action="store",
|
|
246
228
|
default=None,
|
|
247
|
-
help="The team to edit a dataset. By default, it will use team from config
|
|
229
|
+
help="The team to edit a dataset. By default, it will use team from config",
|
|
248
230
|
)
|
|
249
231
|
|
|
250
|
-
|
|
251
|
-
"ls", parents=[parent_parser], description="List datasets"
|
|
232
|
+
datasets_ls_parser = datasets_subparser.add_parser(
|
|
233
|
+
"ls", parents=[parent_parser], description="List datasets."
|
|
252
234
|
)
|
|
253
|
-
|
|
235
|
+
datasets_ls_parser.add_argument(
|
|
254
236
|
"--studio",
|
|
255
237
|
action="store_true",
|
|
256
238
|
default=False,
|
|
257
239
|
help="List the files in the Studio",
|
|
258
240
|
)
|
|
259
|
-
|
|
241
|
+
datasets_ls_parser.add_argument(
|
|
260
242
|
"-L",
|
|
261
243
|
"--local",
|
|
262
244
|
action="store_true",
|
|
263
245
|
default=False,
|
|
264
246
|
help="List local files only",
|
|
265
247
|
)
|
|
266
|
-
|
|
248
|
+
datasets_ls_parser.add_argument(
|
|
267
249
|
"-a",
|
|
268
250
|
"--all",
|
|
269
251
|
action="store_true",
|
|
270
252
|
default=True,
|
|
271
253
|
help="List all files including hidden files",
|
|
272
254
|
)
|
|
273
|
-
|
|
255
|
+
datasets_ls_parser.add_argument(
|
|
274
256
|
"--team",
|
|
275
257
|
action="store",
|
|
276
258
|
default=None,
|
|
277
|
-
help="The team to list datasets for. By default, it will use team from config
|
|
259
|
+
help="The team to list datasets for. By default, it will use team from config",
|
|
278
260
|
)
|
|
279
261
|
|
|
280
262
|
rm_dataset_parser = datasets_subparser.add_parser(
|
|
281
|
-
"rm", parents=[parent_parser], description="
|
|
263
|
+
"rm", parents=[parent_parser], description="Remove dataset.", aliases=["remove"]
|
|
282
264
|
)
|
|
283
265
|
rm_dataset_parser.add_argument("name", type=str, help="Dataset name")
|
|
284
266
|
rm_dataset_parser.add_argument(
|
|
@@ -292,7 +274,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
292
274
|
"--force",
|
|
293
275
|
default=False,
|
|
294
276
|
action=BooleanOptionalAction,
|
|
295
|
-
help="Force delete registered dataset with all of
|
|
277
|
+
help="Force delete registered dataset with all of its versions",
|
|
296
278
|
)
|
|
297
279
|
rm_dataset_parser.add_argument(
|
|
298
280
|
"--studio",
|
|
@@ -318,13 +300,11 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
318
300
|
"--team",
|
|
319
301
|
action="store",
|
|
320
302
|
default=None,
|
|
321
|
-
help="The team to delete a dataset. By default, it will use team from config
|
|
303
|
+
help="The team to delete a dataset. By default, it will use team from config",
|
|
322
304
|
)
|
|
323
305
|
|
|
324
306
|
dataset_stats_parser = datasets_subparser.add_parser(
|
|
325
|
-
"stats",
|
|
326
|
-
parents=[parent_parser],
|
|
327
|
-
description="Shows basic dataset stats",
|
|
307
|
+
"stats", parents=[parent_parser], description="Show basic dataset statistics."
|
|
328
308
|
)
|
|
329
309
|
dataset_stats_parser.add_argument("name", type=str, help="Dataset name")
|
|
330
310
|
dataset_stats_parser.add_argument(
|
|
@@ -349,7 +329,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
349
329
|
)
|
|
350
330
|
|
|
351
331
|
parse_ls = subp.add_parser(
|
|
352
|
-
"ls", parents=[parent_parser], description="List storage contents"
|
|
332
|
+
"ls", parents=[parent_parser], description="List storage contents."
|
|
353
333
|
)
|
|
354
334
|
add_sources_arg(parse_ls, nargs="*")
|
|
355
335
|
parse_ls.add_argument(
|
|
@@ -357,7 +337,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
357
337
|
"--long",
|
|
358
338
|
action="count",
|
|
359
339
|
default=0,
|
|
360
|
-
help="List files in
|
|
340
|
+
help="List files in long format",
|
|
361
341
|
)
|
|
362
342
|
parse_ls.add_argument(
|
|
363
343
|
"--studio",
|
|
@@ -383,11 +363,11 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
383
363
|
"--team",
|
|
384
364
|
action="store",
|
|
385
365
|
default=None,
|
|
386
|
-
help="The team to list datasets for. By default, it will use team from config
|
|
366
|
+
help="The team to list datasets for. By default, it will use team from config",
|
|
387
367
|
)
|
|
388
368
|
|
|
389
369
|
parse_du = subp.add_parser(
|
|
390
|
-
"du", parents=[parent_parser], description="Display space usage"
|
|
370
|
+
"du", parents=[parent_parser], description="Display space usage."
|
|
391
371
|
)
|
|
392
372
|
add_sources_arg(parse_du)
|
|
393
373
|
parse_du.add_argument(
|
|
@@ -405,8 +385,8 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
405
385
|
type=int,
|
|
406
386
|
metavar="N",
|
|
407
387
|
help=(
|
|
408
|
-
"Display sizes
|
|
409
|
-
"
|
|
388
|
+
"Display sizes up to N directory levels deep "
|
|
389
|
+
"(default: 0, summarize provided directory only)"
|
|
410
390
|
),
|
|
411
391
|
)
|
|
412
392
|
parse_du.add_argument(
|
|
@@ -417,32 +397,32 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
417
397
|
)
|
|
418
398
|
|
|
419
399
|
parse_find = subp.add_parser(
|
|
420
|
-
"find", parents=[parent_parser], description="Search in a directory hierarchy"
|
|
400
|
+
"find", parents=[parent_parser], description="Search in a directory hierarchy."
|
|
421
401
|
)
|
|
422
402
|
add_sources_arg(parse_find)
|
|
423
403
|
parse_find.add_argument(
|
|
424
404
|
"--name",
|
|
425
405
|
type=str,
|
|
426
406
|
action="append",
|
|
427
|
-
help="
|
|
407
|
+
help="Match filename pattern",
|
|
428
408
|
)
|
|
429
409
|
parse_find.add_argument(
|
|
430
410
|
"--iname",
|
|
431
411
|
type=str,
|
|
432
412
|
action="append",
|
|
433
|
-
help="
|
|
413
|
+
help="Match filename pattern (case insensitive)",
|
|
434
414
|
)
|
|
435
415
|
parse_find.add_argument(
|
|
436
416
|
"--path",
|
|
437
417
|
type=str,
|
|
438
418
|
action="append",
|
|
439
|
-
help="Path to match pattern
|
|
419
|
+
help="Path to match pattern",
|
|
440
420
|
)
|
|
441
421
|
parse_find.add_argument(
|
|
442
422
|
"--ipath",
|
|
443
423
|
type=str,
|
|
444
424
|
action="append",
|
|
445
|
-
help="Like -path but case insensitive
|
|
425
|
+
help="Like -path but case insensitive",
|
|
446
426
|
)
|
|
447
427
|
parse_find.add_argument(
|
|
448
428
|
"--size",
|
|
@@ -450,7 +430,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
450
430
|
help=(
|
|
451
431
|
"Filter by size (+ is greater or equal, - is less or equal). "
|
|
452
432
|
"Specified size is in bytes, or use a suffix like K, M, G for "
|
|
453
|
-
"kilobytes, megabytes, gigabytes, etc
|
|
433
|
+
"kilobytes, megabytes, gigabytes, etc"
|
|
454
434
|
),
|
|
455
435
|
)
|
|
456
436
|
parse_find.add_argument(
|
|
@@ -470,14 +450,14 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
470
450
|
)
|
|
471
451
|
|
|
472
452
|
parse_index = subp.add_parser(
|
|
473
|
-
"index", parents=[parent_parser], description="Index storage location"
|
|
453
|
+
"index", parents=[parent_parser], description="Index storage location."
|
|
474
454
|
)
|
|
475
455
|
add_sources_arg(parse_index)
|
|
476
456
|
|
|
477
457
|
show_parser = subp.add_parser(
|
|
478
458
|
"show",
|
|
479
459
|
parents=[parent_parser],
|
|
480
|
-
description="Create a new dataset with a query script",
|
|
460
|
+
description="Create a new dataset with a query script.",
|
|
481
461
|
)
|
|
482
462
|
show_parser.add_argument("name", type=str, help="Dataset name")
|
|
483
463
|
show_parser.add_argument(
|
|
@@ -493,7 +473,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
493
473
|
query_parser = subp.add_parser(
|
|
494
474
|
"query",
|
|
495
475
|
parents=[parent_parser],
|
|
496
|
-
description="Create a new dataset with a query script",
|
|
476
|
+
description="Create a new dataset with a query script.",
|
|
497
477
|
)
|
|
498
478
|
query_parser.add_argument(
|
|
499
479
|
"script", metavar="<script.py>", type=str, help="Filepath for script"
|
|
@@ -507,7 +487,7 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
507
487
|
metavar="N",
|
|
508
488
|
help=(
|
|
509
489
|
"Use multiprocessing to run any query script UDFs with N worker processes. "
|
|
510
|
-
"N defaults to the CPU count
|
|
490
|
+
"N defaults to the CPU count"
|
|
511
491
|
),
|
|
512
492
|
)
|
|
513
493
|
query_parser.add_argument(
|
|
@@ -520,10 +500,12 @@ def get_parser() -> ArgumentParser: # noqa: PLR0915
|
|
|
520
500
|
)
|
|
521
501
|
|
|
522
502
|
subp.add_parser(
|
|
523
|
-
"clear-cache",
|
|
503
|
+
"clear-cache",
|
|
504
|
+
parents=[parent_parser],
|
|
505
|
+
description="Clear the local file cache.",
|
|
524
506
|
)
|
|
525
507
|
subp.add_parser(
|
|
526
|
-
"gc", parents=[parent_parser], description="Garbage collect temporary tables"
|
|
508
|
+
"gc", parents=[parent_parser], description="Garbage collect temporary tables."
|
|
527
509
|
)
|
|
528
510
|
|
|
529
511
|
subp.add_parser("internal-run-udf", parents=[parent_parser])
|
|
@@ -536,12 +518,12 @@ def add_completion_parser(subparsers, parents):
|
|
|
536
518
|
parser = subparsers.add_parser(
|
|
537
519
|
"completion",
|
|
538
520
|
parents=parents,
|
|
539
|
-
description="Output shell completion script",
|
|
521
|
+
description="Output shell completion script.",
|
|
540
522
|
)
|
|
541
523
|
parser.add_argument(
|
|
542
524
|
"-s",
|
|
543
525
|
"--shell",
|
|
544
|
-
help="Shell syntax for completions
|
|
526
|
+
help="Shell syntax for completions",
|
|
545
527
|
default="bash",
|
|
546
528
|
choices=shtab.SUPPORTED_SHELLS,
|
|
547
529
|
)
|
datachain/cli/parser/job.py
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
def add_jobs_parser(subparsers, parent_parser) -> None:
|
|
2
|
-
jobs_help = "
|
|
3
|
-
jobs_description =
|
|
4
|
-
"This will help us to run, cancel and view the status of the job in Studio. "
|
|
5
|
-
)
|
|
2
|
+
jobs_help = "Manage jobs in Studio"
|
|
3
|
+
jobs_description = "Commands to manage job execution in Studio."
|
|
6
4
|
jobs_parser = subparsers.add_parser(
|
|
7
5
|
"job", parents=[parent_parser], description=jobs_description, help=jobs_help
|
|
8
6
|
)
|
|
9
7
|
jobs_subparser = jobs_parser.add_subparsers(
|
|
10
8
|
dest="cmd",
|
|
11
|
-
help="Use `
|
|
12
|
-
required=True,
|
|
9
|
+
help="Use `datachain studio CMD --help` to display command-specific help",
|
|
13
10
|
)
|
|
14
11
|
|
|
15
12
|
studio_run_help = "Run a job in Studio"
|
|
16
|
-
studio_run_description = "
|
|
13
|
+
studio_run_description = "Run a job in Studio."
|
|
17
14
|
|
|
18
15
|
studio_run_parser = jobs_subparser.add_parser(
|
|
19
16
|
"run",
|
|
@@ -25,56 +22,56 @@ def add_jobs_parser(subparsers, parent_parser) -> None:
|
|
|
25
22
|
studio_run_parser.add_argument(
|
|
26
23
|
"query_file",
|
|
27
24
|
action="store",
|
|
28
|
-
help="
|
|
25
|
+
help="Query file to run",
|
|
29
26
|
)
|
|
30
27
|
|
|
31
28
|
studio_run_parser.add_argument(
|
|
32
29
|
"--team",
|
|
33
30
|
action="store",
|
|
34
31
|
default=None,
|
|
35
|
-
help="
|
|
32
|
+
help="Team to run job for (default: from config)",
|
|
36
33
|
)
|
|
37
34
|
studio_run_parser.add_argument(
|
|
38
35
|
"--env-file",
|
|
39
36
|
action="store",
|
|
40
|
-
help="File
|
|
37
|
+
help="File with environment variables for the job",
|
|
41
38
|
)
|
|
42
39
|
|
|
43
40
|
studio_run_parser.add_argument(
|
|
44
41
|
"--env",
|
|
45
42
|
nargs="+",
|
|
46
|
-
help="Environment
|
|
43
|
+
help="Environment variables in KEY=VALUE format",
|
|
47
44
|
)
|
|
48
45
|
|
|
49
46
|
studio_run_parser.add_argument(
|
|
50
47
|
"--workers",
|
|
51
48
|
type=int,
|
|
52
|
-
help="Number of workers
|
|
49
|
+
help="Number of workers for the job",
|
|
53
50
|
)
|
|
54
51
|
studio_run_parser.add_argument(
|
|
55
52
|
"--files",
|
|
56
53
|
nargs="+",
|
|
57
|
-
help="
|
|
54
|
+
help="Additional files to include in the job",
|
|
58
55
|
)
|
|
59
56
|
studio_run_parser.add_argument(
|
|
60
57
|
"--python-version",
|
|
61
58
|
action="store",
|
|
62
|
-
help="Python version
|
|
59
|
+
help="Python version for the job (e.g., 3.9, 3.10, 3.11)",
|
|
63
60
|
)
|
|
64
61
|
studio_run_parser.add_argument(
|
|
65
62
|
"--req-file",
|
|
66
63
|
action="store",
|
|
67
|
-
help="
|
|
64
|
+
help="Python requirements file",
|
|
68
65
|
)
|
|
69
66
|
|
|
70
67
|
studio_run_parser.add_argument(
|
|
71
68
|
"--req",
|
|
72
69
|
nargs="+",
|
|
73
|
-
help="Python package
|
|
70
|
+
help="Python package requirements",
|
|
74
71
|
)
|
|
75
72
|
|
|
76
73
|
studio_cancel_help = "Cancel a job in Studio"
|
|
77
|
-
studio_cancel_description = "
|
|
74
|
+
studio_cancel_description = "Cancel a running job in Studio."
|
|
78
75
|
|
|
79
76
|
studio_cancel_parser = jobs_subparser.add_parser(
|
|
80
77
|
"cancel",
|
|
@@ -86,19 +83,17 @@ def add_jobs_parser(subparsers, parent_parser) -> None:
|
|
|
86
83
|
studio_cancel_parser.add_argument(
|
|
87
84
|
"job_id",
|
|
88
85
|
action="store",
|
|
89
|
-
help="
|
|
86
|
+
help="Job ID to cancel",
|
|
90
87
|
)
|
|
91
88
|
studio_cancel_parser.add_argument(
|
|
92
89
|
"--team",
|
|
93
90
|
action="store",
|
|
94
91
|
default=None,
|
|
95
|
-
help="
|
|
92
|
+
help="Team to cancel job for (default: from config)",
|
|
96
93
|
)
|
|
97
94
|
|
|
98
|
-
studio_log_help = "Show
|
|
99
|
-
studio_log_description =
|
|
100
|
-
"This will display the logs and latest status of jobs in Studio"
|
|
101
|
-
)
|
|
95
|
+
studio_log_help = "Show job logs and status in Studio"
|
|
96
|
+
studio_log_description = "Display logs and current status of jobs in Studio."
|
|
102
97
|
|
|
103
98
|
studio_log_parser = jobs_subparser.add_parser(
|
|
104
99
|
"logs",
|
|
@@ -110,11 +105,11 @@ def add_jobs_parser(subparsers, parent_parser) -> None:
|
|
|
110
105
|
studio_log_parser.add_argument(
|
|
111
106
|
"job_id",
|
|
112
107
|
action="store",
|
|
113
|
-
help="
|
|
108
|
+
help="Job ID to show logs for",
|
|
114
109
|
)
|
|
115
110
|
studio_log_parser.add_argument(
|
|
116
111
|
"--team",
|
|
117
112
|
action="store",
|
|
118
113
|
default=None,
|
|
119
|
-
help="
|
|
114
|
+
help="Team to check logs for (default: from config)",
|
|
120
115
|
)
|