data-ops-cli 0.5.4__tar.gz → 0.5.6__tar.gz
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.
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/PKG-INFO +1 -1
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/PKG-INFO +1 -1
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/__init__.py +1 -1
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/skill.py +163 -1
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/README.md +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/pyproject.toml +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/setup.cfg +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/SOURCES.txt +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/dependency_links.txt +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/entry_points.txt +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/requires.txt +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/data_ops_cli.egg-info/top_level.txt +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/_compat.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/__init__.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/api.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/auth.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/data_table.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/dataset.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/datasource.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/dict_.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/factory.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/kb.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/metrics.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/ontology.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/ref.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/report.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/table.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/tag.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/utils.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/widget.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/cli/workflow.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/exceptions.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/runner.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/schems.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/sdk.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/session.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/src/dataops_cli/utils.py +0 -0
- {data_ops_cli-0.5.4 → data_ops_cli-0.5.6}/tests/test_table_relation.py +0 -0
|
@@ -15,14 +15,21 @@ from dataops_sdk.exceptions import DataOpsError
|
|
|
15
15
|
from dataops_sdk.schemas import MetaSkillFileSubType, MetaSkillSubType, MetaType
|
|
16
16
|
from dataops_sdk.services import (
|
|
17
17
|
SkillPackValidationError,
|
|
18
|
+
release_list_get_by_name,
|
|
18
19
|
service_delete_skill,
|
|
19
20
|
service_get_skill_by_name,
|
|
20
21
|
service_list_skill_files,
|
|
21
22
|
service_list_skills,
|
|
22
23
|
service_pack_skill_zip,
|
|
24
|
+
service_skill_bind_ontology,
|
|
23
25
|
service_skill_call_by_name,
|
|
24
26
|
service_skill_delete_sub_file,
|
|
25
27
|
service_skill_download,
|
|
28
|
+
service_skill_followup_add,
|
|
29
|
+
service_skill_followup_list,
|
|
30
|
+
service_skill_followup_remove,
|
|
31
|
+
service_skill_followup_set,
|
|
32
|
+
service_skill_get_bindings,
|
|
26
33
|
service_skill_list_skill_codes_by_ontology,
|
|
27
34
|
service_skill_update,
|
|
28
35
|
service_skill_upload,
|
|
@@ -53,8 +60,20 @@ skill_ontology_typer = typer.Typer(
|
|
|
53
60
|
help="技能与本体归属",
|
|
54
61
|
no_args_is_help=True,
|
|
55
62
|
)
|
|
63
|
+
skill_bind_typer = typer.Typer(
|
|
64
|
+
name="bind",
|
|
65
|
+
help="技能归属本体与后续动作",
|
|
66
|
+
no_args_is_help=True,
|
|
67
|
+
)
|
|
68
|
+
skill_followup_typer = typer.Typer(
|
|
69
|
+
name="followup",
|
|
70
|
+
help="后续动作",
|
|
71
|
+
no_args_is_help=True,
|
|
72
|
+
)
|
|
56
73
|
skill_typer.add_typer(skill_file_typer)
|
|
57
74
|
skill_typer.add_typer(skill_ontology_typer)
|
|
75
|
+
skill_typer.add_typer(skill_bind_typer)
|
|
76
|
+
skill_bind_typer.add_typer(skill_followup_typer)
|
|
58
77
|
MAKRDOWN_TABLE_STYLE = TableStyle.MARKDOWN
|
|
59
78
|
|
|
60
79
|
|
|
@@ -74,6 +93,124 @@ def ontology_skill_codes_cmd(
|
|
|
74
93
|
print(json.dumps(codes, ensure_ascii=False, indent=2))
|
|
75
94
|
|
|
76
95
|
|
|
96
|
+
def _resolve_ontology_code(ontology_code: str | None, ontology_name: str | None) -> str | None:
|
|
97
|
+
if ontology_code and ontology_name:
|
|
98
|
+
typer.echo("错误: --ontology-code 与 --ontology-name 不能同时使用")
|
|
99
|
+
raise typer.Exit(code=2)
|
|
100
|
+
if ontology_name:
|
|
101
|
+
meta = release_list_get_by_name(MetaType.ONTOLOGY, ontology_name)
|
|
102
|
+
return meta.code
|
|
103
|
+
return ontology_code
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
@skill_bind_typer.command("show", no_args_is_help=True)
|
|
107
|
+
def bind_show_cmd(name: Annotated[str, typer.Argument(help="技能业务名")]) -> None:
|
|
108
|
+
"""查看技能归属本体与后续动作。"""
|
|
109
|
+
try:
|
|
110
|
+
bindings = service_skill_get_bindings(name)
|
|
111
|
+
except (DataOpsError, ValueError) as e:
|
|
112
|
+
message = e.message if isinstance(e, DataOpsError) else str(e)
|
|
113
|
+
typer.echo(f"错误: {message}")
|
|
114
|
+
raise typer.Exit(code=1) from None
|
|
115
|
+
print(json.dumps(bindings, ensure_ascii=False, indent=2))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@skill_bind_typer.command("ontology", no_args_is_help=True)
|
|
119
|
+
def bind_ontology_cmd(
|
|
120
|
+
name: Annotated[str, typer.Argument(help="技能业务名")],
|
|
121
|
+
ontology_code: Annotated[
|
|
122
|
+
str | None,
|
|
123
|
+
typer.Option("--ontology-code", help="本体 meta code"),
|
|
124
|
+
] = None,
|
|
125
|
+
ontology_name: Annotated[
|
|
126
|
+
str | None,
|
|
127
|
+
typer.Option("--ontology-name", help="本体业务名,会解析为 code"),
|
|
128
|
+
] = None,
|
|
129
|
+
clear: Annotated[bool, typer.Option("--clear", help="解除归属本体")] = False,
|
|
130
|
+
) -> None:
|
|
131
|
+
"""绑定或解除技能归属本体。"""
|
|
132
|
+
if clear and (ontology_code or ontology_name):
|
|
133
|
+
typer.echo("错误: --clear 不能与本体参数同时使用")
|
|
134
|
+
raise typer.Exit(code=2)
|
|
135
|
+
if not clear and not ontology_code and not ontology_name:
|
|
136
|
+
typer.echo("错误: 请指定 --ontology-code、--ontology-name 或 --clear")
|
|
137
|
+
raise typer.Exit(code=2)
|
|
138
|
+
try:
|
|
139
|
+
code = None if clear else _resolve_ontology_code(ontology_code, ontology_name)
|
|
140
|
+
service_skill_bind_ontology(name, code, clear=clear)
|
|
141
|
+
except (DataOpsError, ValueError) as e:
|
|
142
|
+
message = e.message if isinstance(e, DataOpsError) else str(e)
|
|
143
|
+
typer.echo(f"错误: {message}")
|
|
144
|
+
raise typer.Exit(code=1) from None
|
|
145
|
+
print("绑定已更新")
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
@skill_followup_typer.command("list", no_args_is_help=True)
|
|
149
|
+
def followup_list_cmd(name: Annotated[str, typer.Argument(help="技能业务名")]) -> None:
|
|
150
|
+
"""列出后续动作。"""
|
|
151
|
+
try:
|
|
152
|
+
items = service_skill_followup_list(name)
|
|
153
|
+
except DataOpsError as e:
|
|
154
|
+
typer.echo(f"错误: {e.message}")
|
|
155
|
+
raise typer.Exit(code=1) from None
|
|
156
|
+
print(json.dumps(items, ensure_ascii=False, indent=2))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@skill_followup_typer.command("set", no_args_is_help=True)
|
|
160
|
+
def followup_set_cmd(
|
|
161
|
+
name: Annotated[str, typer.Argument(help="技能业务名")],
|
|
162
|
+
file: Annotated[Path, typer.Option("--file", help="后续动作 JSON 数组文件")],
|
|
163
|
+
) -> None:
|
|
164
|
+
"""用 JSON 文件全量替换后续动作。"""
|
|
165
|
+
if not file.exists():
|
|
166
|
+
typer.echo(f"错误: 文件不存在 {file}")
|
|
167
|
+
raise typer.Exit(code=2)
|
|
168
|
+
try:
|
|
169
|
+
payload = from_json(file.read_bytes())
|
|
170
|
+
if not isinstance(payload, list):
|
|
171
|
+
typer.echo("错误: JSON 须为数组")
|
|
172
|
+
raise typer.Exit(code=2)
|
|
173
|
+
service_skill_followup_set(name, payload)
|
|
174
|
+
except (DataOpsError, ValueError) as e:
|
|
175
|
+
message = e.message if isinstance(e, DataOpsError) else str(e)
|
|
176
|
+
typer.echo(f"错误: {message}")
|
|
177
|
+
raise typer.Exit(code=1) from None
|
|
178
|
+
print("后续动作已更新")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@skill_followup_typer.command("add", no_args_is_help=True)
|
|
182
|
+
def followup_add_cmd(
|
|
183
|
+
name: Annotated[str, typer.Argument(help="技能业务名")],
|
|
184
|
+
ref_type: Annotated[str, typer.Option("--type", help="目标类型 skill 或 workflow")],
|
|
185
|
+
code: Annotated[str, typer.Option("--code", help="目标 meta code")],
|
|
186
|
+
description: Annotated[str | None, typer.Option("--description", help="推荐描述")] = None,
|
|
187
|
+
) -> None:
|
|
188
|
+
"""追加一条后续动作。"""
|
|
189
|
+
try:
|
|
190
|
+
service_skill_followup_add(name, ref_type, code, description)
|
|
191
|
+
except (DataOpsError, ValueError) as e:
|
|
192
|
+
message = e.message if isinstance(e, DataOpsError) else str(e)
|
|
193
|
+
typer.echo(f"错误: {message}")
|
|
194
|
+
raise typer.Exit(code=1) from None
|
|
195
|
+
print("已添加后续动作")
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@skill_followup_typer.command("remove", no_args_is_help=True)
|
|
199
|
+
def followup_remove_cmd(
|
|
200
|
+
name: Annotated[str, typer.Argument(help="技能业务名")],
|
|
201
|
+
index: Annotated[int | None, typer.Option("--index", help="列表下标,从 0 开始")] = None,
|
|
202
|
+
followup_id: Annotated[str | None, typer.Option("--id", help="后续动作 id")] = None,
|
|
203
|
+
) -> None:
|
|
204
|
+
"""删除一条后续动作。"""
|
|
205
|
+
try:
|
|
206
|
+
service_skill_followup_remove(name, index=index, followup_id=followup_id)
|
|
207
|
+
except (DataOpsError, ValueError) as e:
|
|
208
|
+
message = e.message if isinstance(e, DataOpsError) else str(e)
|
|
209
|
+
typer.echo(f"错误: {message}")
|
|
210
|
+
raise typer.Exit(code=1) from None
|
|
211
|
+
print("已删除后续动作")
|
|
212
|
+
|
|
213
|
+
|
|
77
214
|
@skill_typer.command("list")
|
|
78
215
|
def list_cmd(
|
|
79
216
|
sub_types: Annotated[
|
|
@@ -154,6 +291,10 @@ def upload_cmd(
|
|
|
154
291
|
typer.Option("--type", help="技能子类型"),
|
|
155
292
|
],
|
|
156
293
|
title: Annotated[str | None, typer.Option("--title", help="技能简体中文名称")] = None,
|
|
294
|
+
ontology_code: Annotated[
|
|
295
|
+
str | None,
|
|
296
|
+
typer.Option("--ontology-code", help="发布时绑定的本体 meta code"),
|
|
297
|
+
] = None,
|
|
157
298
|
) -> None:
|
|
158
299
|
"""从 ZIP 包导入技能到技能中心。
|
|
159
300
|
|
|
@@ -169,6 +310,7 @@ def upload_cmd(
|
|
|
169
310
|
file_path=str(file),
|
|
170
311
|
sub_type=dtype,
|
|
171
312
|
title=title,
|
|
313
|
+
ontology_code=ontology_code,
|
|
172
314
|
)
|
|
173
315
|
except DataOpsError as e:
|
|
174
316
|
typer.echo(f"错误: {e.message}")
|
|
@@ -185,6 +327,14 @@ def update_cmd(
|
|
|
185
327
|
typer.Option("--type", help="技能子类型(可选)"),
|
|
186
328
|
] = None,
|
|
187
329
|
title: Annotated[str | None, typer.Option("--title", help="技能简体中文名称")] = None,
|
|
330
|
+
ontology_code: Annotated[
|
|
331
|
+
str | None,
|
|
332
|
+
typer.Option("--ontology-code", help="更新时绑定的本体 meta code"),
|
|
333
|
+
] = None,
|
|
334
|
+
clear_ontology: Annotated[
|
|
335
|
+
bool,
|
|
336
|
+
typer.Option("--clear-ontology", help="更新时解除归属本体"),
|
|
337
|
+
] = False,
|
|
188
338
|
) -> None:
|
|
189
339
|
"""全量覆盖更新已有技能。
|
|
190
340
|
|
|
@@ -195,6 +345,9 @@ def update_cmd(
|
|
|
195
345
|
if not file.exists():
|
|
196
346
|
typer.echo(f"错误: 文件不存在 {file}")
|
|
197
347
|
raise typer.Exit(code=2)
|
|
348
|
+
if clear_ontology and ontology_code:
|
|
349
|
+
typer.echo("错误: --ontology-code 与 --clear-ontology 不能同时使用")
|
|
350
|
+
raise typer.Exit(code=2)
|
|
198
351
|
|
|
199
352
|
try:
|
|
200
353
|
service_skill_update(
|
|
@@ -202,6 +355,8 @@ def update_cmd(
|
|
|
202
355
|
file_path=str(file),
|
|
203
356
|
sub_type=dtype,
|
|
204
357
|
title=title,
|
|
358
|
+
ontology_code=ontology_code,
|
|
359
|
+
clear_ontology=clear_ontology,
|
|
205
360
|
)
|
|
206
361
|
except DataOpsError as e:
|
|
207
362
|
typer.echo(f"错误: {e.message}")
|
|
@@ -310,6 +465,10 @@ def call_cmd(
|
|
|
310
465
|
str,
|
|
311
466
|
typer.Option("--input", "-i", help="入参 JSON 对象,如 '{\"a\": 1}'"),
|
|
312
467
|
] = "{}",
|
|
468
|
+
timeout: Annotated[
|
|
469
|
+
int | None,
|
|
470
|
+
typer.Option("--timeout", help="执行超时,单位秒"),
|
|
471
|
+
] = None,
|
|
313
472
|
) -> None:
|
|
314
473
|
"""调用 skill 同步执行,等待 Python 容器返回结果。
|
|
315
474
|
|
|
@@ -326,7 +485,10 @@ def call_cmd(
|
|
|
326
485
|
raise typer.Exit(code=2) from None
|
|
327
486
|
|
|
328
487
|
try:
|
|
329
|
-
result = service_skill_call_by_name(name, inputs)
|
|
488
|
+
result = service_skill_call_by_name(name, inputs, timeout)
|
|
489
|
+
except ValueError as e:
|
|
490
|
+
typer.echo(f"错误: {e}")
|
|
491
|
+
raise typer.Exit(code=2) from None
|
|
330
492
|
except DataOpsError as e:
|
|
331
493
|
typer.echo(f"错误: {e.message}")
|
|
332
494
|
raise typer.Exit(code=1) from None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|