synapse-sdk 1.0.0a84__py3-none-any.whl → 1.0.0a86__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/plugins/categories/data_validation/actions/validation.py +72 -0
- synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py +29 -5
- synapse_sdk/plugins/categories/export/templates/plugin/export.py +13 -5
- synapse_sdk/plugins/categories/neural_net/actions/train.py +1 -1
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/RECORD +10 -10
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a84.dist-info → synapse_sdk-1.0.0a86.dist-info}/top_level.txt +0 -0
|
@@ -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,29 @@
|
|
|
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) -> ValidationResult:
|
|
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
|
+
ValidationResult: The validation result with status and errors.
|
|
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
|
+
return ValidationResult(status=status, errors=errors)
|
|
@@ -22,7 +22,14 @@ def export(run, export_items, path_root, **params):
|
|
|
22
22
|
dict: Result
|
|
23
23
|
"""
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
export_path = path_root / params['name']
|
|
26
|
+
unique_export_path = export_path
|
|
27
|
+
counter = 1
|
|
28
|
+
while unique_export_path.exists():
|
|
29
|
+
unique_export_path = export_path.with_name(f'{export_path.name}({counter})')
|
|
30
|
+
counter += 1
|
|
31
|
+
unique_export_path.mkdir(parents=True)
|
|
32
|
+
|
|
26
33
|
run.log_message('Starting export process.')
|
|
27
34
|
|
|
28
35
|
# results contains all information fetched through the list API.
|
|
@@ -34,12 +41,13 @@ def export(run, export_items, path_root, **params):
|
|
|
34
41
|
errors_original_file_list = []
|
|
35
42
|
|
|
36
43
|
# Path to save JSON files
|
|
37
|
-
json_output_path =
|
|
44
|
+
json_output_path = unique_export_path / 'json'
|
|
38
45
|
json_output_path.mkdir(parents=True, exist_ok=True)
|
|
39
46
|
|
|
40
47
|
# Path to save original files
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
if save_original_file_flag:
|
|
49
|
+
origin_files_output_path = unique_export_path / 'origin_files'
|
|
50
|
+
origin_files_output_path.mkdir(parents=True, exist_ok=True)
|
|
43
51
|
|
|
44
52
|
total = params['count']
|
|
45
53
|
original_file_metrics_record = run.MetricsRecord(stand_by=total, success=0, failed=0)
|
|
@@ -88,7 +96,7 @@ def export(run, export_items, path_root, **params):
|
|
|
88
96
|
# Save error list files
|
|
89
97
|
if len(errors_json_file_list) > 0 or len(errors_original_file_list) > 0:
|
|
90
98
|
export_error_file = {'json_file_name': errors_json_file_list, 'origin_file_name': errors_original_file_list}
|
|
91
|
-
with (
|
|
99
|
+
with (unique_export_path / 'error_file_list.json').open('w', encoding='utf-8') as f:
|
|
92
100
|
json.dump(export_error_file, f, indent=4, ensure_ascii=False)
|
|
93
101
|
|
|
94
102
|
return {'export_path': str(path_root)}
|
|
@@ -53,7 +53,7 @@ class TrainParams(BaseModel):
|
|
|
53
53
|
'category': 'neural_net',
|
|
54
54
|
'job__action': 'train',
|
|
55
55
|
'is_active': True,
|
|
56
|
-
'params': f'name:{value}',
|
|
56
|
+
'params': f'name:{value.replace(":", "%3A")}',
|
|
57
57
|
},
|
|
58
58
|
)
|
|
59
59
|
assert not model_exists and not job_exists, '존재하는 학습 이름입니다.'
|
|
@@ -117,24 +117,24 @@ synapse_sdk/plugins/categories/registry.py,sha256=KdQR8SUlLT-3kgYzDNWawS1uJnAhrc
|
|
|
117
117
|
synapse_sdk/plugins/categories/templates.py,sha256=FF5FerhkZMeW1YcKLY5cylC0SkWSYdJODA_Qcm4OGYQ,887
|
|
118
118
|
synapse_sdk/plugins/categories/data_validation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
119
119
|
synapse_sdk/plugins/categories/data_validation/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
120
|
-
synapse_sdk/plugins/categories/data_validation/actions/validation.py,sha256=
|
|
120
|
+
synapse_sdk/plugins/categories/data_validation/actions/validation.py,sha256=E6irjH3aylnS_nIlXVDdqwpkvMxlTwzmedYeXj5sgSk,2262
|
|
121
121
|
synapse_sdk/plugins/categories/data_validation/templates/config.yaml,sha256=Hijb-b3hy0msZsTV_bbr3Hvlk8ok-Rk0a05mlLGTCAg,66
|
|
122
122
|
synapse_sdk/plugins/categories/data_validation/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
123
|
-
synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sha256=
|
|
123
|
+
synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sha256=_K1fAp027Q75msY-H_Vyv3hb60A4OthE2nmHtXjSCNw,1011
|
|
124
124
|
synapse_sdk/plugins/categories/export/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
125
|
synapse_sdk/plugins/categories/export/enums.py,sha256=gtyngvQ1DKkos9iKGcbecwTVQQ6sDwbrBPSGPNb5Am0,127
|
|
126
126
|
synapse_sdk/plugins/categories/export/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
127
127
|
synapse_sdk/plugins/categories/export/actions/export.py,sha256=buCpjRPZ-QPfEANKrSopKjCPHadjF1_A0eAkoezaAFA,10688
|
|
128
128
|
synapse_sdk/plugins/categories/export/templates/config.yaml,sha256=N7YmnFROb3s3M35SA9nmabyzoSb5O2t2TRPicwFNN2o,56
|
|
129
129
|
synapse_sdk/plugins/categories/export/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
130
|
-
synapse_sdk/plugins/categories/export/templates/plugin/export.py,sha256=
|
|
130
|
+
synapse_sdk/plugins/categories/export/templates/plugin/export.py,sha256=GDb6Ucodsr5aBPMU4alr68-DyFoLR5TyhC_MCaJrkF0,6411
|
|
131
131
|
synapse_sdk/plugins/categories/neural_net/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
132
132
|
synapse_sdk/plugins/categories/neural_net/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
133
133
|
synapse_sdk/plugins/categories/neural_net/actions/deployment.py,sha256=y2LrS-pwazqRI5O0q1NUy45NQYsBj6ykbrXnDMs_fqE,1987
|
|
134
134
|
synapse_sdk/plugins/categories/neural_net/actions/gradio.py,sha256=jBkonh0JHRIKFPxv-XBBFM8Da3dSJs-vyJu_KGT73DQ,4508
|
|
135
135
|
synapse_sdk/plugins/categories/neural_net/actions/inference.py,sha256=0a655ELqNVjPFZTJDiw4EUdcMCPGveUEKyoYqpwMFBU,1019
|
|
136
136
|
synapse_sdk/plugins/categories/neural_net/actions/test.py,sha256=JY25eg-Fo6WbgtMkGoo_qNqoaZkp3AQNEypJmeGzEog,320
|
|
137
|
-
synapse_sdk/plugins/categories/neural_net/actions/train.py,sha256=
|
|
137
|
+
synapse_sdk/plugins/categories/neural_net/actions/train.py,sha256=Vwr8Lbv6LWvuYpF3JX8Oh4Nu2rh8lJXiLjQSto8-xGM,5449
|
|
138
138
|
synapse_sdk/plugins/categories/neural_net/actions/tune.py,sha256=C2zv3o0S-5Hjjsms8ULDGD-ad_DdNTqCPOcDqXa0v1Y,13494
|
|
139
139
|
synapse_sdk/plugins/categories/neural_net/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
140
140
|
synapse_sdk/plugins/categories/neural_net/base/inference.py,sha256=R5DASI6-5vzsjDOYxqeGGMBjnav5qHF4hNJT8zNUR3I,1097
|
|
@@ -221,9 +221,9 @@ synapse_sdk/utils/storage/providers/gcp.py,sha256=i2BQCu1Kej1If9SuNr2_lEyTcr5M_n
|
|
|
221
221
|
synapse_sdk/utils/storage/providers/http.py,sha256=2DhIulND47JOnS5ZY7MZUex7Su3peAPksGo1Wwg07L4,5828
|
|
222
222
|
synapse_sdk/utils/storage/providers/s3.py,sha256=ZmqekAvIgcQBdRU-QVJYv1Rlp6VHfXwtbtjTSphua94,2573
|
|
223
223
|
synapse_sdk/utils/storage/providers/sftp.py,sha256=_8s9hf0JXIO21gvm-JVS00FbLsbtvly4c-ETLRax68A,1426
|
|
224
|
-
synapse_sdk-1.0.
|
|
225
|
-
synapse_sdk-1.0.
|
|
226
|
-
synapse_sdk-1.0.
|
|
227
|
-
synapse_sdk-1.0.
|
|
228
|
-
synapse_sdk-1.0.
|
|
229
|
-
synapse_sdk-1.0.
|
|
224
|
+
synapse_sdk-1.0.0a86.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
225
|
+
synapse_sdk-1.0.0a86.dist-info/METADATA,sha256=Spzp2B5PSKr6fMRT2fiV_UhJtqgGQUmx1hg1-s7cDOY,3805
|
|
226
|
+
synapse_sdk-1.0.0a86.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
227
|
+
synapse_sdk-1.0.0a86.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
228
|
+
synapse_sdk-1.0.0a86.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
229
|
+
synapse_sdk-1.0.0a86.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|