synapse-sdk 2025.9.1__py3-none-any.whl → 2025.9.3__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 synapse-sdk might be problematic. Click here for more details.
- synapse_sdk/devtools/docs/docs/api/clients/annotation-mixin.md +378 -0
- synapse_sdk/devtools/docs/docs/api/clients/backend.md +368 -1
- synapse_sdk/devtools/docs/docs/api/clients/core-mixin.md +477 -0
- synapse_sdk/devtools/docs/docs/api/clients/data-collection-mixin.md +422 -0
- synapse_sdk/devtools/docs/docs/api/clients/hitl-mixin.md +554 -0
- synapse_sdk/devtools/docs/docs/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/docs/api/clients/integration-mixin.md +571 -0
- synapse_sdk/devtools/docs/docs/api/clients/ml-mixin.md +578 -0
- synapse_sdk/devtools/docs/docs/plugins/developing-upload-template.md +1463 -0
- synapse_sdk/devtools/docs/docs/plugins/export-plugins.md +161 -34
- synapse_sdk/devtools/docs/docs/plugins/upload-plugins.md +1497 -213
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/annotation-mixin.md +289 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/backend.md +378 -11
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/core-mixin.md +417 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/data-collection-mixin.md +356 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/hitl-mixin.md +192 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/index.md +391 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/integration-mixin.md +479 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/api/clients/ml-mixin.md +284 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/developing-upload-template.md +1463 -0
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/export-plugins.md +161 -34
- synapse_sdk/devtools/docs/i18n/ko/docusaurus-plugin-content-docs/current/plugins/upload-plugins.md +1752 -572
- synapse_sdk/devtools/docs/sidebars.ts +7 -0
- synapse_sdk/plugins/README.md +1 -2
- synapse_sdk/plugins/categories/base.py +23 -0
- synapse_sdk/plugins/categories/export/actions/__init__.py +3 -0
- synapse_sdk/plugins/categories/export/actions/export/__init__.py +28 -0
- synapse_sdk/plugins/categories/export/actions/export/action.py +160 -0
- synapse_sdk/plugins/categories/export/actions/export/enums.py +113 -0
- synapse_sdk/plugins/categories/export/actions/export/exceptions.py +53 -0
- synapse_sdk/plugins/categories/export/actions/export/models.py +74 -0
- synapse_sdk/plugins/categories/export/actions/export/run.py +195 -0
- synapse_sdk/plugins/categories/export/actions/export/utils.py +187 -0
- synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +1 -1
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +1 -2
- synapse_sdk/plugins/categories/upload/actions/upload/action.py +154 -531
- synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
- synapse_sdk/plugins/categories/upload/actions/upload/factory.py +143 -0
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +66 -29
- synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +182 -0
- synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +106 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +80 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +66 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +101 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +89 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +96 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +61 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +86 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/batch.py +39 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/data_unit/single.py +34 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/flat.py +233 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +238 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/excel.py +174 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/metadata/none.py +16 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/async_upload.py +109 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/upload/sync.py +43 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/validation/default.py +45 -0
- synapse_sdk/plugins/categories/upload/actions/upload/utils.py +194 -83
- synapse_sdk/plugins/categories/upload/templates/config.yaml +4 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +269 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +71 -27
- synapse_sdk/plugins/models.py +5 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/METADATA +2 -1
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/RECORD +78 -27
- synapse_sdk/plugins/categories/export/actions/export.py +0 -385
- synapse_sdk/plugins/categories/export/enums.py +0 -7
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/WHEEL +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-2025.9.1.dist-info → synapse_sdk-2025.9.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: integration-mixin
|
|
3
|
+
title: IntegrationClientMixin
|
|
4
|
+
sidebar_position: 15
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# IntegrationClientMixin
|
|
8
|
+
|
|
9
|
+
Synapse 백엔드를 위한 플러그인 관리, 작업 실행, 시스템 통합 작업을 제공합니다.
|
|
10
|
+
|
|
11
|
+
## 개요
|
|
12
|
+
|
|
13
|
+
`IntegrationClientMixin`은 플러그인, 작업, 에이전트, 스토리지 관리와 관련된 모든 작업을 처리합니다. 이 믹스인은 `BackendClient`에 자동으로 포함되며 시스템 통합 및 자동화 워크플로를 위한 메서드를 제공합니다.
|
|
14
|
+
|
|
15
|
+
## 에이전트 작업
|
|
16
|
+
|
|
17
|
+
### `health_check_agent(token)`
|
|
18
|
+
|
|
19
|
+
에이전트의 상태를 확인합니다.
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
# 에이전트 상태 확인
|
|
23
|
+
status = client.health_check_agent('agent-token-123')
|
|
24
|
+
print(f"에이전트 상태: {status}")
|
|
25
|
+
|
|
26
|
+
# 에이전트 연결 확인
|
|
27
|
+
try:
|
|
28
|
+
health = client.health_check_agent('my-agent-token')
|
|
29
|
+
print("에이전트가 정상이고 연결됨")
|
|
30
|
+
except ClientError as e:
|
|
31
|
+
print(f"에이전트 상태 확인 실패: {e}")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**매개변수:**
|
|
35
|
+
|
|
36
|
+
- `token` (str): 에이전트 인증 토큰
|
|
37
|
+
|
|
38
|
+
**반환값:**
|
|
39
|
+
|
|
40
|
+
- `dict`: 에이전트 상태 및 연결 정보
|
|
41
|
+
|
|
42
|
+
## 플러그인 관리
|
|
43
|
+
|
|
44
|
+
### `get_plugin(pk)`
|
|
45
|
+
|
|
46
|
+
특정 플러그인에 대한 상세 정보를 가져옵니다.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
plugin = client.get_plugin(123)
|
|
50
|
+
print(f"플러그인: {plugin['name']}")
|
|
51
|
+
print(f"버전: {plugin['version']}")
|
|
52
|
+
print(f"설명: {plugin['description']}")
|
|
53
|
+
print(f"작성자: {plugin['author']}")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**매개변수:**
|
|
57
|
+
|
|
58
|
+
- `pk` (int): 플러그인 ID
|
|
59
|
+
|
|
60
|
+
**반환값:**
|
|
61
|
+
|
|
62
|
+
- `dict`: 메타데이터 및 구성을 포함한 완전한 플러그인 정보
|
|
63
|
+
|
|
64
|
+
### `create_plugin(data)`
|
|
65
|
+
|
|
66
|
+
시스템에 새로운 플러그인을 생성합니다.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
plugin_data = {
|
|
70
|
+
'name': 'My Custom Plugin',
|
|
71
|
+
'description': '사용자 정의 데이터 처리를 위한 플러그인',
|
|
72
|
+
'version': '1.0.0',
|
|
73
|
+
'author': 'Your Name',
|
|
74
|
+
'category': 'data_processing',
|
|
75
|
+
'configuration': {
|
|
76
|
+
'parameters': {
|
|
77
|
+
'threshold': {'type': 'float', 'default': 0.5},
|
|
78
|
+
'max_items': {'type': 'int', 'default': 100}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
new_plugin = client.create_plugin(plugin_data)
|
|
84
|
+
print(f"ID {new_plugin['id']}로 플러그인 생성됨")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**매개변수:**
|
|
88
|
+
|
|
89
|
+
- `data` (dict): 플러그인 구성 및 메타데이터
|
|
90
|
+
|
|
91
|
+
**플러그인 데이터 구조:**
|
|
92
|
+
|
|
93
|
+
- `name` (str, 필수): 플러그인 이름
|
|
94
|
+
- `description` (str): 플러그인 설명
|
|
95
|
+
- `version` (str): 플러그인 버전
|
|
96
|
+
- `author` (str): 플러그인 작성자
|
|
97
|
+
- `category` (str): 플러그인 카테고리
|
|
98
|
+
- `configuration` (dict): 플러그인 구성 스키마
|
|
99
|
+
|
|
100
|
+
**반환값:**
|
|
101
|
+
|
|
102
|
+
- `dict`: 생성된 ID가 포함된 생성된 플러그인
|
|
103
|
+
|
|
104
|
+
### `update_plugin(pk, data)`
|
|
105
|
+
|
|
106
|
+
기존 플러그인을 업데이트합니다.
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
# 플러그인 설명 및 버전 업데이트
|
|
110
|
+
updated_data = {
|
|
111
|
+
'description': '업데이트된 플러그인 설명',
|
|
112
|
+
'version': '1.1.0',
|
|
113
|
+
'configuration': {
|
|
114
|
+
'parameters': {
|
|
115
|
+
'threshold': {'type': 'float', 'default': 0.7},
|
|
116
|
+
'max_items': {'type': 'int', 'default': 200},
|
|
117
|
+
'new_param': {'type': 'string', 'default': 'default_value'}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
updated_plugin = client.update_plugin(123, updated_data)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**매개변수:**
|
|
126
|
+
|
|
127
|
+
- `pk` (int): 플러그인 ID
|
|
128
|
+
- `data` (dict): 업데이트된 플러그인 데이터
|
|
129
|
+
|
|
130
|
+
**반환값:**
|
|
131
|
+
|
|
132
|
+
- `dict`: 업데이트된 플러그인 정보
|
|
133
|
+
|
|
134
|
+
### `run_plugin(pk, data)`
|
|
135
|
+
|
|
136
|
+
지정된 매개변수로 플러그인을 실행합니다.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# 매개변수와 함께 플러그인 실행
|
|
140
|
+
execution_data = {
|
|
141
|
+
'parameters': {
|
|
142
|
+
'threshold': 0.8,
|
|
143
|
+
'max_items': 150,
|
|
144
|
+
'input_path': '/data/input/',
|
|
145
|
+
'output_path': '/data/output/'
|
|
146
|
+
},
|
|
147
|
+
'context': {
|
|
148
|
+
'project_id': 123,
|
|
149
|
+
'user_id': 456,
|
|
150
|
+
'execution_mode': 'batch'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
result = client.run_plugin(123, execution_data)
|
|
155
|
+
print(f"플러그인 실행 시작됨: {result['job_id']}")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**매개변수:**
|
|
159
|
+
|
|
160
|
+
- `pk` (int): 플러그인 ID
|
|
161
|
+
- `data` (dict): 실행 매개변수 및 컨텍스트
|
|
162
|
+
|
|
163
|
+
**실행 데이터 구조:**
|
|
164
|
+
|
|
165
|
+
- `parameters` (dict): 플러그인별 매개변수
|
|
166
|
+
- `context` (dict): 실행 컨텍스트 정보
|
|
167
|
+
|
|
168
|
+
**반환값:**
|
|
169
|
+
|
|
170
|
+
- `dict`: 작업 정보가 포함된 실행 결과
|
|
171
|
+
|
|
172
|
+
## 플러그인 릴리스 관리
|
|
173
|
+
|
|
174
|
+
### `get_plugin_release(pk, params=None)`
|
|
175
|
+
|
|
176
|
+
특정 플러그인 릴리스에 대한 정보를 가져옵니다.
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
# 릴리스 정보 가져오기
|
|
180
|
+
release = client.get_plugin_release(456)
|
|
181
|
+
print(f"플러그인 {release['plugin']}의 릴리스 {release['version']}")
|
|
182
|
+
|
|
183
|
+
# 확장된 플러그인 정보와 함께 릴리스 가져오기
|
|
184
|
+
release = client.get_plugin_release(456, params={'expand': 'plugin'})
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**매개변수:**
|
|
188
|
+
|
|
189
|
+
- `pk` (int): 플러그인 릴리스 ID
|
|
190
|
+
- `params` (dict, 선택사항): 쿼리 매개변수
|
|
191
|
+
|
|
192
|
+
**반환값:**
|
|
193
|
+
|
|
194
|
+
- `dict`: 플러그인 릴리스 정보
|
|
195
|
+
|
|
196
|
+
### `create_plugin_release(data)`
|
|
197
|
+
|
|
198
|
+
파일 업로드와 함께 새로운 플러그인 릴리스를 생성합니다.
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
# 플러그인 릴리스 생성
|
|
202
|
+
release_data = {
|
|
203
|
+
'plugin': 123,
|
|
204
|
+
'version': '2.0.0',
|
|
205
|
+
'changelog': '새로운 기능 및 버그 수정 추가',
|
|
206
|
+
'is_stable': True,
|
|
207
|
+
'file': open('/path/to/plugin_v2.zip', 'rb')
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
new_release = client.create_plugin_release(release_data)
|
|
211
|
+
print(f"릴리스 생성됨: {new_release['id']}")
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**매개변수:**
|
|
215
|
+
|
|
216
|
+
- `data` (dict): 파일을 포함한 릴리스 데이터
|
|
217
|
+
|
|
218
|
+
**릴리스 데이터 구조:**
|
|
219
|
+
|
|
220
|
+
- `plugin` (int, 필수): 플러그인 ID
|
|
221
|
+
- `version` (str, 필수): 릴리스 버전
|
|
222
|
+
- `changelog` (str): 릴리스 노트
|
|
223
|
+
- `is_stable` (bool): 안정 릴리스 여부
|
|
224
|
+
- `file` (file object, 필수): 플러그인 패키지 파일
|
|
225
|
+
|
|
226
|
+
**반환값:**
|
|
227
|
+
|
|
228
|
+
- `dict`: 생성된 플러그인 릴리스 정보
|
|
229
|
+
|
|
230
|
+
## 작업 관리
|
|
231
|
+
|
|
232
|
+
### `get_job(pk, params=None)`
|
|
233
|
+
|
|
234
|
+
작업에 대한 상세 정보를 가져옵니다.
|
|
235
|
+
|
|
236
|
+
```python
|
|
237
|
+
# 기본 작업 정보 가져오기
|
|
238
|
+
job = client.get_job(789)
|
|
239
|
+
print(f"작업 {job['id']}: {job['status']}")
|
|
240
|
+
|
|
241
|
+
# 로그와 함께 작업 가져오기
|
|
242
|
+
job = client.get_job(789, params={'expand': 'logs'})
|
|
243
|
+
print(f"작업 로그: {job['logs']}")
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**매개변수:**
|
|
247
|
+
|
|
248
|
+
- `pk` (int): 작업 ID
|
|
249
|
+
- `params` (dict, 선택사항): 쿼리 매개변수
|
|
250
|
+
|
|
251
|
+
**일반적인 params:**
|
|
252
|
+
|
|
253
|
+
- `expand`: 추가 데이터 포함 (`logs`, `metrics`, `result`)
|
|
254
|
+
|
|
255
|
+
**반환값:**
|
|
256
|
+
|
|
257
|
+
- `dict`: 완전한 작업 정보
|
|
258
|
+
|
|
259
|
+
### `list_jobs(params=None)`
|
|
260
|
+
|
|
261
|
+
필터링 옵션과 함께 작업을 나열합니다.
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
# 모든 작업 나열
|
|
265
|
+
jobs = client.list_jobs()
|
|
266
|
+
|
|
267
|
+
# 상태별 작업 나열
|
|
268
|
+
running_jobs = client.list_jobs(params={'status': 'running'})
|
|
269
|
+
|
|
270
|
+
# 특정 플러그인의 작업 나열
|
|
271
|
+
plugin_jobs = client.list_jobs(params={'plugin': 123})
|
|
272
|
+
|
|
273
|
+
# 최근 작업 나열
|
|
274
|
+
from datetime import datetime, timedelta
|
|
275
|
+
recent_date = (datetime.now() - timedelta(days=7)).isoformat()
|
|
276
|
+
recent_jobs = client.list_jobs(params={'created_after': recent_date})
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**매개변수:**
|
|
280
|
+
|
|
281
|
+
- `params` (dict, 선택사항): 필터링 매개변수
|
|
282
|
+
|
|
283
|
+
**일반적인 필터링 params:**
|
|
284
|
+
|
|
285
|
+
- `status`: 작업 상태로 필터링 (`queued`, `running`, `completed`, `failed`)
|
|
286
|
+
- `plugin`: 플러그인 ID로 필터링
|
|
287
|
+
- `created_after`: 생성 날짜로 필터링
|
|
288
|
+
- `user`: 사용자 ID로 필터링
|
|
289
|
+
|
|
290
|
+
**반환값:**
|
|
291
|
+
|
|
292
|
+
- `tuple`: (jobs_list, total_count)
|
|
293
|
+
|
|
294
|
+
### `update_job(pk, data)`
|
|
295
|
+
|
|
296
|
+
작업 상태 또는 메타데이터를 업데이트합니다.
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
# 작업 상태 업데이트
|
|
300
|
+
client.update_job(789, {'status': 'completed'})
|
|
301
|
+
|
|
302
|
+
# 결과 데이터와 함께 작업 업데이트
|
|
303
|
+
client.update_job(789, {
|
|
304
|
+
'status': 'completed',
|
|
305
|
+
'result': {
|
|
306
|
+
'output_files': ['file1.txt', 'file2.txt'],
|
|
307
|
+
'metrics': {'accuracy': 0.95, 'processing_time': 120}
|
|
308
|
+
}
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
# 작업 진행률 업데이트
|
|
312
|
+
client.update_job(789, {
|
|
313
|
+
'progress': 75,
|
|
314
|
+
'status': 'running',
|
|
315
|
+
'metadata': {'current_step': 'processing_images'}
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**매개변수:**
|
|
320
|
+
|
|
321
|
+
- `pk` (int): 작업 ID
|
|
322
|
+
- `data` (dict): 업데이트 데이터
|
|
323
|
+
|
|
324
|
+
**업데이트 가능한 필드:**
|
|
325
|
+
|
|
326
|
+
- `status`: 작업 상태
|
|
327
|
+
- `progress`: 진행률 백분율 (0-100)
|
|
328
|
+
- `result`: 작업 결과 데이터
|
|
329
|
+
- `metadata`: 추가 작업 메타데이터
|
|
330
|
+
|
|
331
|
+
**반환값:**
|
|
332
|
+
|
|
333
|
+
- `dict`: 업데이트된 작업 정보
|
|
334
|
+
|
|
335
|
+
### `list_job_console_logs(pk)`
|
|
336
|
+
|
|
337
|
+
특정 작업의 콘솔 로그를 가져옵니다.
|
|
338
|
+
|
|
339
|
+
```python
|
|
340
|
+
# 작업 콘솔 로그 가져오기
|
|
341
|
+
logs = client.list_job_console_logs(789)
|
|
342
|
+
for log_entry in logs:
|
|
343
|
+
print(f"[{log_entry['timestamp']}] {log_entry['level']}: {log_entry['message']}")
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**매개변수:**
|
|
347
|
+
|
|
348
|
+
- `pk` (int): 작업 ID
|
|
349
|
+
|
|
350
|
+
**반환값:**
|
|
351
|
+
|
|
352
|
+
- `list`: 타임스탬프와 레벨이 포함된 콘솔 로그 항목
|
|
353
|
+
|
|
354
|
+
## 스토리지 관리
|
|
355
|
+
|
|
356
|
+
### `list_storages()`
|
|
357
|
+
|
|
358
|
+
사용 가능한 모든 스토리지 구성을 나열합니다.
|
|
359
|
+
|
|
360
|
+
```python
|
|
361
|
+
storages = client.list_storages()
|
|
362
|
+
for storage in storages:
|
|
363
|
+
print(f"스토리지: {storage['name']} ({storage['provider']})")
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
**반환값:**
|
|
367
|
+
|
|
368
|
+
- `list`: 사용 가능한 스토리지 구성
|
|
369
|
+
|
|
370
|
+
### `get_storage(pk)`
|
|
371
|
+
|
|
372
|
+
특정 스토리지에 대한 상세 정보를 가져옵니다.
|
|
373
|
+
|
|
374
|
+
```python
|
|
375
|
+
storage = client.get_storage(123)
|
|
376
|
+
print(f"스토리지: {storage['name']}")
|
|
377
|
+
print(f"제공업체: {storage['provider']}")
|
|
378
|
+
print(f"구성: {storage['configuration']}")
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**매개변수:**
|
|
382
|
+
|
|
383
|
+
- `pk` (int): 스토리지 ID
|
|
384
|
+
|
|
385
|
+
**반환값:**
|
|
386
|
+
|
|
387
|
+
- `dict`: 완전한 스토리지 구성
|
|
388
|
+
|
|
389
|
+
### `create_storage(data)`
|
|
390
|
+
|
|
391
|
+
새로운 스토리지 구성을 생성합니다.
|
|
392
|
+
|
|
393
|
+
```python
|
|
394
|
+
# Amazon S3 스토리지 생성
|
|
395
|
+
s3_storage = client.create_storage({
|
|
396
|
+
'name': 'My S3 Storage',
|
|
397
|
+
'provider': 'amazon_s3',
|
|
398
|
+
'category': 'external',
|
|
399
|
+
'configuration': {
|
|
400
|
+
'bucket_name': 'my-bucket',
|
|
401
|
+
'region': 'us-west-2',
|
|
402
|
+
'access_key_id': 'YOUR_ACCESS_KEY',
|
|
403
|
+
'secret_access_key': 'YOUR_SECRET_KEY'
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
# 로컬 파일 시스템 스토리지 생성
|
|
408
|
+
local_storage = client.create_storage({
|
|
409
|
+
'name': 'Local Storage',
|
|
410
|
+
'provider': 'file_system',
|
|
411
|
+
'category': 'internal',
|
|
412
|
+
'configuration': {
|
|
413
|
+
'base_path': '/data/storage',
|
|
414
|
+
'permissions': '755'
|
|
415
|
+
}
|
|
416
|
+
})
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**매개변수:**
|
|
420
|
+
|
|
421
|
+
- `data` (dict): 스토리지 구성
|
|
422
|
+
|
|
423
|
+
**스토리지 데이터 구조:**
|
|
424
|
+
|
|
425
|
+
- `name` (str, 필수): 스토리지 이름
|
|
426
|
+
- `provider` (str, 필수): 스토리지 제공업체 유형
|
|
427
|
+
- `category` (str): 스토리지 카테고리 (`internal`, `external`)
|
|
428
|
+
- `configuration` (dict): 제공업체별 구성
|
|
429
|
+
|
|
430
|
+
**지원되는 제공업체:**
|
|
431
|
+
|
|
432
|
+
- `amazon_s3`: Amazon S3
|
|
433
|
+
- `azure`: Azure Blob Storage
|
|
434
|
+
- `gcp`: Google Cloud Storage
|
|
435
|
+
- `file_system`: 로컬 파일 시스템
|
|
436
|
+
- `ftp`, `sftp`: FTP 프로토콜
|
|
437
|
+
- `minio`: MinIO 스토리지
|
|
438
|
+
|
|
439
|
+
**반환값:**
|
|
440
|
+
|
|
441
|
+
- `dict`: 생성된 스토리지 구성
|
|
442
|
+
|
|
443
|
+
## 오류 처리
|
|
444
|
+
|
|
445
|
+
```python
|
|
446
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
447
|
+
|
|
448
|
+
def robust_plugin_execution(plugin_id, parameters, max_retries=3):
|
|
449
|
+
"""오류 처리 및 재시도가 있는 플러그인 실행."""
|
|
450
|
+
for attempt in range(max_retries):
|
|
451
|
+
try:
|
|
452
|
+
result = client.run_plugin(plugin_id, {
|
|
453
|
+
'parameters': parameters,
|
|
454
|
+
'context': {'retry_attempt': attempt}
|
|
455
|
+
})
|
|
456
|
+
return result
|
|
457
|
+
except ClientError as e:
|
|
458
|
+
if e.status_code == 404:
|
|
459
|
+
print(f"플러그인 {plugin_id}을 찾을 수 없음")
|
|
460
|
+
break
|
|
461
|
+
elif e.status_code == 400:
|
|
462
|
+
print(f"잘못된 매개변수: {e.response}")
|
|
463
|
+
break
|
|
464
|
+
elif e.status_code >= 500:
|
|
465
|
+
print(f"서버 오류 (시도 {attempt + 1}): {e}")
|
|
466
|
+
if attempt < max_retries - 1:
|
|
467
|
+
time.sleep(2 ** attempt) # 지수 백오프
|
|
468
|
+
else:
|
|
469
|
+
print(f"예상치 못한 오류: {e}")
|
|
470
|
+
break
|
|
471
|
+
|
|
472
|
+
return None
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
## 참고
|
|
476
|
+
|
|
477
|
+
- [BackendClient](./backend.md) - 메인 백엔드 클라이언트
|
|
478
|
+
- [AnnotationClientMixin](./annotation-mixin.md) - 태스크 및 어노테이션 작업
|
|
479
|
+
- [MLClientMixin](./ml-mixin.md) - 머신러닝 작업
|