synapse-sdk 1.0.0a91__py3-none-any.whl → 1.0.0a93__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/export/actions/export.py +15 -0
- synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py +169 -30
- synapse_sdk/shared/enums.py +32 -0
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/METADATA +1 -1
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/RECORD +9 -9
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/WHEEL +0 -0
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/entry_points.txt +0 -0
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/licenses/LICENSE +0 -0
- {synapse_sdk-1.0.0a91.dist-info → synapse_sdk-1.0.0a93.dist-info}/top_level.txt +0 -0
|
@@ -311,6 +311,21 @@ class ExportAction(Action):
|
|
|
311
311
|
self.params['results'], self.params['count'] = self.get_filtered_results(filters, handler)
|
|
312
312
|
export_items = handler.get_export_item(self.params['results'])
|
|
313
313
|
|
|
314
|
+
# For the 'ground_truth' target, retrieve project information from the first result and add configuration
|
|
315
|
+
if target == 'ground_truth':
|
|
316
|
+
try:
|
|
317
|
+
first_result = next(iter(self.params['results']))
|
|
318
|
+
project_pk = first_result['project']
|
|
319
|
+
project_info = self.client.get_project(project_pk)
|
|
320
|
+
self.params['configuration'] = project_info.get('configuration', {})
|
|
321
|
+
except StopIteration:
|
|
322
|
+
self.params['configuration'] = {}
|
|
323
|
+
# For the 'assignment' and 'task' targets, retrieve the project from the filter as before
|
|
324
|
+
elif target in ['assignment', 'task'] and 'project' in self.params['filter']:
|
|
325
|
+
project_pk = self.params['filter']['project']
|
|
326
|
+
project_info = self.client.get_project(project_pk)
|
|
327
|
+
self.params['configuration'] = project_info.get('configuration', {})
|
|
328
|
+
|
|
314
329
|
storage = self.client.get_storage(self.params['storage'])
|
|
315
330
|
pathlib_cwd = get_pathlib(storage, self.params['path'])
|
|
316
331
|
return self.entrypoint(self.run, export_items, pathlib_cwd, **self.params)
|
|
@@ -36,6 +36,13 @@ class CriticalError(Exception):
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class ToTaskRun(Run):
|
|
39
|
+
class AnnotateTaskEventLog(BaseModel):
|
|
40
|
+
"""Annotate task event log model."""
|
|
41
|
+
|
|
42
|
+
info: Optional[str] = None
|
|
43
|
+
status: Context
|
|
44
|
+
created: str
|
|
45
|
+
|
|
39
46
|
class AnnotateTaskDataLog(BaseModel):
|
|
40
47
|
"""Log model for annotate task data."""
|
|
41
48
|
|
|
@@ -50,6 +57,142 @@ class ToTaskRun(Run):
|
|
|
50
57
|
failed: int
|
|
51
58
|
success: int
|
|
52
59
|
|
|
60
|
+
LOG_MESSAGES = {
|
|
61
|
+
'INVALID_PROJECT_RESPONSE': {
|
|
62
|
+
'message': 'Invalid project response received.',
|
|
63
|
+
'level': Context.DANGER,
|
|
64
|
+
},
|
|
65
|
+
'NO_DATA_COLLECTION': {
|
|
66
|
+
'message': 'Project does not have a data collection.',
|
|
67
|
+
'level': Context.DANGER,
|
|
68
|
+
},
|
|
69
|
+
'INVALID_DATA_COLLECTION_RESPONSE': {
|
|
70
|
+
'message': 'Invalid data collection response received.',
|
|
71
|
+
'level': Context.DANGER,
|
|
72
|
+
},
|
|
73
|
+
'NO_TASKS_FOUND': {
|
|
74
|
+
'message': 'Tasks to annotate not found.',
|
|
75
|
+
'level': Context.WARNING,
|
|
76
|
+
},
|
|
77
|
+
'TARGET_SPEC_REQUIRED': {
|
|
78
|
+
'message': 'Target specification name is required for file annotation method.',
|
|
79
|
+
'level': Context.DANGER,
|
|
80
|
+
},
|
|
81
|
+
'TARGET_SPEC_NOT_FOUND': {
|
|
82
|
+
'message': 'Target specification name "{}" not found in file specifications',
|
|
83
|
+
'level': Context.DANGER,
|
|
84
|
+
},
|
|
85
|
+
'UNSUPPORTED_METHOD': {
|
|
86
|
+
'message': 'Unsupported annotation method: {}',
|
|
87
|
+
'level': Context.DANGER,
|
|
88
|
+
},
|
|
89
|
+
'ANNOTATING_DATA': {
|
|
90
|
+
'message': 'Annotating data to tasks...',
|
|
91
|
+
'level': None,
|
|
92
|
+
},
|
|
93
|
+
'CRITICAL_ERROR': {
|
|
94
|
+
'message': 'Critical error occured while processing task. Stopping the job.',
|
|
95
|
+
'level': Context.DANGER,
|
|
96
|
+
},
|
|
97
|
+
'TASK_PROCESSING_FAILED': {
|
|
98
|
+
'message': 'Failed to process task {}: {}',
|
|
99
|
+
'level': Context.DANGER,
|
|
100
|
+
},
|
|
101
|
+
'ANNOTATION_COMPLETED': {
|
|
102
|
+
'message': 'Annotation completed. Success: {}, Failed: {}',
|
|
103
|
+
'level': None,
|
|
104
|
+
},
|
|
105
|
+
'INVALID_TASK_RESPONSE': {
|
|
106
|
+
'message': 'Invalid task response received for task {}',
|
|
107
|
+
'level': Context.DANGER,
|
|
108
|
+
},
|
|
109
|
+
'TARGET_SPEC_REQUIRED_FOR_TASK': {
|
|
110
|
+
'message': 'Target specification name is required for file annotation method for task {}',
|
|
111
|
+
'level': Context.DANGER,
|
|
112
|
+
},
|
|
113
|
+
'UNSUPPORTED_METHOD_FOR_TASK': {
|
|
114
|
+
'message': 'Unsupported annotation method: {} for task {}',
|
|
115
|
+
'level': Context.DANGER,
|
|
116
|
+
},
|
|
117
|
+
'PRIMARY_IMAGE_URL_NOT_FOUND': {
|
|
118
|
+
'message': 'Primary image URL not found in task data for task {}',
|
|
119
|
+
'level': Context.DANGER,
|
|
120
|
+
},
|
|
121
|
+
'FILE_SPEC_NOT_FOUND': {
|
|
122
|
+
'message': 'File specification not found for task {}',
|
|
123
|
+
'level': Context.DANGER,
|
|
124
|
+
},
|
|
125
|
+
'FILE_ORIGINAL_NAME_NOT_FOUND': {
|
|
126
|
+
'message': 'File original name not found for task {}',
|
|
127
|
+
'level': Context.DANGER,
|
|
128
|
+
},
|
|
129
|
+
'URL_NOT_FOUND': {
|
|
130
|
+
'message': 'URL not found for task {}',
|
|
131
|
+
'level': Context.DANGER,
|
|
132
|
+
},
|
|
133
|
+
'FETCH_DATA_FAILED': {
|
|
134
|
+
'message': 'Failed to fetch data from URL: {} for task {}',
|
|
135
|
+
'level': Context.DANGER,
|
|
136
|
+
},
|
|
137
|
+
'CONVERT_DATA_FAILED': {
|
|
138
|
+
'message': 'Failed to convert data to task object: {} for task {}',
|
|
139
|
+
'level': Context.DANGER,
|
|
140
|
+
},
|
|
141
|
+
'PREPROCESSOR_ID_REQUIRED': {
|
|
142
|
+
'message': 'Pre-processor ID is required for inference annotation method for task {}',
|
|
143
|
+
'level': Context.DANGER,
|
|
144
|
+
},
|
|
145
|
+
'INFERENCE_PROCESSING_FAILED': {
|
|
146
|
+
'message': 'Failed to process inference for task {}: {}',
|
|
147
|
+
'level': Context.DANGER,
|
|
148
|
+
},
|
|
149
|
+
'ANNOTATING_INFERENCE_DATA': {
|
|
150
|
+
'message': 'Annotating data to tasks using inference...',
|
|
151
|
+
'level': None,
|
|
152
|
+
},
|
|
153
|
+
'INFERENCE_ANNOTATION_COMPLETED': {
|
|
154
|
+
'message': 'Inference annotation completed. Success: {}, Failed: {}',
|
|
155
|
+
'level': None,
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
def log_message_with_code(self, code: str, *args, level: Optional[Context] = None):
|
|
160
|
+
"""Log message using predefined code and optional level override."""
|
|
161
|
+
if code not in self.LOG_MESSAGES:
|
|
162
|
+
self.log_message(f'Unknown log code: {code}')
|
|
163
|
+
return
|
|
164
|
+
|
|
165
|
+
log_config = self.LOG_MESSAGES[code]
|
|
166
|
+
message = log_config['message'].format(*args) if args else log_config['message']
|
|
167
|
+
log_level = level or log_config['level']
|
|
168
|
+
|
|
169
|
+
if log_level:
|
|
170
|
+
self.log_message(message, context=log_level.value)
|
|
171
|
+
else:
|
|
172
|
+
self.log_message(message, context=Context.INFO.value)
|
|
173
|
+
|
|
174
|
+
def log_annotate_task_event(self, code: str, *args, level: Optional[Context] = None):
|
|
175
|
+
"""Log annotate task event using predefined code."""
|
|
176
|
+
if code not in self.LOG_MESSAGES:
|
|
177
|
+
now = datetime.now().isoformat()
|
|
178
|
+
self.log(
|
|
179
|
+
'annotate_task_event',
|
|
180
|
+
self.AnnotateTaskEventLog(
|
|
181
|
+
info=f'Unknown log code: {code}', status=Context.DANGER, created=now
|
|
182
|
+
).model_dump(),
|
|
183
|
+
)
|
|
184
|
+
return
|
|
185
|
+
|
|
186
|
+
log_config = self.LOG_MESSAGES[code]
|
|
187
|
+
message = log_config['message'].format(*args) if args else log_config['message']
|
|
188
|
+
log_level = level or log_config['level'] or Context.INFO
|
|
189
|
+
|
|
190
|
+
now = datetime.now().isoformat()
|
|
191
|
+
self.log(
|
|
192
|
+
'annotate_task_event',
|
|
193
|
+
self.AnnotateTaskEventLog(info=message, status=log_level, created=now).model_dump(),
|
|
194
|
+
)
|
|
195
|
+
|
|
53
196
|
def log_annotate_task_data(self, task_info: Dict[str, Any], status: AnnotateTaskDataStatus):
|
|
54
197
|
"""Log annotate task data."""
|
|
55
198
|
now = datetime.now().isoformat()
|
|
@@ -180,20 +323,20 @@ class ToTaskAction(Action):
|
|
|
180
323
|
project_id = self.params['project']
|
|
181
324
|
project_response = client.get_project(project_id)
|
|
182
325
|
if isinstance(project_response, str):
|
|
183
|
-
self.run.
|
|
326
|
+
self.run.log_message_with_code('INVALID_PROJECT_RESPONSE')
|
|
184
327
|
self.run.end_log()
|
|
185
328
|
return {}
|
|
186
329
|
project: Dict[str, Any] = project_response
|
|
187
330
|
|
|
188
331
|
data_collection_id = project.get('data_collection')
|
|
189
332
|
if not data_collection_id:
|
|
190
|
-
self.run.
|
|
333
|
+
self.run.log_message_with_code('NO_DATA_COLLECTION')
|
|
191
334
|
self.run.end_log()
|
|
192
335
|
return {}
|
|
193
336
|
|
|
194
337
|
data_collection_response = client.get_data_collection(data_collection_id)
|
|
195
338
|
if isinstance(data_collection_response, str):
|
|
196
|
-
self.run.
|
|
339
|
+
self.run.log_message_with_code('INVALID_DATA_COLLECTION_RESPONSE')
|
|
197
340
|
self.run.end_log()
|
|
198
341
|
return {}
|
|
199
342
|
data_collection: Dict[str, Any] = data_collection_response
|
|
@@ -210,7 +353,7 @@ class ToTaskAction(Action):
|
|
|
210
353
|
|
|
211
354
|
# If no tasks found, break the job.
|
|
212
355
|
if not task_ids_count:
|
|
213
|
-
self.run.
|
|
356
|
+
self.run.log_message_with_code('NO_TASKS_FOUND')
|
|
214
357
|
self.run.end_log()
|
|
215
358
|
return {}
|
|
216
359
|
|
|
@@ -220,23 +363,21 @@ class ToTaskAction(Action):
|
|
|
220
363
|
# Check if target specification name exists in file specifications.
|
|
221
364
|
target_specification_name = self.params.get('target_specification_name')
|
|
222
365
|
if not target_specification_name:
|
|
223
|
-
self.run.
|
|
366
|
+
self.run.log_message_with_code('TARGET_SPEC_REQUIRED')
|
|
224
367
|
self.run.end_log()
|
|
225
368
|
return {}
|
|
226
369
|
|
|
227
370
|
file_specifications = data_collection.get('file_specifications', [])
|
|
228
371
|
target_spec_exists = any(spec.get('name') == target_specification_name for spec in file_specifications)
|
|
229
372
|
if not target_spec_exists:
|
|
230
|
-
self.run.
|
|
231
|
-
f'Target specification name "{target_specification_name}" not found in file specifications'
|
|
232
|
-
)
|
|
373
|
+
self.run.log_message_with_code('TARGET_SPEC_NOT_FOUND', target_specification_name)
|
|
233
374
|
self.run.end_log()
|
|
234
375
|
return {}
|
|
235
376
|
self._handle_annotate_data_from_files(task_ids, target_specification_name)
|
|
236
377
|
elif method == AnnotationMethod.INFERENCE:
|
|
237
378
|
self._handle_annotate_data_with_inference(task_ids)
|
|
238
379
|
else:
|
|
239
|
-
self.run.
|
|
380
|
+
self.run.log_message_with_code('UNSUPPORTED_METHOD', method)
|
|
240
381
|
self.run.end_log()
|
|
241
382
|
return {}
|
|
242
383
|
|
|
@@ -270,7 +411,7 @@ class ToTaskAction(Action):
|
|
|
270
411
|
# Initialize metrics and progress
|
|
271
412
|
self._update_metrics(total_tasks, success_count, failed_count)
|
|
272
413
|
self.run.set_progress(0, total_tasks, category='annotate_task_data')
|
|
273
|
-
self.run.
|
|
414
|
+
self.run.log_message_with_code('ANNOTATING_DATA')
|
|
274
415
|
|
|
275
416
|
# Process each task
|
|
276
417
|
for task_id in task_ids:
|
|
@@ -288,13 +429,11 @@ class ToTaskAction(Action):
|
|
|
288
429
|
self.run.set_progress(current_progress, total_tasks, category='annotate_task_data')
|
|
289
430
|
|
|
290
431
|
except CriticalError:
|
|
291
|
-
self.run.
|
|
292
|
-
'Critical error occured while processing task. Stopping the job.', context=Context.DANGER.value
|
|
293
|
-
)
|
|
432
|
+
self.run.log_message_with_code('CRITICAL_ERROR')
|
|
294
433
|
return
|
|
295
434
|
|
|
296
435
|
except Exception as e:
|
|
297
|
-
self.run.
|
|
436
|
+
self.run.log_annotate_task_event('TASK_PROCESSING_FAILED', task_id, str(e))
|
|
298
437
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': str(e)}, AnnotateTaskDataStatus.FAILED)
|
|
299
438
|
failed_count += 1
|
|
300
439
|
current_progress += 1
|
|
@@ -303,7 +442,7 @@ class ToTaskAction(Action):
|
|
|
303
442
|
|
|
304
443
|
# Finalize progress
|
|
305
444
|
self.run.set_progress(total_tasks, total_tasks, category='annotate_task_data')
|
|
306
|
-
self.run.
|
|
445
|
+
self.run.log_message_with_code('ANNOTATION_COMPLETED', success_count, failed_count)
|
|
307
446
|
|
|
308
447
|
def _process_single_task(
|
|
309
448
|
self,
|
|
@@ -335,7 +474,7 @@ class ToTaskAction(Action):
|
|
|
335
474
|
task_response = client.get_task(task_id, params=task_params)
|
|
336
475
|
if isinstance(task_response, str):
|
|
337
476
|
error_msg = 'Invalid task response'
|
|
338
|
-
self.run.
|
|
477
|
+
self.run.log_annotate_task_event('INVALID_TASK_RESPONSE', task_id)
|
|
339
478
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
340
479
|
return {'success': False, 'error': error_msg}
|
|
341
480
|
|
|
@@ -344,7 +483,7 @@ class ToTaskAction(Action):
|
|
|
344
483
|
if method == AnnotationMethod.FILE:
|
|
345
484
|
if not target_specification_name:
|
|
346
485
|
error_msg = 'Target specification name is required for file annotation method'
|
|
347
|
-
self.run.
|
|
486
|
+
self.run.log_message_with_code('TARGET_SPEC_REQUIRED_FOR_TASK', task_id)
|
|
348
487
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
349
488
|
return {'success': False, 'error': error_msg}
|
|
350
489
|
return self._process_single_task_with_file(client, task_id, task, target_specification_name)
|
|
@@ -352,7 +491,7 @@ class ToTaskAction(Action):
|
|
|
352
491
|
return self._process_single_task_with_inference(client, task_id, task)
|
|
353
492
|
else:
|
|
354
493
|
error_msg = f'Unsupported annotation method: {method}'
|
|
355
|
-
self.run.
|
|
494
|
+
self.run.log_annotate_task_event('UNSUPPORTED_METHOD_FOR_TASK', method, task_id)
|
|
356
495
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
357
496
|
return {'success': False, 'error': error_msg}
|
|
358
497
|
|
|
@@ -385,13 +524,13 @@ class ToTaskAction(Action):
|
|
|
385
524
|
primary_file_url, primary_file_original_name = self._extract_primary_file_url(task)
|
|
386
525
|
if not primary_file_url:
|
|
387
526
|
error_msg = 'Primary image URL not found in task data'
|
|
388
|
-
self.run.
|
|
527
|
+
self.run.log_annotate_task_event('PRIMARY_IMAGE_URL_NOT_FOUND', task_id)
|
|
389
528
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
390
529
|
return {'success': False, 'error': error_msg}
|
|
391
530
|
|
|
392
531
|
if not data_file:
|
|
393
532
|
error_msg = 'File specification not found'
|
|
394
|
-
self.run.
|
|
533
|
+
self.run.log_annotate_task_event('FILE_SPEC_NOT_FOUND', task_id)
|
|
395
534
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
396
535
|
return {'success': False, 'error': error_msg}
|
|
397
536
|
|
|
@@ -399,13 +538,13 @@ class ToTaskAction(Action):
|
|
|
399
538
|
data_file_original_name = data_file.get('file_name_original')
|
|
400
539
|
if not data_file_original_name:
|
|
401
540
|
error_msg = 'File original name not found'
|
|
402
|
-
self.run.
|
|
541
|
+
self.run.log_annotate_task_event('FILE_ORIGINAL_NAME_NOT_FOUND', task_id)
|
|
403
542
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
404
543
|
return {'success': False, 'error': error_msg}
|
|
405
544
|
|
|
406
545
|
if not data_file_url:
|
|
407
546
|
error_msg = 'URL not found'
|
|
408
|
-
self.run.
|
|
547
|
+
self.run.log_annotate_task_event('URL_NOT_FOUND', task_id)
|
|
409
548
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
410
549
|
return {'success': False, 'error': error_msg}
|
|
411
550
|
|
|
@@ -418,12 +557,12 @@ class ToTaskAction(Action):
|
|
|
418
557
|
)
|
|
419
558
|
except requests.RequestException as e:
|
|
420
559
|
error_msg = f'Failed to fetch data from URL: {str(e)}'
|
|
421
|
-
self.run.
|
|
560
|
+
self.run.log_annotate_task_event('FETCH_DATA_FAILED', str(e), task_id)
|
|
422
561
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
423
562
|
return {'success': False, 'error': error_msg}
|
|
424
563
|
except Exception as e:
|
|
425
564
|
error_msg = f'Failed to convert data to task object: {str(e)}'
|
|
426
|
-
self.run.
|
|
565
|
+
self.run.log_annotate_task_event('CONVERT_DATA_FAILED', str(e), task_id)
|
|
427
566
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
428
567
|
return {'success': False, 'error': error_msg}
|
|
429
568
|
|
|
@@ -458,7 +597,7 @@ class ToTaskAction(Action):
|
|
|
458
597
|
pre_processor_id = self.params.get('pre_processor')
|
|
459
598
|
if not pre_processor_id:
|
|
460
599
|
error_msg = 'Pre-processor ID is required for inference annotation method'
|
|
461
|
-
self.run.
|
|
600
|
+
self.run.log_message_with_code('PREPROCESSOR_ID_REQUIRED', task_id)
|
|
462
601
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
463
602
|
return {'success': False, 'error': error_msg}
|
|
464
603
|
|
|
@@ -479,7 +618,7 @@ class ToTaskAction(Action):
|
|
|
479
618
|
primary_file_url, _ = self._extract_primary_file_url(task)
|
|
480
619
|
if not primary_file_url:
|
|
481
620
|
error_msg = 'Primary image URL not found in task data'
|
|
482
|
-
self.run.
|
|
621
|
+
self.run.log_annotate_task_event('PRIMARY_IMAGE_URL_NOT_FOUND', task_id)
|
|
483
622
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
484
623
|
return {'success': False, 'error': error_msg}
|
|
485
624
|
|
|
@@ -503,7 +642,7 @@ class ToTaskAction(Action):
|
|
|
503
642
|
|
|
504
643
|
except Exception as e:
|
|
505
644
|
error_msg = f'Failed to process inference for task {task_id}: {str(e)}'
|
|
506
|
-
self.run.
|
|
645
|
+
self.run.log_message_with_code('INFERENCE_PROCESSING_FAILED', task_id, str(e))
|
|
507
646
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': error_msg}, AnnotateTaskDataStatus.FAILED)
|
|
508
647
|
return {'success': False, 'error': error_msg}
|
|
509
648
|
|
|
@@ -722,7 +861,7 @@ class ToTaskAction(Action):
|
|
|
722
861
|
# Initialize metrics and progress
|
|
723
862
|
self._update_metrics(total_tasks, success_count, failed_count)
|
|
724
863
|
self.run.set_progress(0, total_tasks, category='annotate_task_data')
|
|
725
|
-
self.run.
|
|
864
|
+
self.run.log_message_with_code('ANNOTATING_INFERENCE_DATA')
|
|
726
865
|
|
|
727
866
|
# Process each task
|
|
728
867
|
for task_id in task_ids:
|
|
@@ -738,7 +877,7 @@ class ToTaskAction(Action):
|
|
|
738
877
|
self.run.set_progress(current_progress, total_tasks, category='annotate_task_data')
|
|
739
878
|
|
|
740
879
|
except Exception as e:
|
|
741
|
-
self.run.
|
|
880
|
+
self.run.log_annotate_task_event('TASK_PROCESSING_FAILED', task_id, str(e))
|
|
742
881
|
self.run.log_annotate_task_data({'task_id': task_id, 'error': str(e)}, AnnotateTaskDataStatus.FAILED)
|
|
743
882
|
failed_count += 1
|
|
744
883
|
current_progress += 1
|
|
@@ -747,4 +886,4 @@ class ToTaskAction(Action):
|
|
|
747
886
|
|
|
748
887
|
# Finalize progress
|
|
749
888
|
self.run.set_progress(total_tasks, total_tasks, category='annotate_task_data')
|
|
750
|
-
self.run.
|
|
889
|
+
self.run.log_message_with_code('INFERENCE_ANNOTATION_COMPLETED', success_count, failed_count)
|
synapse_sdk/shared/enums.py
CHANGED
|
@@ -2,11 +2,43 @@ from enum import Enum
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class Context(str, Enum):
|
|
5
|
+
"""Context levels for logging and message categorization.
|
|
6
|
+
|
|
7
|
+
This enum defines different context levels that can be used for logging messages,
|
|
8
|
+
UI feedback, and other categorization purposes throughout the application.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
# In logging methods
|
|
12
|
+
self.log_message("Operation completed", context=Context.SUCCESS.value)
|
|
13
|
+
self.log_message("Warning: deprecated method", context=Context.WARNING.value)
|
|
14
|
+
|
|
15
|
+
# In LOG_MESSAGES dictionary
|
|
16
|
+
LOG_MESSAGES = {
|
|
17
|
+
'SUCCESS_CODE': {'message': 'Success!', 'level': Context.SUCCESS},
|
|
18
|
+
'ERROR_CODE': {'message': 'Error occurred', 'level': Context.DANGER},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# In UI components for styling/theming
|
|
22
|
+
if context == Context.DANGER:
|
|
23
|
+
render_error_style()
|
|
24
|
+
elif context == Context.SUCCESS:
|
|
25
|
+
render_success_style()
|
|
26
|
+
|
|
27
|
+
Attributes:
|
|
28
|
+
INFO: General informational messages (neutral)
|
|
29
|
+
SUCCESS: Success messages and positive outcomes
|
|
30
|
+
WARNING: Warning messages for non-critical issues
|
|
31
|
+
DANGER: Error messages and critical failures
|
|
32
|
+
ERROR: Legacy error context (use DANGER for new implementations)
|
|
33
|
+
DEBUG: Debug-level messages for development
|
|
34
|
+
"""
|
|
35
|
+
|
|
5
36
|
INFO = 'info'
|
|
6
37
|
SUCCESS = 'success'
|
|
7
38
|
WARNING = 'warning'
|
|
8
39
|
DANGER = 'danger'
|
|
9
40
|
ERROR = 'error'
|
|
41
|
+
DEBUG = 'debug'
|
|
10
42
|
|
|
11
43
|
|
|
12
44
|
class SupportedTools(Enum):
|
|
@@ -124,7 +124,7 @@ synapse_sdk/plugins/categories/data_validation/templates/plugin/validation.py,sh
|
|
|
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
|
-
synapse_sdk/plugins/categories/export/actions/export.py,sha256=
|
|
127
|
+
synapse_sdk/plugins/categories/export/actions/export.py,sha256=UZaL6F7rHgbF5FSGpXuA3iDaSE1zJ193I_NhjfE1GWk,11598
|
|
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
130
|
synapse_sdk/plugins/categories/export/templates/plugin/export.py,sha256=GDb6Ucodsr5aBPMU4alr68-DyFoLR5TyhC_MCaJrkF0,6411
|
|
@@ -152,7 +152,7 @@ synapse_sdk/plugins/categories/post_annotation/templates/plugin/post_annotation.
|
|
|
152
152
|
synapse_sdk/plugins/categories/pre_annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
153
153
|
synapse_sdk/plugins/categories/pre_annotation/actions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
154
154
|
synapse_sdk/plugins/categories/pre_annotation/actions/pre_annotation.py,sha256=6ib3RmnGrjpsQ0e_G-mRH1lfFunQ3gh2M831vuDn7HU,344
|
|
155
|
-
synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py,sha256=
|
|
155
|
+
synapse_sdk/plugins/categories/pre_annotation/actions/to_task.py,sha256=M4EUOkCCSchxcdyfkhxW0eQZ80I55poVuW6od8hiuxI,37541
|
|
156
156
|
synapse_sdk/plugins/categories/pre_annotation/templates/config.yaml,sha256=VREoCp9wsvZ8T2E1d_MEKlR8TC_herDJGVQtu3ezAYU,589
|
|
157
157
|
synapse_sdk/plugins/categories/pre_annotation/templates/plugin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
158
158
|
synapse_sdk/plugins/categories/pre_annotation/templates/plugin/pre_annotation.py,sha256=HBHxHuv2gMBzDB2alFfrzI_SZ1Ztk6mo7eFbR5GqHKw,106
|
|
@@ -187,7 +187,7 @@ synapse_sdk/plugins/utils/config.py,sha256=uyGp9GhphQE-b6sla3NwMUH0DeBunvi7szycR
|
|
|
187
187
|
synapse_sdk/plugins/utils/legacy.py,sha256=UWEk5FHk_AqU4GxhfyKJ76VgBUHS-ktKV6_jTJCgT8k,2689
|
|
188
188
|
synapse_sdk/plugins/utils/registry.py,sha256=HKALzYcPQSFsdLAzodYXMdfFnKOcg6oHYBrx7EwVqNU,1484
|
|
189
189
|
synapse_sdk/shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
190
|
-
synapse_sdk/shared/enums.py,sha256=
|
|
190
|
+
synapse_sdk/shared/enums.py,sha256=5uy4HGKtGCAvrBMuVSzwloJ6f41sOk0ty__605zF8hg,3538
|
|
191
191
|
synapse_sdk/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
192
192
|
synapse_sdk/utils/dataset.py,sha256=zWTzFmv589izFr62BDuApi3r5FpTsdm-5AmriC0AEdM,1865
|
|
193
193
|
synapse_sdk/utils/debug.py,sha256=F7JlUwYjTFZAMRbBqKm6hxOIz-_IXYA8lBInOS4jbS4,100
|
|
@@ -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.0a93.dist-info/licenses/LICENSE,sha256=bKzmC5YAg4V1Fhl8OO_tqY8j62hgdncAkN7VrdjmrGk,1101
|
|
225
|
+
synapse_sdk-1.0.0a93.dist-info/METADATA,sha256=NQ5zn-ID4jYmBauhJUpI351Eyfos0i9pRmIqPFuOZUY,3837
|
|
226
|
+
synapse_sdk-1.0.0a93.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
227
|
+
synapse_sdk-1.0.0a93.dist-info/entry_points.txt,sha256=VNptJoGoNJI8yLXfBmhgUefMsmGI0m3-0YoMvrOgbxo,48
|
|
228
|
+
synapse_sdk-1.0.0a93.dist-info/top_level.txt,sha256=ytgJMRK1slVOKUpgcw3LEyHHP7S34J6n_gJzdkcSsw8,12
|
|
229
|
+
synapse_sdk-1.0.0a93.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|