synapse-sdk 1.0.0a23__py3-none-any.whl → 2025.12.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.
- synapse_sdk/__init__.py +24 -0
- synapse_sdk/cli/__init__.py +310 -5
- synapse_sdk/cli/alias/__init__.py +22 -0
- synapse_sdk/cli/alias/create.py +36 -0
- synapse_sdk/cli/alias/dataclass.py +31 -0
- synapse_sdk/cli/alias/default.py +16 -0
- synapse_sdk/cli/alias/delete.py +15 -0
- synapse_sdk/cli/alias/list.py +19 -0
- synapse_sdk/cli/alias/read.py +15 -0
- synapse_sdk/cli/alias/update.py +17 -0
- synapse_sdk/cli/alias/utils.py +61 -0
- synapse_sdk/cli/code_server.py +687 -0
- synapse_sdk/cli/config.py +440 -0
- synapse_sdk/cli/devtools.py +90 -0
- synapse_sdk/cli/plugin/__init__.py +33 -0
- synapse_sdk/cli/{create_plugin.py → plugin/create.py} +2 -2
- synapse_sdk/{plugins/cli → cli/plugin}/publish.py +23 -15
- synapse_sdk/clients/agent/__init__.py +9 -3
- synapse_sdk/clients/agent/container.py +143 -0
- synapse_sdk/clients/agent/core.py +19 -0
- synapse_sdk/clients/agent/ray.py +298 -9
- synapse_sdk/clients/backend/__init__.py +30 -12
- synapse_sdk/clients/backend/annotation.py +13 -5
- synapse_sdk/clients/backend/core.py +31 -4
- synapse_sdk/clients/backend/data_collection.py +186 -0
- synapse_sdk/clients/backend/hitl.py +17 -0
- synapse_sdk/clients/backend/integration.py +16 -1
- synapse_sdk/clients/backend/ml.py +5 -1
- synapse_sdk/clients/backend/models.py +78 -0
- synapse_sdk/clients/base.py +384 -41
- synapse_sdk/clients/ray/serve.py +2 -0
- synapse_sdk/clients/validators/collections.py +31 -0
- synapse_sdk/devtools/config.py +94 -0
- synapse_sdk/devtools/server.py +41 -0
- synapse_sdk/devtools/streamlit_app/__init__.py +5 -0
- synapse_sdk/devtools/streamlit_app/app.py +128 -0
- synapse_sdk/devtools/streamlit_app/services/__init__.py +11 -0
- synapse_sdk/devtools/streamlit_app/services/job_service.py +233 -0
- synapse_sdk/devtools/streamlit_app/services/plugin_service.py +236 -0
- synapse_sdk/devtools/streamlit_app/services/serve_service.py +95 -0
- synapse_sdk/devtools/streamlit_app/ui/__init__.py +15 -0
- synapse_sdk/devtools/streamlit_app/ui/config_tab.py +76 -0
- synapse_sdk/devtools/streamlit_app/ui/deployment_tab.py +66 -0
- synapse_sdk/devtools/streamlit_app/ui/http_tab.py +125 -0
- synapse_sdk/devtools/streamlit_app/ui/jobs_tab.py +573 -0
- synapse_sdk/devtools/streamlit_app/ui/serve_tab.py +346 -0
- synapse_sdk/devtools/streamlit_app/ui/status_bar.py +118 -0
- synapse_sdk/devtools/streamlit_app/utils/__init__.py +40 -0
- synapse_sdk/devtools/streamlit_app/utils/json_viewer.py +197 -0
- synapse_sdk/devtools/streamlit_app/utils/log_formatter.py +38 -0
- synapse_sdk/devtools/streamlit_app/utils/styles.py +241 -0
- synapse_sdk/devtools/streamlit_app/utils/ui_components.py +289 -0
- synapse_sdk/devtools/streamlit_app.py +10 -0
- synapse_sdk/loggers.py +120 -9
- synapse_sdk/plugins/README.md +1340 -0
- synapse_sdk/plugins/__init__.py +0 -13
- synapse_sdk/plugins/categories/base.py +117 -11
- synapse_sdk/plugins/categories/data_validation/actions/validation.py +72 -0
- synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +33 -5
- 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 +165 -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/config.yaml +21 -0
- synapse_sdk/plugins/categories/export/templates/plugin/__init__.py +390 -0
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +160 -0
- synapse_sdk/plugins/categories/neural_net/actions/deployment.py +13 -12
- synapse_sdk/plugins/categories/neural_net/actions/train.py +1134 -31
- synapse_sdk/plugins/categories/neural_net/actions/tune.py +534 -0
- synapse_sdk/plugins/categories/neural_net/base/inference.py +1 -1
- synapse_sdk/plugins/categories/neural_net/templates/config.yaml +32 -4
- synapse_sdk/plugins/categories/neural_net/templates/plugin/inference.py +26 -10
- synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py +4 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation/__init__.py +3 -0
- synapse_sdk/plugins/categories/{export/actions/export.py → pre_annotation/actions/pre_annotation/action.py} +4 -4
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/__init__.py +28 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/action.py +148 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/enums.py +269 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/exceptions.py +14 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/factory.py +76 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/models.py +100 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/orchestrator.py +248 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/run.py +64 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/__init__.py +17 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/annotation.py +265 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/base.py +170 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/extraction.py +83 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/metrics.py +92 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/preprocessor.py +243 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task/strategies/validation.py +143 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml +19 -0
- synapse_sdk/plugins/categories/pre_annotation/templates/plugin/to_task.py +40 -0
- synapse_sdk/plugins/categories/smart_tool/templates/config.yaml +2 -0
- synapse_sdk/plugins/categories/upload/__init__.py +0 -0
- synapse_sdk/plugins/categories/upload/actions/__init__.py +0 -0
- synapse_sdk/plugins/categories/upload/actions/upload/__init__.py +19 -0
- synapse_sdk/plugins/categories/upload/actions/upload/action.py +236 -0
- synapse_sdk/plugins/categories/upload/actions/upload/context.py +185 -0
- synapse_sdk/plugins/categories/upload/actions/upload/enums.py +493 -0
- synapse_sdk/plugins/categories/upload/actions/upload/exceptions.py +36 -0
- synapse_sdk/plugins/categories/upload/actions/upload/factory.py +138 -0
- synapse_sdk/plugins/categories/upload/actions/upload/models.py +214 -0
- synapse_sdk/plugins/categories/upload/actions/upload/orchestrator.py +183 -0
- synapse_sdk/plugins/categories/upload/actions/upload/registry.py +113 -0
- synapse_sdk/plugins/categories/upload/actions/upload/run.py +179 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/base.py +107 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/cleanup.py +62 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/collection.py +63 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/generate.py +91 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/initialize.py +82 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/metadata.py +235 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/organize.py +201 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/upload.py +104 -0
- synapse_sdk/plugins/categories/upload/actions/upload/steps/validate.py +71 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/__init__.py +1 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/base.py +82 -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 +29 -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 +300 -0
- synapse_sdk/plugins/categories/upload/actions/upload/strategies/file_discovery/recursive.py +287 -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/sync.py +84 -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 +60 -0
- synapse_sdk/plugins/categories/upload/actions/upload/utils.py +250 -0
- synapse_sdk/plugins/categories/upload/templates/README.md +470 -0
- synapse_sdk/plugins/categories/upload/templates/config.yaml +33 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/__init__.py +310 -0
- synapse_sdk/plugins/categories/upload/templates/plugin/upload.py +102 -0
- synapse_sdk/plugins/enums.py +3 -1
- synapse_sdk/plugins/models.py +148 -11
- synapse_sdk/plugins/templates/plugin-config-schema.json +406 -0
- synapse_sdk/plugins/templates/schema.json +491 -0
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/config.yaml +1 -0
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/requirements.txt +1 -1
- synapse_sdk/plugins/utils/__init__.py +46 -0
- synapse_sdk/plugins/utils/actions.py +119 -0
- synapse_sdk/plugins/utils/config.py +203 -0
- synapse_sdk/plugins/{utils.py → utils/legacy.py} +26 -46
- synapse_sdk/plugins/utils/ray_gcs.py +66 -0
- synapse_sdk/plugins/utils/registry.py +58 -0
- synapse_sdk/shared/__init__.py +25 -0
- synapse_sdk/shared/enums.py +93 -0
- synapse_sdk/types.py +19 -0
- synapse_sdk/utils/converters/__init__.py +240 -0
- synapse_sdk/utils/converters/coco/__init__.py +0 -0
- synapse_sdk/utils/converters/coco/from_dm.py +322 -0
- synapse_sdk/utils/converters/coco/to_dm.py +215 -0
- synapse_sdk/utils/converters/dm/__init__.py +57 -0
- synapse_sdk/utils/converters/dm/base.py +137 -0
- synapse_sdk/utils/converters/dm/from_v1.py +273 -0
- synapse_sdk/utils/converters/dm/to_v1.py +321 -0
- synapse_sdk/utils/converters/dm/tools/__init__.py +214 -0
- synapse_sdk/utils/converters/dm/tools/answer.py +95 -0
- synapse_sdk/utils/converters/dm/tools/bounding_box.py +132 -0
- synapse_sdk/utils/converters/dm/tools/bounding_box_3d.py +121 -0
- synapse_sdk/utils/converters/dm/tools/classification.py +75 -0
- synapse_sdk/utils/converters/dm/tools/keypoint.py +117 -0
- synapse_sdk/utils/converters/dm/tools/named_entity.py +111 -0
- synapse_sdk/utils/converters/dm/tools/polygon.py +122 -0
- synapse_sdk/utils/converters/dm/tools/polyline.py +124 -0
- synapse_sdk/utils/converters/dm/tools/prompt.py +94 -0
- synapse_sdk/utils/converters/dm/tools/relation.py +86 -0
- synapse_sdk/utils/converters/dm/tools/segmentation.py +141 -0
- synapse_sdk/utils/converters/dm/tools/segmentation_3d.py +83 -0
- synapse_sdk/utils/converters/dm/types.py +168 -0
- synapse_sdk/utils/converters/dm/utils.py +162 -0
- synapse_sdk/utils/converters/dm_legacy/__init__.py +56 -0
- synapse_sdk/utils/converters/dm_legacy/from_v1.py +627 -0
- synapse_sdk/utils/converters/dm_legacy/to_v1.py +367 -0
- synapse_sdk/utils/converters/pascal/__init__.py +0 -0
- synapse_sdk/utils/converters/pascal/from_dm.py +244 -0
- synapse_sdk/utils/converters/pascal/to_dm.py +214 -0
- synapse_sdk/utils/converters/yolo/__init__.py +0 -0
- synapse_sdk/utils/converters/yolo/from_dm.py +384 -0
- synapse_sdk/utils/converters/yolo/to_dm.py +267 -0
- synapse_sdk/utils/dataset.py +46 -0
- synapse_sdk/utils/encryption.py +158 -0
- synapse_sdk/utils/file/__init__.py +58 -0
- synapse_sdk/utils/file/archive.py +32 -0
- synapse_sdk/utils/file/checksum.py +56 -0
- synapse_sdk/utils/file/chunking.py +31 -0
- synapse_sdk/utils/file/download.py +385 -0
- synapse_sdk/utils/file/encoding.py +40 -0
- synapse_sdk/utils/file/io.py +22 -0
- synapse_sdk/utils/file/upload.py +165 -0
- synapse_sdk/utils/file/video/__init__.py +29 -0
- synapse_sdk/utils/file/video/transcode.py +307 -0
- synapse_sdk/utils/file.py.backup +301 -0
- synapse_sdk/utils/http.py +138 -0
- synapse_sdk/utils/network.py +309 -0
- synapse_sdk/utils/storage/__init__.py +72 -0
- synapse_sdk/utils/storage/providers/__init__.py +183 -0
- synapse_sdk/utils/storage/providers/file_system.py +134 -0
- synapse_sdk/utils/storage/providers/gcp.py +13 -0
- synapse_sdk/utils/storage/providers/http.py +190 -0
- synapse_sdk/utils/storage/providers/s3.py +91 -0
- synapse_sdk/utils/storage/providers/sftp.py +47 -0
- synapse_sdk/utils/storage/registry.py +17 -0
- synapse_sdk-2025.12.3.dist-info/METADATA +123 -0
- synapse_sdk-2025.12.3.dist-info/RECORD +279 -0
- {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/WHEEL +1 -1
- synapse_sdk/clients/backend/dataset.py +0 -51
- synapse_sdk/plugins/categories/import/actions/import.py +0 -10
- synapse_sdk/plugins/cli/__init__.py +0 -21
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env +0 -24
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/.env.dist +0 -24
- synapse_sdk/plugins/templates/synapse-{{cookiecutter.plugin_code}}-plugin/main.py +0 -4
- synapse_sdk/utils/file.py +0 -168
- synapse_sdk/utils/storage.py +0 -91
- synapse_sdk-1.0.0a23.dist-info/METADATA +0 -44
- synapse_sdk-1.0.0a23.dist-info/RECORD +0 -114
- /synapse_sdk/{plugins/cli → cli/plugin}/run.py +0 -0
- /synapse_sdk/{plugins/categories/import → clients/validators}/__init__.py +0 -0
- /synapse_sdk/{plugins/categories/import/actions → devtools}/__init__.py +0 -0
- {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info/licenses}/LICENSE +0 -0
- {synapse_sdk-1.0.0a23.dist-info → synapse_sdk-2025.12.3.dist-info}/top_level.txt +0 -0
synapse_sdk/plugins/__init__.py
CHANGED
|
@@ -11,12 +11,38 @@ from synapse_sdk.clients.ray import RayClient
|
|
|
11
11
|
from synapse_sdk.plugins.enums import RunMethod
|
|
12
12
|
from synapse_sdk.plugins.exceptions import ActionError
|
|
13
13
|
from synapse_sdk.plugins.models import PluginRelease, Run
|
|
14
|
-
from synapse_sdk.plugins.upload import archive_and_upload, build_and_upload
|
|
14
|
+
from synapse_sdk.plugins.upload import archive_and_upload, build_and_upload
|
|
15
|
+
from synapse_sdk.shared import init_sentry, needs_sentry_init
|
|
15
16
|
from synapse_sdk.utils.module_loading import import_string
|
|
16
17
|
from synapse_sdk.utils.pydantic.errors import pydantic_to_drf_error
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
class Action:
|
|
21
|
+
"""Base class for all plugin actions.
|
|
22
|
+
|
|
23
|
+
Attrs:
|
|
24
|
+
name (str): The name of the action.
|
|
25
|
+
category (PluginCategory): The category of the action.
|
|
26
|
+
method (RunMethod): The method to run of the action.
|
|
27
|
+
run_class (Run): The class to run the action.
|
|
28
|
+
params_model (BaseModel): The model to validate the params.
|
|
29
|
+
progress_categories (Dict[str] | None): The categories to update the progress.
|
|
30
|
+
metrics_categories (Dict[str] | None): The categories to update the metrics.
|
|
31
|
+
params (Dict): The params to run the action.
|
|
32
|
+
plugin_config (Dict): The plugin config.
|
|
33
|
+
plugin_release (PluginRelease): The plugin release.
|
|
34
|
+
config (Dict): The action config.
|
|
35
|
+
requirements (List[str]): The requirements to install.
|
|
36
|
+
job_id (str): The job id.
|
|
37
|
+
direct (bool): The flag to run the action directly.
|
|
38
|
+
debug (bool): The flag to run the action in debug mode.
|
|
39
|
+
envs (Dict): The runtime envs.
|
|
40
|
+
run (Run): The run instance.
|
|
41
|
+
|
|
42
|
+
Raises:
|
|
43
|
+
ActionError: If the action fails.
|
|
44
|
+
"""
|
|
45
|
+
|
|
20
46
|
# class 변수
|
|
21
47
|
name = None
|
|
22
48
|
category = None
|
|
@@ -24,6 +50,7 @@ class Action:
|
|
|
24
50
|
run_class = Run
|
|
25
51
|
params_model = None
|
|
26
52
|
progress_categories = None
|
|
53
|
+
metrics_categories = None
|
|
27
54
|
|
|
28
55
|
# init 변수
|
|
29
56
|
params = None
|
|
@@ -37,6 +64,7 @@ class Action:
|
|
|
37
64
|
envs = None
|
|
38
65
|
run = None
|
|
39
66
|
|
|
67
|
+
# TODO: Refactor to use Synapse Access Token instead of SYNAPSE_PLUGIN_RUN_USER_TOKEN and SYNAPSE_PLUGIN_RUN_TENANT
|
|
40
68
|
REQUIRED_ENVS = [
|
|
41
69
|
'RAY_ADDRESS',
|
|
42
70
|
'RAY_DASHBOARD_URL',
|
|
@@ -81,15 +109,37 @@ class Action:
|
|
|
81
109
|
def plugin_url(self):
|
|
82
110
|
if self.debug:
|
|
83
111
|
plugin_path = self.envs.get('SYNAPSE_DEBUG_PLUGIN_PATH') or '.'
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
112
|
+
|
|
113
|
+
# For HTTP/HTTPS URLs in debug mode, convert to Ray GCS (Global Control Store) URL
|
|
114
|
+
if plugin_path.startswith(('http://', 'https://')):
|
|
115
|
+
try:
|
|
116
|
+
from synapse_sdk.plugins.utils import convert_http_to_ray_gcs
|
|
117
|
+
|
|
118
|
+
plugin_url = convert_http_to_ray_gcs(plugin_path)
|
|
119
|
+
except (ImportError, RuntimeError):
|
|
120
|
+
plugin_url = plugin_path
|
|
121
|
+
|
|
122
|
+
elif self.envs.get('SYNAPSE_PLUGIN_STORAGE'):
|
|
89
123
|
plugin_url = archive_and_upload(plugin_path, self.plugin_storage_url)
|
|
124
|
+
else:
|
|
125
|
+
plugin_url = plugin_path
|
|
126
|
+
|
|
90
127
|
self.envs['SYNAPSE_DEBUG_PLUGIN_PATH'] = plugin_url
|
|
91
128
|
return plugin_url
|
|
92
|
-
|
|
129
|
+
|
|
130
|
+
# Production path: get URL from storage provider
|
|
131
|
+
url = self.plugin_release.get_url(self.plugin_storage_url)
|
|
132
|
+
|
|
133
|
+
# Convert HTTP URLs to Ray GCS URLs if needed
|
|
134
|
+
if url.startswith(('http://', 'https://')):
|
|
135
|
+
try:
|
|
136
|
+
from synapse_sdk.plugins.utils import convert_http_to_ray_gcs
|
|
137
|
+
|
|
138
|
+
url = convert_http_to_ray_gcs(url)
|
|
139
|
+
except (ImportError, RuntimeError):
|
|
140
|
+
pass
|
|
141
|
+
|
|
142
|
+
return url
|
|
93
143
|
|
|
94
144
|
@property
|
|
95
145
|
def debug_modules(self):
|
|
@@ -105,13 +155,42 @@ class Action:
|
|
|
105
155
|
self.envs['SYNAPSE_DEBUG_MODULES'] = ','.join(debug_modules)
|
|
106
156
|
return debug_modules
|
|
107
157
|
|
|
158
|
+
@property
|
|
159
|
+
def plugin_package_manager(self):
|
|
160
|
+
return self.plugin_config.get('package_manager', 'pip')
|
|
161
|
+
|
|
162
|
+
@property
|
|
163
|
+
def package_manager_options(self):
|
|
164
|
+
# Get user-defined options from plugin config
|
|
165
|
+
user_options = self.plugin_config.get('package_manager_options', [])
|
|
166
|
+
|
|
167
|
+
if self.plugin_package_manager == 'uv':
|
|
168
|
+
defaults = ['--no-cache']
|
|
169
|
+
# Add defaults if not already present
|
|
170
|
+
options_list = defaults.copy()
|
|
171
|
+
for option in user_options:
|
|
172
|
+
if option not in options_list:
|
|
173
|
+
options_list.append(option)
|
|
174
|
+
return {'uv_pip_install_options': options_list}
|
|
175
|
+
else:
|
|
176
|
+
# For pip, use pip_install_options with --upgrade flag to ensure
|
|
177
|
+
# packages from requirements.txt (like synapse-sdk) override pre-installed versions
|
|
178
|
+
defaults = ['--upgrade']
|
|
179
|
+
options_list = defaults.copy()
|
|
180
|
+
for option in user_options:
|
|
181
|
+
if option not in options_list:
|
|
182
|
+
options_list.append(option)
|
|
183
|
+
return {'pip_install_options': options_list}
|
|
184
|
+
|
|
108
185
|
def get_run(self):
|
|
109
186
|
context = {
|
|
110
187
|
'plugin_release': self.plugin_release,
|
|
111
188
|
'progress_categories': self.progress_categories,
|
|
189
|
+
'metrics_categories': self.metrics_categories,
|
|
112
190
|
'params': self.params,
|
|
113
191
|
'envs': self.envs,
|
|
114
192
|
'debug': self.debug,
|
|
193
|
+
'action_name': self.name,
|
|
115
194
|
}
|
|
116
195
|
return self.run_class(self.job_id, context)
|
|
117
196
|
|
|
@@ -119,13 +198,20 @@ class Action:
|
|
|
119
198
|
return {env: os.environ[env] for env in self.REQUIRED_ENVS if env in os.environ}
|
|
120
199
|
|
|
121
200
|
def get_runtime_env(self):
|
|
122
|
-
runtime_env = {'
|
|
201
|
+
runtime_env = {self.plugin_package_manager: {'packages': []}, 'working_dir': self.plugin_url}
|
|
123
202
|
|
|
124
203
|
if self.requirements:
|
|
125
|
-
runtime_env['
|
|
204
|
+
runtime_env[self.plugin_package_manager]['packages'] += self.requirements
|
|
126
205
|
|
|
127
206
|
if self.debug:
|
|
128
|
-
runtime_env['
|
|
207
|
+
runtime_env[self.plugin_package_manager]['packages'] += self.debug_modules
|
|
208
|
+
|
|
209
|
+
for key, value in self.package_manager_options.items():
|
|
210
|
+
runtime_env[self.plugin_package_manager][key] = value
|
|
211
|
+
|
|
212
|
+
# Sentry init if SENTRY_DSN is set
|
|
213
|
+
if needs_sentry_init():
|
|
214
|
+
runtime_env['worker_process_setup_hook'] = 'synapse_sdk.shared.worker_process_setup_hook'
|
|
129
215
|
|
|
130
216
|
# 맨 마지막에 진행되어야 함
|
|
131
217
|
runtime_env['env_vars'] = self.envs
|
|
@@ -155,11 +241,19 @@ class Action:
|
|
|
155
241
|
return getattr(self, f'start_by_{self.method.value}')()
|
|
156
242
|
|
|
157
243
|
def start(self):
|
|
244
|
+
"""Start the action.
|
|
245
|
+
|
|
246
|
+
TODO: Specify the return type of start method for overrided methods.
|
|
247
|
+
"""
|
|
158
248
|
if self.method == RunMethod.JOB:
|
|
159
249
|
return self.entrypoint(self.run, **self.params)
|
|
160
250
|
return self.entrypoint(**self.params)
|
|
161
251
|
|
|
162
252
|
def start_by_task(self):
|
|
253
|
+
"""Ray Task based execution.
|
|
254
|
+
|
|
255
|
+
* A task method that simply executes the entrypoint without job management functionality.
|
|
256
|
+
"""
|
|
163
257
|
import ray
|
|
164
258
|
from ray.exceptions import RayTaskError
|
|
165
259
|
|
|
@@ -191,6 +285,12 @@ class Action:
|
|
|
191
285
|
raise ActionError(e.cause)
|
|
192
286
|
|
|
193
287
|
def start_by_job(self):
|
|
288
|
+
"""Ray Job based execution.
|
|
289
|
+
|
|
290
|
+
* Executes the entrypoint with Ray job. Ray job manages the entrypoint execution and stores the results.
|
|
291
|
+
"""
|
|
292
|
+
self.ray_init()
|
|
293
|
+
|
|
194
294
|
main_options = []
|
|
195
295
|
options = ['run', '--direct']
|
|
196
296
|
arguments = [self.name, f'{json.dumps(json.dumps(self.params))}']
|
|
@@ -206,11 +306,15 @@ class Action:
|
|
|
206
306
|
client = self.get_job_client()
|
|
207
307
|
return client.submit_job(
|
|
208
308
|
submission_id=self.job_id,
|
|
209
|
-
entrypoint=f'
|
|
309
|
+
entrypoint=f'synapse plugin {cmd}',
|
|
210
310
|
runtime_env=self.get_runtime_env(),
|
|
211
311
|
)
|
|
212
312
|
|
|
213
313
|
def start_by_restapi(self):
|
|
314
|
+
"""Ray Serve based execution.
|
|
315
|
+
|
|
316
|
+
* This method executes a Fastapi endpoint defined within the Plugin.
|
|
317
|
+
"""
|
|
214
318
|
path = self.params.pop('path', '')
|
|
215
319
|
method = self.params.pop('method')
|
|
216
320
|
|
|
@@ -241,5 +345,7 @@ class Action:
|
|
|
241
345
|
def ray_init(self):
|
|
242
346
|
import ray
|
|
243
347
|
|
|
348
|
+
init_sentry()
|
|
349
|
+
|
|
244
350
|
if not ray.is_initialized():
|
|
245
351
|
ray.init(address=self.envs['RAY_ADDRESS'], ignore_reinit_error=True)
|
|
@@ -1,10 +1,82 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from typing import Any, Dict, List
|
|
3
|
+
|
|
4
|
+
from pydantic import BaseModel
|
|
5
|
+
|
|
1
6
|
from synapse_sdk.plugins.categories.base import Action
|
|
2
7
|
from synapse_sdk.plugins.categories.decorators import register_action
|
|
3
8
|
from synapse_sdk.plugins.enums import PluginCategory, RunMethod
|
|
4
9
|
|
|
5
10
|
|
|
11
|
+
class ValidationDataStatus(str, Enum):
|
|
12
|
+
"""Validation data status enumeration.
|
|
13
|
+
|
|
14
|
+
Represents the possible status values for validation operations.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
SUCCESS: Validation completed successfully with no errors.
|
|
18
|
+
FAILED: Validation failed with one or more errors.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
SUCCESS = 'success'
|
|
22
|
+
FAILED = 'failed'
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ValidationResult(BaseModel):
|
|
26
|
+
"""Validation result model.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
status: The validation status.
|
|
30
|
+
errors: List of validation errors.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
status: ValidationDataStatus
|
|
34
|
+
errors: List[str]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CriticalError(Exception):
|
|
38
|
+
"""Critical error exception for validation processing.
|
|
39
|
+
|
|
40
|
+
Raised when a critical error occurs during validation that prevents
|
|
41
|
+
the validation process from continuing normally.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
message: Custom error message. Defaults to a standard critical error message.
|
|
45
|
+
|
|
46
|
+
Attributes:
|
|
47
|
+
message: The error message associated with this exception.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(self, message: str = 'Critical error occured while processing validation'):
|
|
51
|
+
self.message = message
|
|
52
|
+
super().__init__(self.message)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ValidationParams(BaseModel):
|
|
56
|
+
"""Validation action parameters.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
data (dict): The validation data.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
data: Dict[str, Any]
|
|
63
|
+
|
|
64
|
+
|
|
6
65
|
@register_action
|
|
7
66
|
class ValidationAction(Action):
|
|
67
|
+
"""Validation action for data validation processing.
|
|
68
|
+
|
|
69
|
+
This action handles the process of validating data with assignment IDs.
|
|
70
|
+
It supports validation methods and provides structured logging.
|
|
71
|
+
|
|
72
|
+
Attrs:
|
|
73
|
+
name (str): Action name, set to 'validation'.
|
|
74
|
+
category (PluginCategory): Plugin category, set to DATA_VALIDATION.
|
|
75
|
+
method (RunMethod): Execution method, set to TASK.
|
|
76
|
+
params_model (Type[ValidationParams]): Parameter validation model.
|
|
77
|
+
"""
|
|
78
|
+
|
|
8
79
|
name = 'validation'
|
|
9
80
|
category = PluginCategory.DATA_VALIDATION
|
|
10
81
|
method = RunMethod.TASK
|
|
82
|
+
params_model = ValidationParams
|
|
@@ -1,5 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
from typing import Any, Dict, List, Optional
|
|
2
|
+
|
|
3
|
+
from synapse_sdk.plugins.categories.data_validation.actions.validation import ValidationDataStatus, ValidationResult
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def validate(data: Optional[Dict[str, Any]] = None, **kwargs: Any) -> Dict[str, Any]:
|
|
7
|
+
"""Validate data with assignment data.
|
|
8
|
+
|
|
9
|
+
* Custom validation logic can be added here.
|
|
10
|
+
* Error messages can be added to the errors list if errors exist in data.
|
|
11
|
+
* The validation result will be returned as a dict with ValidationResult structure.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
data: The data to validate.
|
|
15
|
+
**kwargs: Additional arguments.
|
|
16
|
+
|
|
17
|
+
Returns:
|
|
18
|
+
Dict[str, Any]: The validation result as a dictionary with ValidationResult structure.
|
|
19
|
+
"""
|
|
20
|
+
errors: List[str] = []
|
|
21
|
+
|
|
22
|
+
# Add custom validation logic here
|
|
23
|
+
|
|
24
|
+
# Add error messages into errors list if errors exist in data
|
|
25
|
+
|
|
26
|
+
# Determine status based on errors
|
|
27
|
+
status = ValidationDataStatus.FAILED if errors else ValidationDataStatus.SUCCESS
|
|
28
|
+
|
|
29
|
+
# DO NOT MODIFY BELOW THIS LINE - Validation result should be returned as a dumped ValidationResult.
|
|
30
|
+
validation_result = ValidationResult(status=status, errors=errors)
|
|
31
|
+
result_dict = validation_result.model_dump()
|
|
32
|
+
result_dict['status'] = status.value
|
|
33
|
+
return result_dict
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from .action import ExportAction
|
|
2
|
+
from .enums import ExportStatus, LogCode
|
|
3
|
+
from .exceptions import ExportError, ExportTargetError, ExportValidationError
|
|
4
|
+
from .models import ExportParams
|
|
5
|
+
from .run import ExportRun
|
|
6
|
+
from .utils import (
|
|
7
|
+
AssignmentExportTargetHandler,
|
|
8
|
+
ExportTargetHandler,
|
|
9
|
+
GroundTruthExportTargetHandler,
|
|
10
|
+
TargetHandlerFactory,
|
|
11
|
+
TaskExportTargetHandler,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
'ExportAction',
|
|
16
|
+
'ExportStatus',
|
|
17
|
+
'LogCode',
|
|
18
|
+
'ExportError',
|
|
19
|
+
'ExportTargetError',
|
|
20
|
+
'ExportValidationError',
|
|
21
|
+
'ExportParams',
|
|
22
|
+
'ExportRun',
|
|
23
|
+
'ExportTargetHandler',
|
|
24
|
+
'AssignmentExportTargetHandler',
|
|
25
|
+
'GroundTruthExportTargetHandler',
|
|
26
|
+
'TaskExportTargetHandler',
|
|
27
|
+
'TargetHandlerFactory',
|
|
28
|
+
]
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
from itertools import tee
|
|
2
|
+
from typing import Any, Dict
|
|
3
|
+
|
|
4
|
+
from pydantic_core import PydanticCustomError
|
|
5
|
+
|
|
6
|
+
from synapse_sdk.clients.exceptions import ClientError
|
|
7
|
+
from synapse_sdk.i18n import gettext as _
|
|
8
|
+
from synapse_sdk.plugins.categories.base import Action
|
|
9
|
+
from synapse_sdk.plugins.categories.decorators import register_action
|
|
10
|
+
from synapse_sdk.plugins.enums import PluginCategory, RunMethod
|
|
11
|
+
from synapse_sdk.utils.storage import get_pathlib
|
|
12
|
+
|
|
13
|
+
from .enums import LogCode
|
|
14
|
+
from .models import ExportParams
|
|
15
|
+
from .run import ExportRun
|
|
16
|
+
from .utils import TargetHandlerFactory
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@register_action
|
|
20
|
+
class ExportAction(Action):
|
|
21
|
+
"""Main export action for processing and exporting data from various targets.
|
|
22
|
+
|
|
23
|
+
Handles export operations including target validation, data retrieval,
|
|
24
|
+
and file generation. Supports export from assignment, ground_truth, and task
|
|
25
|
+
targets with comprehensive progress tracking and error handling.
|
|
26
|
+
|
|
27
|
+
Features:
|
|
28
|
+
- Multiple target source support (assignment, ground_truth, task)
|
|
29
|
+
- Filter validation and data retrieval
|
|
30
|
+
- Original file and data file export options
|
|
31
|
+
- Progress tracking with detailed metrics
|
|
32
|
+
- Comprehensive error logging
|
|
33
|
+
- Project configuration handling
|
|
34
|
+
|
|
35
|
+
Class Attributes:
|
|
36
|
+
name (str): Action identifier ('export')
|
|
37
|
+
category (PluginCategory): EXPORT category
|
|
38
|
+
method (RunMethod): JOB execution method
|
|
39
|
+
run_class (type): ExportRun for specialized logging
|
|
40
|
+
params_model (type): ExportParams for parameter validation
|
|
41
|
+
progress_categories (dict): Progress tracking configuration
|
|
42
|
+
metrics_categories (dict): Metrics collection configuration
|
|
43
|
+
|
|
44
|
+
Example:
|
|
45
|
+
>>> action = ExportAction(
|
|
46
|
+
... params={
|
|
47
|
+
... 'name': 'Assignment Export',
|
|
48
|
+
... 'storage': 1,
|
|
49
|
+
... 'path': '/exports/assignments',
|
|
50
|
+
... 'target': 'assignment',
|
|
51
|
+
... 'filter': {'project': 123}
|
|
52
|
+
... },
|
|
53
|
+
... plugin_config=config
|
|
54
|
+
... )
|
|
55
|
+
>>> result = action.start()
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
name = 'export'
|
|
59
|
+
category = PluginCategory.EXPORT
|
|
60
|
+
method = RunMethod.JOB
|
|
61
|
+
params_model = ExportParams
|
|
62
|
+
run_class = ExportRun
|
|
63
|
+
progress_categories = {
|
|
64
|
+
'dataset_conversion': {
|
|
65
|
+
'proportion': 100,
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
metrics_categories = {
|
|
69
|
+
'data_file': {
|
|
70
|
+
'stand_by': 0,
|
|
71
|
+
'failed': 0,
|
|
72
|
+
'success': 0,
|
|
73
|
+
},
|
|
74
|
+
'original_file': {
|
|
75
|
+
'stand_by': 0,
|
|
76
|
+
'failed': 0,
|
|
77
|
+
'success': 0,
|
|
78
|
+
},
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
def get_filtered_results(self, filters, handler):
|
|
82
|
+
"""Get filtered target results.
|
|
83
|
+
|
|
84
|
+
Retrieves data from the specified target using the provided filters
|
|
85
|
+
through the appropriate target handler.
|
|
86
|
+
|
|
87
|
+
Args:
|
|
88
|
+
filters (dict): Filter criteria to apply
|
|
89
|
+
handler (ExportTargetHandler): Target-specific handler
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
tuple: (results, count) where results is the data and count is total
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
PydanticCustomError: If data retrieval fails
|
|
96
|
+
"""
|
|
97
|
+
try:
|
|
98
|
+
result_list = handler.get_results(self.client, filters)
|
|
99
|
+
results = result_list[0]
|
|
100
|
+
count = result_list[1]
|
|
101
|
+
except ClientError:
|
|
102
|
+
raise PydanticCustomError('client_error', _('Unable to get dataset.'))
|
|
103
|
+
return results, count
|
|
104
|
+
|
|
105
|
+
def start(self) -> Dict[str, Any]:
|
|
106
|
+
"""Start the export process.
|
|
107
|
+
|
|
108
|
+
Main entry point for export operations. Handles parameter preparation,
|
|
109
|
+
target handler selection, data retrieval, and export execution.
|
|
110
|
+
|
|
111
|
+
Returns:
|
|
112
|
+
Dict[str, Any]: Export results from the entrypoint
|
|
113
|
+
|
|
114
|
+
Raises:
|
|
115
|
+
Various exceptions based on validation and processing failures
|
|
116
|
+
"""
|
|
117
|
+
self.run.log_message_with_code(LogCode.EXPORT_STARTED)
|
|
118
|
+
|
|
119
|
+
# Get expand setting from config, default to True (expand data)
|
|
120
|
+
filters = {**self.params['filter']}
|
|
121
|
+
data_expand = self.config.get('data_expand', True)
|
|
122
|
+
if data_expand:
|
|
123
|
+
filters['expand'] = 'data'
|
|
124
|
+
|
|
125
|
+
target = self.params['target']
|
|
126
|
+
handler = TargetHandlerFactory.get_handler(target)
|
|
127
|
+
|
|
128
|
+
self.params['results'], self.params['count'] = self.get_filtered_results(filters, handler)
|
|
129
|
+
|
|
130
|
+
if self.params['count'] == 0:
|
|
131
|
+
self.run.log_message_with_code(LogCode.NO_RESULTS_FOUND)
|
|
132
|
+
else:
|
|
133
|
+
self.run.log_message_with_code(LogCode.RESULTS_RETRIEVED, self.params['count'])
|
|
134
|
+
|
|
135
|
+
# For the 'ground_truth' target, retrieve project information from the first result and add configuration
|
|
136
|
+
if target == 'ground_truth':
|
|
137
|
+
try:
|
|
138
|
+
# Split generator into two using tee()
|
|
139
|
+
peek_iter, main_iter = tee(self.params['results'])
|
|
140
|
+
first_result = next(peek_iter) # Peek first value only
|
|
141
|
+
project_pk = first_result['project']
|
|
142
|
+
project_info = self.client.get_project(project_pk)
|
|
143
|
+
self.params['project_id'] = project_pk
|
|
144
|
+
self.params['configuration'] = project_info.get('configuration', {})
|
|
145
|
+
self.params['results'] = main_iter # Keep original generator intact
|
|
146
|
+
except (StopIteration, KeyError):
|
|
147
|
+
self.params['configuration'] = {}
|
|
148
|
+
# For the 'assignment' and 'task' targets, retrieve the project from the filter as before
|
|
149
|
+
elif target in ['assignment', 'task'] and 'project' in self.params['filter']:
|
|
150
|
+
project_pk = self.params['filter']['project']
|
|
151
|
+
project_info = self.client.get_project(project_pk)
|
|
152
|
+
self.params['configuration'] = project_info.get('configuration', {})
|
|
153
|
+
|
|
154
|
+
export_items = handler.get_export_item(self.params['results'])
|
|
155
|
+
storage = self.client.get_storage(self.params['storage'])
|
|
156
|
+
pathlib_cwd = get_pathlib(storage, self.params['path'])
|
|
157
|
+
exporter = self.entrypoint(self.run, export_items, pathlib_cwd, **self.params)
|
|
158
|
+
|
|
159
|
+
try:
|
|
160
|
+
result = exporter.export()
|
|
161
|
+
self.run.log_message_with_code(LogCode.EXPORT_COMPLETED)
|
|
162
|
+
return result
|
|
163
|
+
except Exception as e:
|
|
164
|
+
self.run.log_message_with_code(LogCode.EXPORT_FAILED, str(e))
|
|
165
|
+
raise
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
from synapse_sdk.shared.enums import Context
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ExportStatus(str, Enum):
|
|
7
|
+
"""Export processing status enumeration.
|
|
8
|
+
|
|
9
|
+
Defines the possible states for export operations, data files, and export items
|
|
10
|
+
throughout the export process.
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
SUCCESS: Export completed successfully
|
|
14
|
+
FAILED: Export failed with errors
|
|
15
|
+
STAND_BY: Export waiting to be processed
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
SUCCESS = 'success'
|
|
19
|
+
FAILED = 'failed'
|
|
20
|
+
STAND_BY = 'stand_by'
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class LogCode(str, Enum):
|
|
24
|
+
"""Type-safe logging codes for export operations.
|
|
25
|
+
|
|
26
|
+
Enumeration of all possible log events during export processing. Each code
|
|
27
|
+
corresponds to a specific event or error state with predefined message
|
|
28
|
+
templates and log levels.
|
|
29
|
+
|
|
30
|
+
The codes are organized by category:
|
|
31
|
+
- Validation codes (VALIDATION_FAILED, STORAGE_VALIDATION_FAILED, etc.)
|
|
32
|
+
- Export processing codes (EXPORT_STARTED, EXPORT_COMPLETED, etc.)
|
|
33
|
+
- File processing codes (ORIGINAL_FILE_EXPORTED, DATA_FILE_EXPORTED, etc.)
|
|
34
|
+
- Error handling codes (TARGET_HANDLER_ERROR, EXPORT_FAILED, etc.)
|
|
35
|
+
|
|
36
|
+
Each code maps to a configuration in LOG_MESSAGES with message template
|
|
37
|
+
and appropriate log level.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
STORAGE_VALIDATION_FAILED = 'STORAGE_VALIDATION_FAILED'
|
|
41
|
+
FILTER_VALIDATION_FAILED = 'FILTER_VALIDATION_FAILED'
|
|
42
|
+
TARGET_VALIDATION_FAILED = 'TARGET_VALIDATION_FAILED'
|
|
43
|
+
VALIDATION_FAILED = 'VALIDATION_FAILED'
|
|
44
|
+
EXPORT_STARTED = 'EXPORT_STARTED'
|
|
45
|
+
EXPORT_COMPLETED = 'EXPORT_COMPLETED'
|
|
46
|
+
EXPORT_FAILED = 'EXPORT_FAILED'
|
|
47
|
+
NO_RESULTS_FOUND = 'NO_RESULTS_FOUND'
|
|
48
|
+
RESULTS_RETRIEVED = 'RESULTS_RETRIEVED'
|
|
49
|
+
ORIGINAL_FILE_EXPORTED = 'ORIGINAL_FILE_EXPORTED'
|
|
50
|
+
DATA_FILE_EXPORTED = 'DATA_FILE_EXPORTED'
|
|
51
|
+
FILE_EXPORT_FAILED = 'FILE_EXPORT_FAILED'
|
|
52
|
+
TARGET_HANDLER_ERROR = 'TARGET_HANDLER_ERROR'
|
|
53
|
+
NULL_DATA_DETECTED = 'NULL_DATA_DETECTED'
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
LOG_MESSAGES = {
|
|
57
|
+
LogCode.STORAGE_VALIDATION_FAILED: {
|
|
58
|
+
'message': 'Storage validation failed.',
|
|
59
|
+
'level': Context.DANGER,
|
|
60
|
+
},
|
|
61
|
+
LogCode.FILTER_VALIDATION_FAILED: {
|
|
62
|
+
'message': 'Filter validation failed.',
|
|
63
|
+
'level': Context.DANGER,
|
|
64
|
+
},
|
|
65
|
+
LogCode.TARGET_VALIDATION_FAILED: {
|
|
66
|
+
'message': 'Target validation failed.',
|
|
67
|
+
'level': Context.DANGER,
|
|
68
|
+
},
|
|
69
|
+
LogCode.VALIDATION_FAILED: {
|
|
70
|
+
'message': 'Validation failed.',
|
|
71
|
+
'level': Context.DANGER,
|
|
72
|
+
},
|
|
73
|
+
LogCode.EXPORT_STARTED: {
|
|
74
|
+
'message': 'Export process started.',
|
|
75
|
+
'level': None,
|
|
76
|
+
},
|
|
77
|
+
LogCode.EXPORT_COMPLETED: {
|
|
78
|
+
'message': 'Export process completed.',
|
|
79
|
+
'level': None,
|
|
80
|
+
},
|
|
81
|
+
LogCode.EXPORT_FAILED: {
|
|
82
|
+
'message': 'Export process failed: {}',
|
|
83
|
+
'level': Context.DANGER,
|
|
84
|
+
},
|
|
85
|
+
LogCode.NO_RESULTS_FOUND: {
|
|
86
|
+
'message': 'No results found for export.',
|
|
87
|
+
'level': Context.WARNING,
|
|
88
|
+
},
|
|
89
|
+
LogCode.RESULTS_RETRIEVED: {
|
|
90
|
+
'message': 'Retrieved {} results for export',
|
|
91
|
+
'level': None,
|
|
92
|
+
},
|
|
93
|
+
LogCode.ORIGINAL_FILE_EXPORTED: {
|
|
94
|
+
'message': 'Original file exported successfully.',
|
|
95
|
+
'level': None,
|
|
96
|
+
},
|
|
97
|
+
LogCode.DATA_FILE_EXPORTED: {
|
|
98
|
+
'message': 'Data file exported successfully.',
|
|
99
|
+
'level': None,
|
|
100
|
+
},
|
|
101
|
+
LogCode.FILE_EXPORT_FAILED: {
|
|
102
|
+
'message': 'Failed to export file: {}',
|
|
103
|
+
'level': Context.DANGER,
|
|
104
|
+
},
|
|
105
|
+
LogCode.TARGET_HANDLER_ERROR: {
|
|
106
|
+
'message': 'Target handler error: {}',
|
|
107
|
+
'level': Context.DANGER,
|
|
108
|
+
},
|
|
109
|
+
LogCode.NULL_DATA_DETECTED: {
|
|
110
|
+
'message': 'Data is null for export item',
|
|
111
|
+
'level': Context.WARNING,
|
|
112
|
+
},
|
|
113
|
+
}
|