edu-rdm-integration 3.4.9__py3-none-any.whl → 3.5.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/adapters/functions.py +3 -6
- edu_rdm_integration/adapters/helpers.py +2 -5
- edu_rdm_integration/adapters/managers.py +1 -4
- edu_rdm_integration/adapters/runners.py +9 -13
- edu_rdm_integration/apps.py +1 -1
- edu_rdm_integration/collect_data/base/caches.py +5 -7
- edu_rdm_integration/collect_data/base/helpers.py +1 -5
- edu_rdm_integration/collect_data/base/managers.py +4 -7
- edu_rdm_integration/collect_data/base/mixins.py +5 -8
- edu_rdm_integration/collect_data/calculated/base/functions.py +3 -6
- edu_rdm_integration/collect_data/calculated/base/helpers.py +2 -6
- edu_rdm_integration/collect_data/calculated/base/managers.py +1 -4
- edu_rdm_integration/collect_data/calculated/base/runners.py +3 -7
- edu_rdm_integration/collect_data/calculated/strategies.py +1 -2
- edu_rdm_integration/collect_data/collect.py +6 -10
- edu_rdm_integration/collect_data/generators.py +4 -6
- edu_rdm_integration/collect_data/helpers.py +1 -4
- edu_rdm_integration/collect_data/non_calculated/base/caches.py +2 -4
- edu_rdm_integration/collect_data/non_calculated/base/functions.py +3 -6
- edu_rdm_integration/collect_data/non_calculated/base/helpers.py +2 -6
- edu_rdm_integration/collect_data/non_calculated/base/managers.py +1 -4
- edu_rdm_integration/collect_data/non_calculated/base/runners.py +3 -7
- edu_rdm_integration/collect_data/non_calculated/strategies.py +1 -2
- edu_rdm_integration/collect_data/tests.py +3 -5
- edu_rdm_integration/entities.py +21 -22
- edu_rdm_integration/enum_register/mixins.py +7 -10
- edu_rdm_integration/enum_register/register.py +1 -2
- edu_rdm_integration/export_data/base/caches.py +1 -5
- edu_rdm_integration/export_data/base/functions.py +5 -7
- edu_rdm_integration/export_data/base/helpers.py +9 -13
- edu_rdm_integration/export_data/base/managers.py +3 -6
- edu_rdm_integration/export_data/base/runners.py +3 -7
- edu_rdm_integration/export_data/export.py +5 -9
- edu_rdm_integration/export_data/export_manger.py +1 -2
- edu_rdm_integration/export_data/generators.py +2 -3
- edu_rdm_integration/export_data/helpers.py +1 -4
- edu_rdm_integration/export_data/queue.py +3 -6
- edu_rdm_integration/export_data/strategies.py +1 -2
- edu_rdm_integration/function_templates/function_collect_data_template/functions.py-tpl +8 -9
- edu_rdm_integration/function_templates/function_collect_data_template/helpers.py-tpl +4 -6
- edu_rdm_integration/function_templates/function_collect_data_template/managers.py-tpl +2 -4
- edu_rdm_integration/function_templates/function_collect_data_template/runners.py-tpl +5 -7
- edu_rdm_integration/function_templates/function_collect_data_template/tests.py-tpl +1 -6
- edu_rdm_integration/function_templates/function_export_data_template/caches.py-tpl +1 -2
- edu_rdm_integration/function_templates/function_export_data_template/functions.py-tpl +5 -7
- edu_rdm_integration/function_templates/function_export_data_template/helpers.py-tpl +2 -6
- edu_rdm_integration/function_templates/function_export_data_template/managers.py-tpl +3 -6
- edu_rdm_integration/function_templates/function_export_data_template/runners.py-tpl +5 -7
- edu_rdm_integration/helpers.py +8 -11
- edu_rdm_integration/management/commands/async_fix_attachment_size.py +3 -7
- edu_rdm_integration/management/commands/check_upload_status.py +4 -4
- edu_rdm_integration/mapping.py +2 -7
- edu_rdm_integration/migrations/0013_set_attachment_size.py +4 -3
- edu_rdm_integration/models.py +3 -5
- edu_rdm_integration/redis_cache.py +1 -2
- edu_rdm_integration/registry/ui.py +5 -3
- edu_rdm_integration/storages.py +9 -15
- edu_rdm_integration/tasks.py +4 -6
- edu_rdm_integration/typing.py +1 -1
- edu_rdm_integration/uploader_log/actions.py +1 -1
- edu_rdm_integration/utils.py +6 -14
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/METADATA +19 -6
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/RECORD +67 -67
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/LICENSE +0 -0
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/WHEEL +0 -0
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/namespace_packages.txt +0 -0
- {edu_rdm_integration-3.4.9.dist-info → edu_rdm_integration-3.5.0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from function_tools.functions import (
|
9
6
|
BaseFunction,
|
@@ -34,19 +31,19 @@ class WebEduLazySavingPredefinedQueueFunction(LazySavingPredefinedQueueFunction,
|
|
34
31
|
моделей с предустановленной очередью продуктов Образования.
|
35
32
|
"""
|
36
33
|
|
37
|
-
def _prepare_helper_class(self) ->
|
34
|
+
def _prepare_helper_class(self) -> type[WebEduFunctionHelper]:
|
38
35
|
"""
|
39
36
|
Возвращает класс помощника функции.
|
40
37
|
"""
|
41
38
|
return WebEduFunctionHelper
|
42
39
|
|
43
|
-
def _prepare_validator_class(self) ->
|
40
|
+
def _prepare_validator_class(self) -> type[WebEduFunctionValidator]:
|
44
41
|
"""
|
45
42
|
Возвращает класс валидатора функции.
|
46
43
|
"""
|
47
44
|
return WebEduFunctionValidator
|
48
45
|
|
49
|
-
def _prepare_result_class(self) ->
|
46
|
+
def _prepare_result_class(self) -> type[WebEduFunctionResult]:
|
50
47
|
"""
|
51
48
|
Возвращает класс результата функции.
|
52
49
|
"""
|
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from function_tools.helpers import (
|
9
6
|
BaseFunctionHelper,
|
@@ -21,7 +18,7 @@ class WebEduRunnerHelper(BaseRunnerHelper, metaclass=ABCMeta):
|
|
21
18
|
Базовый класс помощников ранеров функций продуктов Образования.
|
22
19
|
"""
|
23
20
|
|
24
|
-
def _prepare_cache_class(self) ->
|
21
|
+
def _prepare_cache_class(self) -> type[WebEduRunnerCacheStorage]:
|
25
22
|
"""
|
26
23
|
Возвращает класс кеша помощника ранера.
|
27
24
|
"""
|
@@ -33,7 +30,7 @@ class WebEduFunctionHelper(BaseFunctionHelper, metaclass=ABCMeta):
|
|
33
30
|
Базовый класс помощников функций продуктов Образования.
|
34
31
|
"""
|
35
32
|
|
36
|
-
def _prepare_cache_class(self) ->
|
33
|
+
def _prepare_cache_class(self) -> type[WebEduFunctionCacheStorage]:
|
37
34
|
"""
|
38
35
|
Возвращает класс кеша помощника функции.
|
39
36
|
"""
|
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from function_tools.managers import (
|
9
6
|
RunnerManager,
|
@@ -20,7 +17,7 @@ class WebEduRunnerManager(RunnerManager, metaclass=ABCMeta):
|
|
20
17
|
"""
|
21
18
|
|
22
19
|
@classmethod
|
23
|
-
def _prepare_runner_class(cls) ->
|
20
|
+
def _prepare_runner_class(cls) -> type[WebEduRunner]:
|
24
21
|
"""
|
25
22
|
Возвращает класс ранера.
|
26
23
|
"""
|
@@ -1,22 +1,15 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from educommon import (
|
9
6
|
logger,
|
10
7
|
)
|
11
|
-
|
12
8
|
from function_tools.runners import (
|
13
9
|
BaseRunner,
|
14
10
|
GlobalHelperRunner,
|
15
11
|
)
|
16
12
|
|
17
|
-
from edu_rdm_integration.consts import (
|
18
|
-
LOGS_DELIMITER,
|
19
|
-
)
|
20
13
|
from edu_rdm_integration.adapters.helpers import (
|
21
14
|
WebEduRunnerHelper,
|
22
15
|
)
|
@@ -26,6 +19,9 @@ from edu_rdm_integration.adapters.results import (
|
|
26
19
|
from edu_rdm_integration.adapters.validators import (
|
27
20
|
WebEduRunnerValidator,
|
28
21
|
)
|
22
|
+
from edu_rdm_integration.consts import (
|
23
|
+
LOGS_DELIMITER,
|
24
|
+
)
|
29
25
|
|
30
26
|
|
31
27
|
class WebEduRunner(BaseRunner, metaclass=ABCMeta):
|
@@ -33,19 +29,19 @@ class WebEduRunner(BaseRunner, metaclass=ABCMeta):
|
|
33
29
|
Базовый класс ранеров функций продуктов Образования.
|
34
30
|
"""
|
35
31
|
|
36
|
-
def _prepare_helper_class(self) ->
|
32
|
+
def _prepare_helper_class(self) -> type[WebEduRunnerHelper]:
|
37
33
|
"""
|
38
34
|
Возвращает класс помощника ранера функции.
|
39
35
|
"""
|
40
36
|
return WebEduRunnerHelper
|
41
37
|
|
42
|
-
def _prepare_validator_class(self) ->
|
38
|
+
def _prepare_validator_class(self) -> type[WebEduRunnerValidator]:
|
43
39
|
"""
|
44
40
|
Возвращает класс валидатора ранера функции.
|
45
41
|
"""
|
46
42
|
return WebEduRunnerValidator
|
47
43
|
|
48
|
-
def _prepare_result_class(self) ->
|
44
|
+
def _prepare_result_class(self) -> type[WebEduRunnerResult]:
|
49
45
|
"""
|
50
46
|
Возвращает класс результата ранера функции.
|
51
47
|
"""
|
@@ -66,19 +62,19 @@ class WebEduGlobalHelperRunner(GlobalHelperRunner, metaclass=ABCMeta):
|
|
66
62
|
глобальным помощником продуктов Образования.
|
67
63
|
"""
|
68
64
|
|
69
|
-
def _prepare_helper_class(self) ->
|
65
|
+
def _prepare_helper_class(self) -> type[WebEduRunnerHelper]:
|
70
66
|
"""
|
71
67
|
Возвращает класс помощника ранера функции.
|
72
68
|
"""
|
73
69
|
return WebEduRunnerHelper
|
74
70
|
|
75
|
-
def _prepare_validator_class(self) ->
|
71
|
+
def _prepare_validator_class(self) -> type[WebEduRunnerValidator]:
|
76
72
|
"""
|
77
73
|
Возвращает класс валидатора ранера функции.
|
78
74
|
"""
|
79
75
|
return WebEduRunnerValidator
|
80
76
|
|
81
|
-
def _prepare_result_class(self) ->
|
77
|
+
def _prepare_result_class(self) -> type[WebEduRunnerResult]:
|
82
78
|
"""
|
83
79
|
Возвращает класс результата ранера функции.
|
84
80
|
"""
|
edu_rdm_integration/apps.py
CHANGED
@@ -31,11 +31,11 @@ class EduRDMIntegrationConfig(AppConfig):
|
|
31
31
|
Инициализация клиента для взаимодействия с Региональной витриной данных.
|
32
32
|
"""
|
33
33
|
|
34
|
+
import uploader_client
|
34
35
|
from django.core.cache import (
|
35
36
|
DEFAULT_CACHE_ALIAS,
|
36
37
|
caches,
|
37
38
|
)
|
38
|
-
import uploader_client
|
39
39
|
from uploader_client.contrib.rdm.interfaces.configurations import (
|
40
40
|
RegionalDataMartUploaderConfig,
|
41
41
|
)
|
@@ -1,16 +1,14 @@
|
|
1
1
|
from typing import (
|
2
2
|
Any,
|
3
|
-
Dict,
|
4
3
|
NamedTuple,
|
5
4
|
Optional,
|
6
|
-
Set,
|
7
|
-
Tuple,
|
8
5
|
Union,
|
9
6
|
)
|
10
7
|
|
11
8
|
from django.db.models import (
|
12
9
|
Q,
|
13
10
|
)
|
11
|
+
|
14
12
|
from educommon.integration_entities.enums import (
|
15
13
|
EntityLogOperation,
|
16
14
|
)
|
@@ -20,7 +18,7 @@ class LogChange(NamedTuple):
|
|
20
18
|
"""Операция и значения измененных полей из лога."""
|
21
19
|
|
22
20
|
operation: EntityLogOperation
|
23
|
-
fields:
|
21
|
+
fields: dict[str, Any]
|
24
22
|
|
25
23
|
@property
|
26
24
|
def is_create(self) -> bool:
|
@@ -48,7 +46,7 @@ class DependencyFilter(NamedTuple):
|
|
48
46
|
Строка должна соответствовать формату app_name.Model_name.
|
49
47
|
"""
|
50
48
|
|
51
|
-
filters: Union[
|
49
|
+
filters: Union[tuple[Q, ...], dict[str, Any]]
|
52
50
|
"""
|
53
51
|
Описание полей и значений для описания фильтрации.
|
54
52
|
"""
|
@@ -57,12 +55,12 @@ class DependencyFilter(NamedTuple):
|
|
57
55
|
class IgnoreLogDependency(NamedTuple):
|
58
56
|
"""Зависимость для исключения логов из последующей обработки."""
|
59
57
|
|
60
|
-
dependency_filters:
|
58
|
+
dependency_filters: tuple[DependencyFilter, ...]
|
61
59
|
"""
|
62
60
|
Описание фильтра применяемого к зависимости.
|
63
61
|
"""
|
64
62
|
|
65
|
-
ignore_model_fields: Optional[
|
63
|
+
ignore_model_fields: Optional[dict[str, set[str]]] = None
|
66
64
|
"""
|
67
65
|
Словарь, определяющий, какие поля моделей должны быть проигнорированы при построении графа связей между моделями.
|
68
66
|
|
@@ -1,7 +1,3 @@
|
|
1
|
-
from typing import (
|
2
|
-
Tuple,
|
3
|
-
)
|
4
|
-
|
5
1
|
from edu_rdm_integration.adapters.helpers import (
|
6
2
|
WebEduFunctionHelper,
|
7
3
|
WebEduRunnerHelper,
|
@@ -23,7 +19,7 @@ class BaseCollectingDataFunctionHelper(WebEduFunctionHelper):
|
|
23
19
|
Базовый класс помощников функций сбора данных для интеграции с "Региональная витрина данных".
|
24
20
|
"""
|
25
21
|
|
26
|
-
def get_filtered_operations(self, with_deleted: bool = False) ->
|
22
|
+
def get_filtered_operations(self, with_deleted: bool = False) -> tuple[int]:
|
27
23
|
"""
|
28
24
|
Возвращает кортеж отфильтрованных операций.
|
29
25
|
"""
|
@@ -6,9 +6,6 @@ from datetime import (
|
|
6
6
|
)
|
7
7
|
from typing import (
|
8
8
|
TYPE_CHECKING,
|
9
|
-
List,
|
10
|
-
Set,
|
11
|
-
Type,
|
12
9
|
)
|
13
10
|
|
14
11
|
from django.apps import (
|
@@ -58,7 +55,7 @@ class BaseCollectingDataRunnerManager(WebEduRunnerManager, metaclass=ABCMeta):
|
|
58
55
|
self,
|
59
56
|
logs_period_started_at: datetime,
|
60
57
|
logs_period_ended_at: datetime,
|
61
|
-
logs:
|
58
|
+
logs: list[AuditLog] = None,
|
62
59
|
*args,
|
63
60
|
**kwargs,
|
64
61
|
):
|
@@ -83,8 +80,8 @@ class BaseCollectingDataRunnerManager(WebEduRunnerManager, metaclass=ABCMeta):
|
|
83
80
|
|
84
81
|
def _collect_runner_regional_data_mart_integration_entities(
|
85
82
|
self,
|
86
|
-
runner_class:
|
87
|
-
runner_regional_data_mart_integration_entities:
|
83
|
+
runner_class: type[BaseRunner],
|
84
|
+
runner_regional_data_mart_integration_entities: list[str],
|
88
85
|
):
|
89
86
|
"""
|
90
87
|
Собирает и возвращает список сущностей.
|
@@ -103,7 +100,7 @@ class BaseCollectingDataRunnerManager(WebEduRunnerManager, metaclass=ABCMeta):
|
|
103
100
|
|
104
101
|
runner_regional_data_mart_integration_entities.extend(entities)
|
105
102
|
|
106
|
-
def _get_loggable_models(self) ->
|
103
|
+
def _get_loggable_models(self) -> set['Model']:
|
107
104
|
"""
|
108
105
|
Возвращает перечень моделей по которым собираются логи.
|
109
106
|
"""
|
@@ -1,12 +1,8 @@
|
|
1
1
|
from typing import (
|
2
|
+
TYPE_CHECKING,
|
2
3
|
Any,
|
3
|
-
Dict,
|
4
4
|
Iterable,
|
5
|
-
List,
|
6
5
|
Optional,
|
7
|
-
Set,
|
8
|
-
Tuple,
|
9
|
-
TYPE_CHECKING,
|
10
6
|
Union,
|
11
7
|
)
|
12
8
|
|
@@ -43,6 +39,7 @@ from edu_rdm_integration.utils import (
|
|
43
39
|
build_related_model_graph,
|
44
40
|
)
|
45
41
|
|
42
|
+
|
46
43
|
if TYPE_CHECKING:
|
47
44
|
from edu_rdm_integration.collect_data.base.caches import (
|
48
45
|
IgnoreLogDependency,
|
@@ -128,7 +125,7 @@ class BaseIgnoreLogMixin:
|
|
128
125
|
self._dependency: Optional['IgnoreLogDependency'] = None
|
129
126
|
|
130
127
|
@staticmethod
|
131
|
-
def _add_lookup_prefix(q_filter: Q, lookup_path_args:
|
128
|
+
def _add_lookup_prefix(q_filter: Q, lookup_path_args: list[str]) -> Q:
|
132
129
|
"""Функция принимает Q-объект и добавляет префикс к каждому указанному полю."""
|
133
130
|
new_q = Q(_negated=q_filter.negated, _connector=q_filter.connector)
|
134
131
|
|
@@ -151,8 +148,8 @@ class BaseIgnoreLogMixin:
|
|
151
148
|
|
152
149
|
def _build_filter(
|
153
150
|
self,
|
154
|
-
lookup_path_args:
|
155
|
-
filter_params: Union[
|
151
|
+
lookup_path_args: list[str],
|
152
|
+
filter_params: Union[tuple[Q], dict[str, Any]],
|
156
153
|
is_valid_lookup: bool = False,
|
157
154
|
) -> Q:
|
158
155
|
"""Построение фильтра."""
|
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from edu_rdm_integration.collect_data.base.functions import (
|
9
6
|
BaseCollectingCalculatedDataFunction,
|
@@ -24,19 +21,19 @@ class BaseCollectingCalculatedExportedDataFunction(BaseCollectingCalculatedDataF
|
|
24
21
|
Базовый класс функций сбора расчетных данных для интеграции с "Региональная витрина данных".
|
25
22
|
"""
|
26
23
|
|
27
|
-
def _prepare_helper_class(self) ->
|
24
|
+
def _prepare_helper_class(self) -> type[BaseCollectingCalculatedExportedDataFunctionHelper]:
|
28
25
|
"""
|
29
26
|
Возвращает класс помощника функции.
|
30
27
|
"""
|
31
28
|
return BaseCollectingCalculatedExportedDataFunctionHelper
|
32
29
|
|
33
|
-
def _prepare_validator_class(self) ->
|
30
|
+
def _prepare_validator_class(self) -> type[BaseCollectingCalculatedExportedDataFunctionValidator]:
|
34
31
|
"""
|
35
32
|
Возвращает класс валидатора функции.
|
36
33
|
"""
|
37
34
|
return BaseCollectingCalculatedExportedDataFunctionValidator
|
38
35
|
|
39
|
-
def _prepare_result_class(self) ->
|
36
|
+
def _prepare_result_class(self) -> type[BaseCollectingCalculatedExportedDataFunctionResult]:
|
40
37
|
"""
|
41
38
|
Возвращает класс результата функции.
|
42
39
|
"""
|
@@ -1,7 +1,3 @@
|
|
1
|
-
from typing import (
|
2
|
-
Type,
|
3
|
-
)
|
4
|
-
|
5
1
|
from edu_rdm_integration.collect_data.base.helpers import (
|
6
2
|
BaseCollectingDataFunctionHelper,
|
7
3
|
BaseCollectingDataRunnerHelper,
|
@@ -17,7 +13,7 @@ class BaseCollectingCalculatedExportedDataRunnerHelper(BaseCollectingDataRunnerH
|
|
17
13
|
Базовый класс помощников ранеров функций сбора расчетных данных для интеграции с "Региональная витрина данных".
|
18
14
|
"""
|
19
15
|
|
20
|
-
def _prepare_cache_class(self) ->
|
16
|
+
def _prepare_cache_class(self) -> type[BaseCollectingCalculatedExportedDataRunnerCacheStorage]:
|
21
17
|
"""
|
22
18
|
Возвращает класс кеша помощника ранера.
|
23
19
|
"""
|
@@ -29,7 +25,7 @@ class BaseCollectingCalculatedExportedDataFunctionHelper(BaseCollectingDataFunct
|
|
29
25
|
Базовый класс помощников функций сбора расчетных данных для интеграции с "Региональная витрина данных".
|
30
26
|
"""
|
31
27
|
|
32
|
-
def _prepare_cache_class(self) ->
|
28
|
+
def _prepare_cache_class(self) -> type[BaseCollectingCalculatedExportedDataFunctionCacheStorage]:
|
33
29
|
"""
|
34
30
|
Возвращает класс кеша помощника функции.
|
35
31
|
"""
|
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from edu_rdm_integration.collect_data.base.managers import (
|
9
6
|
BaseCollectingDataRunnerManager,
|
@@ -19,7 +16,7 @@ class BaseCollectingCalculatedExportedDataRunnerManager(BaseCollectingDataRunner
|
|
19
16
|
"""
|
20
17
|
|
21
18
|
@classmethod
|
22
|
-
def _prepare_runner_class(cls) ->
|
19
|
+
def _prepare_runner_class(cls) -> type[BaseCollectingCalculatedExportedDataRunner]:
|
23
20
|
"""
|
24
21
|
Возвращает класс ранера.
|
25
22
|
"""
|
@@ -1,7 +1,3 @@
|
|
1
|
-
from typing import (
|
2
|
-
Type,
|
3
|
-
)
|
4
|
-
|
5
1
|
from edu_rdm_integration.collect_data.base.runners import (
|
6
2
|
BaseCollectingDataRunner,
|
7
3
|
)
|
@@ -21,19 +17,19 @@ class BaseCollectingCalculatedExportedDataRunner(BaseCollectingDataRunner):
|
|
21
17
|
Базовый класс ранеров функций сбора расчетных данных для интеграции с "Региональная витрина данных".
|
22
18
|
"""
|
23
19
|
|
24
|
-
def _prepare_helper_class(self) ->
|
20
|
+
def _prepare_helper_class(self) -> type[BaseCollectingCalculatedExportedDataRunnerHelper]:
|
25
21
|
"""
|
26
22
|
Возвращает класс помощника ранера функции.
|
27
23
|
"""
|
28
24
|
return BaseCollectingCalculatedExportedDataRunnerHelper
|
29
25
|
|
30
|
-
def _prepare_validator_class(self) ->
|
26
|
+
def _prepare_validator_class(self) -> type[BaseCollectingCalculatedExportedDataRunnerValidator]:
|
31
27
|
"""
|
32
28
|
Возвращает класс валидатора ранера функции.
|
33
29
|
"""
|
34
30
|
return BaseCollectingCalculatedExportedDataRunnerValidator
|
35
31
|
|
36
|
-
def _prepare_result_class(self) ->
|
32
|
+
def _prepare_result_class(self) -> type[BaseCollectingCalculatedExportedDataRunnerResult]:
|
37
33
|
"""
|
38
34
|
Возвращает класс результата ранера функции.
|
39
35
|
"""
|
@@ -1,5 +1,4 @@
|
|
1
1
|
from typing import (
|
2
|
-
List,
|
3
2
|
Optional,
|
4
3
|
)
|
5
4
|
|
@@ -71,7 +70,7 @@ class CollectingCalculatedExportedDataFunctionImplementationStrategy(
|
|
71
70
|
)
|
72
71
|
|
73
72
|
@classmethod
|
74
|
-
def _prepare_tags(cls) ->
|
73
|
+
def _prepare_tags(cls) -> list[str]:
|
75
74
|
"""
|
76
75
|
Список тегов, по которым сущность можно будет осуществлять поиск.
|
77
76
|
"""
|
@@ -6,12 +6,8 @@ from datetime import (
|
|
6
6
|
)
|
7
7
|
from typing import (
|
8
8
|
TYPE_CHECKING,
|
9
|
-
Dict,
|
10
9
|
Iterable,
|
11
|
-
List,
|
12
10
|
Optional,
|
13
|
-
Tuple,
|
14
|
-
Type,
|
15
11
|
)
|
16
12
|
|
17
13
|
from django.conf import (
|
@@ -83,7 +79,7 @@ class BaseCollectModelsData(BaseOperationData):
|
|
83
79
|
|
84
80
|
# Если модели не указаны, берется значение по умолчанию - все модели:
|
85
81
|
models = models if models else RegionalDataMartModelEnum.get_enum_data().keys()
|
86
|
-
self.models:
|
82
|
+
self.models: list[ModelEnumValue] = [
|
87
83
|
RegionalDataMartModelEnum.get_model_enum_value(model) for model in models
|
88
84
|
]
|
89
85
|
|
@@ -91,7 +87,7 @@ class BaseCollectModelsData(BaseOperationData):
|
|
91
87
|
self.logs_period_ended_at = logs_period_ended_at
|
92
88
|
|
93
89
|
# Классы менеджеров Функций, которые должны быть запущены для сбора данных моделей РВД
|
94
|
-
self._collecting_data_managers:
|
90
|
+
self._collecting_data_managers: dict[str, type[RunnerManager]] = {}
|
95
91
|
|
96
92
|
# Результаты работы Функций сбора данных моделей РВД
|
97
93
|
self._collecting_data_results = []
|
@@ -133,7 +129,7 @@ class BaseCollectModelsData(BaseOperationData):
|
|
133
129
|
|
134
130
|
logger.info('collecting models data managers finished')
|
135
131
|
|
136
|
-
def _collect_models_data(self, *args, logs: Optional[
|
132
|
+
def _collect_models_data(self, *args, logs: Optional[dict[str, list['AuditLog']]] = None, **kwargs):
|
137
133
|
"""
|
138
134
|
Запуск Функций по формированию данных моделей РВД из логов.
|
139
135
|
"""
|
@@ -207,13 +203,13 @@ class BaseCollectModelsDataByGeneratingLogs(BaseCollectModelsData):
|
|
207
203
|
"""Возвращает генератор логов."""
|
208
204
|
raise NotImplementedError
|
209
205
|
|
210
|
-
def _generate_logs(self) ->
|
206
|
+
def _generate_logs(self) -> list[tuple[dict[str, list['AuditLog']], datetime, datetime]]:
|
211
207
|
"""Генерация логов.
|
212
208
|
|
213
209
|
Осуществляет генерацию логов по уже существующим записям в базе данных. В качестве параметров указываются
|
214
210
|
начало и конец периода сбора логов. Генерация логов производится только для указанных моделей.
|
215
211
|
"""
|
216
|
-
temp_logs:
|
212
|
+
temp_logs: dict[str, list['AuditLog']] = {}
|
217
213
|
|
218
214
|
for model in self.models:
|
219
215
|
logs = self.log_generator.generate(
|
@@ -269,7 +265,7 @@ class BaseCollectLatestModelsData(BaseCollectModelsData):
|
|
269
265
|
|
270
266
|
return stage_created_or_in_progress
|
271
267
|
|
272
|
-
def _collect_models_data(self, *args, logs: Optional[
|
268
|
+
def _collect_models_data(self, *args, logs: Optional[dict[str, list['AuditLog']]] = None, **kwargs) -> None:
|
273
269
|
"""
|
274
270
|
Запуск Функций по формированию данных из логов для дальнейшей выгрузки.
|
275
271
|
"""
|
@@ -7,9 +7,7 @@ from datetime import (
|
|
7
7
|
from typing import (
|
8
8
|
TYPE_CHECKING,
|
9
9
|
Iterable,
|
10
|
-
List,
|
11
10
|
Optional,
|
12
|
-
Tuple,
|
13
11
|
)
|
14
12
|
|
15
13
|
from django.apps import (
|
@@ -61,8 +59,8 @@ class BaseEduLogGenerator:
|
|
61
59
|
model: ModelEnumValue,
|
62
60
|
logs_period_started_at: datetime = datetime.combine(date.today(), time.min),
|
63
61
|
logs_period_ended_at: datetime = datetime.combine(date.today(), time.max),
|
64
|
-
institute_ids: Optional[
|
65
|
-
) ->
|
62
|
+
institute_ids: Optional[tuple[int, ...]] = (),
|
63
|
+
) -> list['AuditLog']:
|
66
64
|
"""
|
67
65
|
Возвращает список сгенерированных экземпляров модели AuditLog.
|
68
66
|
|
@@ -101,7 +99,7 @@ class BaseFirstCollectModelsDataCommandsGenerator:
|
|
101
99
|
"""Инициализация."""
|
102
100
|
# Если модели не указаны, берется значение по умолчанию - все модели:
|
103
101
|
models = models if models else RegionalDataMartModelEnum.get_enum_data().keys()
|
104
|
-
self.regional_data_mart_models:
|
102
|
+
self.regional_data_mart_models: list[ModelEnumValue] = [
|
105
103
|
RegionalDataMartModelEnum.get_model_enum_value(model) for model in models
|
106
104
|
]
|
107
105
|
|
@@ -152,7 +150,7 @@ class BaseFirstCollectModelsDataCommandsGenerator:
|
|
152
150
|
"""
|
153
151
|
)
|
154
152
|
|
155
|
-
def generate(self) ->
|
153
|
+
def generate(self) -> list:
|
156
154
|
"""Генерирует список данных для формирования команд для сбора данных РВД."""
|
157
155
|
params_for_commands = []
|
158
156
|
|
@@ -4,9 +4,6 @@ from datetime import (
|
|
4
4
|
time,
|
5
5
|
timedelta,
|
6
6
|
)
|
7
|
-
from typing import (
|
8
|
-
Dict,
|
9
|
-
)
|
10
7
|
|
11
8
|
from django.conf import (
|
12
9
|
settings,
|
@@ -36,7 +33,7 @@ from edu_rdm_integration.models import (
|
|
36
33
|
|
37
34
|
|
38
35
|
@atomic
|
39
|
-
def set_failed_status_suspended_collecting_data_stages() ->
|
36
|
+
def set_failed_status_suspended_collecting_data_stages() -> dict[str, int]:
|
40
37
|
"""Установить статус 'Завершено с ошибками' для зависших этапов и подэтапов сбора.
|
41
38
|
|
42
39
|
Сборка считается зависшей в случае если за определенное в параметре RDM_CHECK_SUSPEND_TASK_STAGE_TIMEOUT время,
|
@@ -5,8 +5,6 @@ from collections import (
|
|
5
5
|
defaultdict,
|
6
6
|
)
|
7
7
|
from typing import (
|
8
|
-
Dict,
|
9
|
-
List,
|
10
8
|
Union,
|
11
9
|
)
|
12
10
|
|
@@ -67,7 +65,7 @@ class BaseCollectingExportedDataFunctionCacheStorage(WebEduFunctionCacheStorage)
|
|
67
65
|
# ...
|
68
66
|
# },
|
69
67
|
# }
|
70
|
-
self.logs:
|
68
|
+
self.logs: dict[str, dict[int, list[LogChange]]] = defaultdict(lambda: defaultdict(list))
|
71
69
|
|
72
70
|
@staticmethod
|
73
71
|
def _filter_log(model: str, log_change: LogChange) -> bool:
|
@@ -138,7 +136,7 @@ class BaseCollectingExportedDataFunctionCacheStorage(WebEduFunctionCacheStorage)
|
|
138
136
|
self.logs[model][log.object_id].append(log_change)
|
139
137
|
|
140
138
|
@staticmethod
|
141
|
-
def _merge_logs(log_changes:
|
139
|
+
def _merge_logs(log_changes: list[LogChange], log_change: LogChange):
|
142
140
|
"""
|
143
141
|
Производит объединение (накопление) изменений полей в рамках одного объекта.
|
144
142
|
"""
|
@@ -1,9 +1,6 @@
|
|
1
1
|
from abc import (
|
2
2
|
ABCMeta,
|
3
3
|
)
|
4
|
-
from typing import (
|
5
|
-
Type,
|
6
|
-
)
|
7
4
|
|
8
5
|
from edu_rdm_integration.collect_data.base.functions import (
|
9
6
|
BaseCollectingCalculatedDataFunction,
|
@@ -24,19 +21,19 @@ class BaseCollectingExportedDataFunction(BaseCollectingCalculatedDataFunction, m
|
|
24
21
|
Базовый класс функций сбора данных для интеграции с "Региональная витрина данных".
|
25
22
|
"""
|
26
23
|
|
27
|
-
def _prepare_helper_class(self) ->
|
24
|
+
def _prepare_helper_class(self) -> type[BaseCollectingExportedDataFunctionHelper]:
|
28
25
|
"""
|
29
26
|
Возвращает класс помощника функции.
|
30
27
|
"""
|
31
28
|
return BaseCollectingExportedDataFunctionHelper
|
32
29
|
|
33
|
-
def _prepare_validator_class(self) ->
|
30
|
+
def _prepare_validator_class(self) -> type[BaseCollectingExportedDataFunctionValidator]:
|
34
31
|
"""
|
35
32
|
Возвращает класс валидатора функции.
|
36
33
|
"""
|
37
34
|
return BaseCollectingExportedDataFunctionValidator
|
38
35
|
|
39
|
-
def _prepare_result_class(self) ->
|
36
|
+
def _prepare_result_class(self) -> type[BaseCollectingExportedDataFunctionResult]:
|
40
37
|
"""
|
41
38
|
Возвращает класс результата функции.
|
42
39
|
"""
|
@@ -1,7 +1,3 @@
|
|
1
|
-
from typing import (
|
2
|
-
Type,
|
3
|
-
)
|
4
|
-
|
5
1
|
from edu_rdm_integration.collect_data.base.helpers import (
|
6
2
|
BaseCollectingDataFunctionHelper,
|
7
3
|
BaseCollectingDataRunnerHelper,
|
@@ -17,7 +13,7 @@ class BaseCollectingExportedDataRunnerHelper(BaseCollectingDataRunnerHelper):
|
|
17
13
|
Базовый класс помощников ранеров функций сбора данных для интеграции с "Региональная витрина данных".
|
18
14
|
"""
|
19
15
|
|
20
|
-
def _prepare_cache_class(self) ->
|
16
|
+
def _prepare_cache_class(self) -> type[BaseCollectingExportedDataRunnerCacheStorage]:
|
21
17
|
"""
|
22
18
|
Возвращает класс кеша помощника ранера.
|
23
19
|
"""
|
@@ -29,7 +25,7 @@ class BaseCollectingExportedDataFunctionHelper(BaseCollectingDataFunctionHelper)
|
|
29
25
|
Базовый класс помощников функций сбора данных для интеграции с "Региональная витрина данных".
|
30
26
|
"""
|
31
27
|
|
32
|
-
def _prepare_cache_class(self) ->
|
28
|
+
def _prepare_cache_class(self) -> type[BaseCollectingExportedDataFunctionCacheStorage]:
|
33
29
|
"""
|
34
30
|
Возвращает класс кеша помощника функции.
|
35
31
|
"""
|