edu-rdm-integration 3.11.2__py3-none-any.whl → 3.13.0__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.
- edu_rdm_integration/core/storages.py +11 -11
- edu_rdm_integration/pipelines/transfer/mixins.py +4 -4
- edu_rdm_integration/stages/collect_data/function_templates/function_collect_data_template/tests.py-tpl +4 -4
- edu_rdm_integration/stages/collect_data/functions/base/functions.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/base/helpers.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/base/managers.py +6 -6
- edu_rdm_integration/stages/collect_data/functions/base/mixins.py +6 -6
- edu_rdm_integration/stages/collect_data/functions/base/runners.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/calculated/base/caches.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/calculated/base/errors.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/calculated/base/presenters.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/calculated/base/results.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/calculated/base/validators.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/calculated/strategies.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/caches.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/errors.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/presenters.py +3 -3
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/results.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/validators.py +5 -5
- edu_rdm_integration/stages/collect_data/functions/non_calculated/strategies.py +3 -3
- edu_rdm_integration/stages/collect_data/models.py +3 -3
- edu_rdm_integration/stages/collect_data/operations.py +3 -3
- edu_rdm_integration/stages/collect_data/tests.py +10 -10
- edu_rdm_integration/stages/export_data/function_templates/function_export_data_template/runners.py-tpl +3 -3
- edu_rdm_integration/stages/export_data/functions/base/caches.py +5 -5
- edu_rdm_integration/stages/export_data/functions/base/consts.py +3 -0
- edu_rdm_integration/stages/export_data/functions/base/errors.py +3 -3
- edu_rdm_integration/stages/export_data/functions/base/functions.py +24 -10
- edu_rdm_integration/stages/export_data/functions/base/helpers.py +5 -5
- edu_rdm_integration/stages/export_data/functions/base/managers.py +3 -3
- edu_rdm_integration/stages/export_data/functions/base/presenters.py +3 -3
- edu_rdm_integration/stages/export_data/functions/base/results.py +5 -5
- edu_rdm_integration/stages/export_data/functions/base/runners.py +3 -3
- edu_rdm_integration/stages/export_data/functions/base/tests.py +161 -0
- edu_rdm_integration/stages/export_data/functions/base/validators.py +5 -5
- edu_rdm_integration/stages/export_data/models.py +4 -4
- edu_rdm_integration/stages/export_data/operations.py +4 -4
- edu_rdm_integration/stages/export_data/strategies.py +3 -3
- {edu_rdm_integration-3.11.2.dist-info → edu_rdm_integration-3.13.0.dist-info}/METADATA +3 -3
- {edu_rdm_integration-3.11.2.dist-info → edu_rdm_integration-3.13.0.dist-info}/RECORD +43 -60
- edu_rdm_integration/adapters/__init__.py +0 -1
- edu_rdm_integration/adapters/apps.py +0 -26
- edu_rdm_integration/adapters/caches.py +0 -56
- edu_rdm_integration/adapters/consts.py +0 -1
- edu_rdm_integration/adapters/enums.py +0 -1
- edu_rdm_integration/adapters/errors.py +0 -24
- edu_rdm_integration/adapters/functions.py +0 -99
- edu_rdm_integration/adapters/helpers.py +0 -63
- edu_rdm_integration/adapters/managers.py +0 -61
- edu_rdm_integration/adapters/presenters.py +0 -37
- edu_rdm_integration/adapters/receivers.py +0 -35
- edu_rdm_integration/adapters/results.py +0 -65
- edu_rdm_integration/adapters/runners.py +0 -140
- edu_rdm_integration/adapters/strategies.py +0 -166
- edu_rdm_integration/adapters/strings.py +0 -1
- edu_rdm_integration/adapters/tests.py +0 -1
- edu_rdm_integration/adapters/validators.py +0 -58
- {edu_rdm_integration-3.11.2.dist-info → edu_rdm_integration-3.13.0.dist-info}/WHEEL +0 -0
- {edu_rdm_integration-3.11.2.dist-info → edu_rdm_integration-3.13.0.dist-info}/licenses/LICENSE +0 -0
- {edu_rdm_integration-3.11.2.dist-info → edu_rdm_integration-3.13.0.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from edu_function_tools.errors import (
|
|
2
|
+
EduError,
|
|
3
3
|
)
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class BaseExportDataError(
|
|
6
|
+
class BaseExportDataError(EduError):
|
|
7
7
|
"""Базовая ошибка функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
@@ -25,8 +25,8 @@ from educommon.integration_entities.mixins import (
|
|
|
25
25
|
EntitiesMixin,
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
from
|
|
29
|
-
|
|
28
|
+
from edu_function_tools.functions import (
|
|
29
|
+
EduLazySavingPredefinedQueueGlobalHelperFunction,
|
|
30
30
|
)
|
|
31
31
|
from edu_rdm_integration.core.consts import (
|
|
32
32
|
LOGS_DELIMITER,
|
|
@@ -57,7 +57,7 @@ from edu_rdm_integration.stages.export_data.models import (
|
|
|
57
57
|
|
|
58
58
|
class BaseExportDataFunction(
|
|
59
59
|
EntitiesMixin,
|
|
60
|
-
|
|
60
|
+
EduLazySavingPredefinedQueueGlobalHelperFunction,
|
|
61
61
|
metaclass=ABCMeta,
|
|
62
62
|
):
|
|
63
63
|
"""Базовый класс функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
@@ -72,11 +72,6 @@ class BaseExportDataFunction(
|
|
|
72
72
|
RDMExportingDataSubStageEntity.objects.create(
|
|
73
73
|
exporting_data_sub_stage=self._sub_stage, entity_id=self.first_entity.key
|
|
74
74
|
)
|
|
75
|
-
# Проставление подэтапа выгрузки
|
|
76
|
-
self.entities[0].main_model_enum.model.objects.filter(pk__in=model_ids).update(
|
|
77
|
-
exporting_sub_stage=self._sub_stage,
|
|
78
|
-
)
|
|
79
|
-
|
|
80
75
|
self._chunk_index = kwargs.get('chunk_index')
|
|
81
76
|
|
|
82
77
|
logger.info(f'{LOGS_DELIMITER * 3}{repr(self._sub_stage)} created.')
|
|
@@ -90,6 +85,13 @@ class BaseExportDataFunction(
|
|
|
90
85
|
}
|
|
91
86
|
|
|
92
87
|
self.has_data = False
|
|
88
|
+
# Id записей моделей РВД, которые в итоге попали в файл
|
|
89
|
+
self.exported_to_file_model_ids = set()
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def _models_unique_id(self) -> str:
|
|
93
|
+
"""Возвращает название уникального идентификатора записи модели рвд."""
|
|
94
|
+
return 'id'
|
|
93
95
|
|
|
94
96
|
def _prepare_helper_class(self) -> type[BaseExportDataFunctionHelper]:
|
|
95
97
|
"""Возвращает класс помощника функции."""
|
|
@@ -141,8 +143,9 @@ class BaseExportDataFunction(
|
|
|
141
143
|
entity_instance=entity_instance,
|
|
142
144
|
)
|
|
143
145
|
)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
+
entity_instance_id = getattr(entity_instance, self._models_unique_id, None)
|
|
147
|
+
if entity_instance_id:
|
|
148
|
+
self.exported_to_file_model_ids.add(entity_instance_id)
|
|
146
149
|
|
|
147
150
|
for operation in EntityLogOperation.values.keys():
|
|
148
151
|
entities = self._data.get(operation)
|
|
@@ -217,9 +220,20 @@ class BaseExportDataFunction(
|
|
|
217
220
|
if not self.has_data
|
|
218
221
|
else RDMExportingDataSubStageStatus.READY_FOR_EXPORT.key
|
|
219
222
|
)
|
|
223
|
+
# Проставление подэтапа выгрузки
|
|
224
|
+
if self.exported_to_file_model_ids:
|
|
225
|
+
self.entities[0].main_model_enum.model.objects.filter(pk__in=self.exported_to_file_model_ids).update(
|
|
226
|
+
exporting_sub_stage=self._sub_stage,
|
|
227
|
+
)
|
|
228
|
+
|
|
220
229
|
else:
|
|
221
230
|
self._sub_stage.status_id = RDMExportingDataSubStageStatus.FAILED.key
|
|
222
231
|
|
|
223
232
|
self._sub_stage.save()
|
|
224
233
|
|
|
225
234
|
logger.info(f'{LOGS_DELIMITER * 3}change status {repr(self._sub_stage)}')
|
|
235
|
+
|
|
236
|
+
def get_function_data(self):
|
|
237
|
+
"""Возвращает словарь с данными сущностей подготовленных к выгрузке."""
|
|
238
|
+
return self._data
|
|
239
|
+
|
|
@@ -17,9 +17,9 @@ from educommon.utils.crypto import (
|
|
|
17
17
|
HashData,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
from edu_function_tools.helpers import (
|
|
21
|
+
EduFunctionHelper,
|
|
22
|
+
EduRunnerHelper,
|
|
23
23
|
)
|
|
24
24
|
from edu_rdm_integration.core.consts import (
|
|
25
25
|
DATE_FORMAT,
|
|
@@ -32,7 +32,7 @@ from edu_rdm_integration.stages.export_data.functions.base.caches import (
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
class BaseExportDataRunnerHelper(
|
|
35
|
+
class BaseExportDataRunnerHelper(EduRunnerHelper):
|
|
36
36
|
"""Базовый класс помощников ранеров функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
37
37
|
|
|
38
38
|
def _prepare_cache_class(self) -> type[BaseExportDataRunnerCacheStorage]:
|
|
@@ -40,7 +40,7 @@ class BaseExportDataRunnerHelper(WebEduRunnerHelper):
|
|
|
40
40
|
return BaseExportDataRunnerCacheStorage
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
class BaseExportDataFunctionHelper(
|
|
43
|
+
class BaseExportDataFunctionHelper(EduFunctionHelper):
|
|
44
44
|
"""Базовый класс помощников функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
45
45
|
|
|
46
46
|
cryptographer = HashData(hash_algorithm=HASH_ALGORITHM)
|
|
@@ -17,8 +17,8 @@ from m3_db_utils.models import (
|
|
|
17
17
|
ModelEnumValue,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
|
|
20
|
+
from edu_function_tools.managers import (
|
|
21
|
+
EduRunnerManager,
|
|
22
22
|
)
|
|
23
23
|
from edu_rdm_integration.core.consts import (
|
|
24
24
|
LOGS_DELIMITER,
|
|
@@ -38,7 +38,7 @@ from edu_rdm_integration.stages.export_data.models import (
|
|
|
38
38
|
)
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
class BaseExportDataRunnerManager(
|
|
41
|
+
class BaseExportDataRunnerManager(EduRunnerManager, metaclass=ABCMeta):
|
|
42
42
|
"""Менеджер ранеров функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
43
43
|
|
|
44
44
|
forced_run = True
|
|
@@ -2,10 +2,10 @@ from abc import (
|
|
|
2
2
|
ABCMeta,
|
|
3
3
|
)
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
|
|
5
|
+
from edu_function_tools.presenters import (
|
|
6
|
+
EduResultPresenter,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
class BaseExportDataResultPresenter(
|
|
10
|
+
class BaseExportDataResultPresenter(EduResultPresenter, metaclass=ABCMeta):
|
|
11
11
|
"""Презентер результата работы функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
from edu_function_tools.results import (
|
|
2
|
+
EduFunctionResult,
|
|
3
|
+
EduRunnerResult,
|
|
4
4
|
)
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class BaseExportDataRunnerResult(
|
|
7
|
+
class BaseExportDataRunnerResult(EduRunnerResult):
|
|
8
8
|
"""Базовый класс результата работы ранера функций выгрузки данных для интеграции с РВД."""
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
class BaseExportDataFunctionResult(
|
|
11
|
+
class BaseExportDataFunctionResult(EduFunctionResult):
|
|
12
12
|
"""Базовый класс результата функции выгрузки данных для интеграции с РВД."""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
1
|
+
from edu_function_tools.runners import (
|
|
2
|
+
EduRunner,
|
|
3
3
|
)
|
|
4
4
|
from edu_rdm_integration.stages.export_data.functions.base.helpers import (
|
|
5
5
|
BaseExportDataRunnerHelper,
|
|
@@ -12,7 +12,7 @@ from edu_rdm_integration.stages.export_data.functions.base.validators import (
|
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class BaseExportDataRunner(
|
|
15
|
+
class BaseExportDataRunner(EduRunner):
|
|
16
16
|
"""Базовый класс ранеров функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
17
17
|
|
|
18
18
|
def _prepare_helper_class(self) -> type[BaseExportDataRunnerHelper]:
|
|
@@ -1 +1,162 @@
|
|
|
1
1
|
# Реализуйте свои unit-тесты здесь
|
|
2
|
+
import datetime
|
|
3
|
+
import shutil
|
|
4
|
+
from typing import (
|
|
5
|
+
TYPE_CHECKING,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
from django.conf import (
|
|
9
|
+
settings,
|
|
10
|
+
)
|
|
11
|
+
from django.test import (
|
|
12
|
+
TestCase,
|
|
13
|
+
override_settings,
|
|
14
|
+
)
|
|
15
|
+
from django.utils import (
|
|
16
|
+
timezone,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from edu_function_tools.models import (
|
|
20
|
+
EduEntity,
|
|
21
|
+
EduEntityType,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
from edu_rdm_integration.core.consts import (
|
|
25
|
+
REGIONAL_DATA_MART_INTEGRATION_COLLECTING_DATA,
|
|
26
|
+
REGIONAL_DATA_MART_INTEGRATION_EXPORTING_DATA,
|
|
27
|
+
)
|
|
28
|
+
from edu_rdm_integration.stages.collect_data.models import (
|
|
29
|
+
CollectingExportedDataStage,
|
|
30
|
+
CollectingExportedDataSubStage,
|
|
31
|
+
)
|
|
32
|
+
from edu_rdm_integration.stages.export_data.functions.base.consts import (
|
|
33
|
+
TEST_DIR,
|
|
34
|
+
)
|
|
35
|
+
from edu_rdm_integration.stages.export_data.models import (
|
|
36
|
+
ExportingDataStage,
|
|
37
|
+
ExportingDataSubStage,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if TYPE_CHECKING:
|
|
42
|
+
from edu_function_tools.managers import (
|
|
43
|
+
EduRunnerManager,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
from edu_rdm_integration.stages.export_data.functions.base.functions import (
|
|
47
|
+
BaseExportDataFunction,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class BaseExportTestCase(TestCase):
|
|
52
|
+
"""Базовый тест экспорта сущности РВД."""
|
|
53
|
+
|
|
54
|
+
databases = (settings.DEFAULT_DB_ALIAS, settings.SERVICE_DB_ALIAS)
|
|
55
|
+
|
|
56
|
+
def setUp(self) -> None:
|
|
57
|
+
"""Подготавливает фикстуры."""
|
|
58
|
+
self.now = timezone.now()
|
|
59
|
+
|
|
60
|
+
self.export_period_started_at = datetime.datetime.combine(self.now, datetime.time.min)
|
|
61
|
+
self.export_period_ended_at = datetime.datetime.combine(self.now, datetime.time.max)
|
|
62
|
+
|
|
63
|
+
def create_sub_stage(self, *class_names: str) -> CollectingExportedDataSubStage:
|
|
64
|
+
"""Создает подэтап сбора данных."""
|
|
65
|
+
function_tools_entities = dict(
|
|
66
|
+
EduEntity.objects.filter(
|
|
67
|
+
type__in=(EduEntityType.MANAGER.key, EduEntityType.FUNCTION.key),
|
|
68
|
+
tags__contains=[REGIONAL_DATA_MART_INTEGRATION_COLLECTING_DATA],
|
|
69
|
+
class_name__in=class_names,
|
|
70
|
+
).values_list('type', 'uuid'),
|
|
71
|
+
)
|
|
72
|
+
stage = CollectingExportedDataStage.objects.create(
|
|
73
|
+
manager_id=function_tools_entities[EduEntityType.MANAGER.key],
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return CollectingExportedDataSubStage.objects.create(
|
|
77
|
+
function_id=function_tools_entities[EduEntityType.FUNCTION.key],
|
|
78
|
+
stage=stage,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def tearDownClass(cls) -> None:
|
|
83
|
+
try:
|
|
84
|
+
shutil.rmtree(TEST_DIR)
|
|
85
|
+
except OSError:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
super().tearDownClass()
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class BaseExportManagerTestCase(BaseExportTestCase):
|
|
92
|
+
"""Базовый тест менеджера экспорта сущности РВД."""
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def manager(self) -> type['EduRunnerManager']:
|
|
96
|
+
"""Менеджер раннера Функции экспорта'."""
|
|
97
|
+
raise NotImplementedError
|
|
98
|
+
|
|
99
|
+
@override_settings(MEDIA_ROOT=(TEST_DIR + '/media'))
|
|
100
|
+
def run_exporting_manager(self) -> None:
|
|
101
|
+
"""Запускает менеджер экспорта."""
|
|
102
|
+
runner_manager = self.manager(
|
|
103
|
+
period_started_at=self.export_period_started_at,
|
|
104
|
+
period_ended_at=self.export_period_ended_at,
|
|
105
|
+
)
|
|
106
|
+
runner_manager.run()
|
|
107
|
+
|
|
108
|
+
def get_exporting_stage_sub_stage(self, *class_names) -> tuple[ExportingDataStage, ExportingDataSubStage]:
|
|
109
|
+
"""Возвращает этап и подэтап экспорта."""
|
|
110
|
+
function_tools_entities = dict(
|
|
111
|
+
EduEntity.objects.filter(
|
|
112
|
+
type__in=(EduEntityType.MANAGER.key, EduEntityType.FUNCTION.key),
|
|
113
|
+
tags__contains=[REGIONAL_DATA_MART_INTEGRATION_EXPORTING_DATA],
|
|
114
|
+
class_name__in=class_names,
|
|
115
|
+
).values_list('type', 'uuid'),
|
|
116
|
+
)
|
|
117
|
+
exported_data_stage = ExportingDataStage.objects.filter(
|
|
118
|
+
manager_id=function_tools_entities[EduEntityType.MANAGER.key],
|
|
119
|
+
period_started_at=self.export_period_started_at,
|
|
120
|
+
period_ended_at=self.export_period_ended_at,
|
|
121
|
+
).first()
|
|
122
|
+
exported_data_substage = ExportingDataSubStage.objects.filter(
|
|
123
|
+
function_id=function_tools_entities[EduEntityType.FUNCTION.key],
|
|
124
|
+
stage=exported_data_stage
|
|
125
|
+
).first()
|
|
126
|
+
|
|
127
|
+
return exported_data_stage, exported_data_substage
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
class BaseExportFunctionTestCase(BaseExportTestCase):
|
|
131
|
+
"""Базовый тест менеджера экспорта сущности РВД."""
|
|
132
|
+
|
|
133
|
+
@property
|
|
134
|
+
def export_function(self) -> type['BaseExportDataFunction']:
|
|
135
|
+
"""Функция экспорта."""
|
|
136
|
+
raise NotImplementedError
|
|
137
|
+
|
|
138
|
+
def create_exporting_stage(self, *class_names: str) -> ExportingDataStage:
|
|
139
|
+
"""Создает этап экспорта данных."""
|
|
140
|
+
function_tools_entities = dict(
|
|
141
|
+
EduEntity.objects.filter(
|
|
142
|
+
type__in=(EduEntityType.MANAGER.key, EduEntityType.FUNCTION.key),
|
|
143
|
+
tags__contains=[REGIONAL_DATA_MART_INTEGRATION_EXPORTING_DATA],
|
|
144
|
+
class_name__in=class_names,
|
|
145
|
+
).values_list('type', 'uuid'),
|
|
146
|
+
)
|
|
147
|
+
return ExportingDataStage.objects.create(
|
|
148
|
+
manager_id=function_tools_entities[EduEntityType.MANAGER.key],
|
|
149
|
+
period_started_at=self.export_period_started_at,
|
|
150
|
+
period_ended_at=self.export_period_ended_at,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
@override_settings(MEDIA_ROOT=(TEST_DIR + '/media'))
|
|
154
|
+
def run_exporting_function(self, exporting_stage: ExportingDataStage, model_ids: list[int]) -> dict:
|
|
155
|
+
"""Запускает функцию экспорта."""
|
|
156
|
+
exporting_function = self.export_function(
|
|
157
|
+
stage=exporting_stage,
|
|
158
|
+
model_ids=model_ids
|
|
159
|
+
)
|
|
160
|
+
exporting_function.run()
|
|
161
|
+
|
|
162
|
+
return exporting_function.get_function_data()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
from edu_function_tools.validators import (
|
|
2
|
+
EduFunctionValidator,
|
|
3
|
+
EduRunnerValidator,
|
|
4
4
|
)
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class BaseExportDataRunnerValidator(
|
|
7
|
+
class BaseExportDataRunnerValidator(EduRunnerValidator):
|
|
8
8
|
"""Базовый класс валидаторов ранеров функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
9
9
|
|
|
10
10
|
def validate(self, runnable):
|
|
@@ -12,7 +12,7 @@ class BaseExportDataRunnerValidator(WebEduRunnerValidator):
|
|
|
12
12
|
super().validate(runnable=runnable)
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
class BaseExportDataFunctionValidator(
|
|
15
|
+
class BaseExportDataFunctionValidator(EduFunctionValidator):
|
|
16
16
|
"""Базовый класс валидаторов функций выгрузки данных для интеграции с "Региональная витрина данных"."""
|
|
17
17
|
|
|
18
18
|
def validate(self, runnable):
|
|
@@ -28,8 +28,8 @@ from educommon.django.db.mixins import (
|
|
|
28
28
|
from educommon.integration_entities.enums import (
|
|
29
29
|
EntityLogOperation,
|
|
30
30
|
)
|
|
31
|
-
from
|
|
32
|
-
|
|
31
|
+
from edu_function_tools.models import (
|
|
32
|
+
EduEntity,
|
|
33
33
|
)
|
|
34
34
|
from m3_db_utils.models import (
|
|
35
35
|
ModelEnumValue,
|
|
@@ -79,7 +79,7 @@ class RDMExportingDataStage(ReprStrPreModelMixin, BaseObjectModel):
|
|
|
79
79
|
"""Этап выгрузки данных."""
|
|
80
80
|
|
|
81
81
|
manager = ForeignKey(
|
|
82
|
-
to=
|
|
82
|
+
to=EduEntity,
|
|
83
83
|
verbose_name='Менеджер ранера Функции',
|
|
84
84
|
on_delete=PROTECT,
|
|
85
85
|
null=True,
|
|
@@ -168,7 +168,7 @@ class RDMExportingDataSubStage(ReprStrPreModelMixin, BaseObjectModel):
|
|
|
168
168
|
"""Подэтап выгрузки данных."""
|
|
169
169
|
|
|
170
170
|
function = ForeignKey(
|
|
171
|
-
to=
|
|
171
|
+
to=EduEntity,
|
|
172
172
|
verbose_name='Функция',
|
|
173
173
|
on_delete=PROTECT,
|
|
174
174
|
null=True,
|
|
@@ -82,8 +82,8 @@ from edu_rdm_integration.stages.export_data.models import (
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
if TYPE_CHECKING:
|
|
85
|
-
from
|
|
86
|
-
|
|
85
|
+
from edu_function_tools.managers import (
|
|
86
|
+
EduRunnerManager,
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
|
|
@@ -107,7 +107,7 @@ class BaseExportEntitiesData(BaseOperationData):
|
|
|
107
107
|
self.period_ended_at = period_ended_at
|
|
108
108
|
|
|
109
109
|
# Классы менеджеров Функций, которые должны быть запущены для выгрузки данных
|
|
110
|
-
self._exporting_data_managers: set[type['
|
|
110
|
+
self._exporting_data_managers: set[type['EduRunnerManager']] = set()
|
|
111
111
|
|
|
112
112
|
# Результаты работы Функций выгрузки данных
|
|
113
113
|
self._exporting_data_results = []
|
|
@@ -211,7 +211,7 @@ class BaseExportLatestEntitiesData(BaseExportEntitiesData):
|
|
|
211
211
|
):
|
|
212
212
|
super().__init__(entities, period_started_at, period_ended_at, **kwargs)
|
|
213
213
|
|
|
214
|
-
self._exporting_data_managers: set[type['
|
|
214
|
+
self._exporting_data_managers: set[type['EduRunnerManager']] = OrderedSet()
|
|
215
215
|
|
|
216
216
|
# Словарь данных с классами менеджеров и их сущностями
|
|
217
217
|
self._manager_entities_map: dict[type[object], list[str]] = defaultdict(set)
|
|
@@ -2,8 +2,8 @@ from typing import (
|
|
|
2
2
|
Optional,
|
|
3
3
|
)
|
|
4
4
|
|
|
5
|
-
from
|
|
6
|
-
|
|
5
|
+
from edu_function_tools.strategies import (
|
|
6
|
+
EduSyncBaseRunnerLazySavingPredefinedQueueFunctionImplementationStrategy,
|
|
7
7
|
)
|
|
8
8
|
from edu_rdm_integration.core.consts import (
|
|
9
9
|
REGIONAL_DATA_MART_INTEGRATION_EXPORTING_DATA,
|
|
@@ -42,7 +42,7 @@ from edu_rdm_integration.stages.export_data.functions.base.validators import (
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
class ExportDataFunctionImplementationStrategy(
|
|
45
|
-
|
|
45
|
+
EduSyncBaseRunnerLazySavingPredefinedQueueFunctionImplementationStrategy,
|
|
46
46
|
):
|
|
47
47
|
"""Стратегия создания функций выгрузки данных.
|
|
48
48
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: edu-rdm-integration
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.13.0
|
|
4
4
|
Summary: Интеграция с Региональной витриной данных
|
|
5
5
|
Author-email: BARS Group <education_dev@bars.group>
|
|
6
6
|
Project-URL: Homepage, https://stash.bars-open.ru/projects/EDUBASE/repos/edu-rdm-integration/browse
|
|
@@ -25,8 +25,8 @@ Requires-Dist: transliterate<2
|
|
|
25
25
|
Requires-Dist: Django<5.0,>=3.1
|
|
26
26
|
Requires-Dist: celery<5.3,>=4.4.7
|
|
27
27
|
Requires-Dist: asyncpg==0.23.0
|
|
28
|
-
Requires-Dist: educommon<4,>=3.
|
|
29
|
-
Requires-Dist: function-tools<1,>=0.
|
|
28
|
+
Requires-Dist: educommon<4,>=3.21.0
|
|
29
|
+
Requires-Dist: edu-function-tools<1,>=0.1.0
|
|
30
30
|
Requires-Dist: m3-db-utils<1,>=0.3.10
|
|
31
31
|
Requires-Dist: m3-django-compat<2,>=1.10.2
|
|
32
32
|
Requires-Dist: uploader-client<1,>=0.2.3
|