edu-rdm-integration 3.18.2__py3-none-any.whl → 3.18.4__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 edu-rdm-integration might be problematic. Click here for more details.

@@ -11,9 +11,6 @@ from typing import (
11
11
  Union,
12
12
  )
13
13
 
14
- from _operator import (
15
- attrgetter,
16
- )
17
14
  from django.conf import (
18
15
  settings,
19
16
  )
@@ -58,7 +55,6 @@ def register_classes(classes: Iterable[type[BaseEnumRegisterMixin]]) -> None:
58
55
  Args:
59
56
  classes: Классы, поддерживающие интерфейс регистрации.
60
57
  """
61
-
62
58
  for enum_class in classes:
63
59
  enum_class.register()
64
60
 
@@ -2,6 +2,9 @@ from django.core.management import (
2
2
  BaseCommand,
3
3
  )
4
4
 
5
+ from edu_rdm_integration.rdm_models.models import (
6
+ RDMModelEnum,
7
+ )
5
8
  from edu_rdm_integration.stages.service.model_outdated_data.managers import (
6
9
  ModelOutdatedDataCleanerManager,
7
10
  )
@@ -14,7 +17,42 @@ class Command(BaseCommand):
14
17
 
15
18
  help = 'Ночная команда для очистки устаревших данных РВД.'
16
19
 
20
+ def add_arguments(self, parser):
21
+ """Добавляет аргументы командной строки."""
22
+ models = ', '.join(f'{key} - {value.title}' for key, value in RDMModelEnum.get_enum_data().items())
23
+ models_help_text = (
24
+ f'Значением параметра является перечисление моделей РВД, для которых должна быть произведена зачистка '
25
+ f'устаревших данных. '
26
+ f'Перечисление моделей:\n{models}. Если модели не указываются, то зачистка устаревших данных будет '
27
+ f'производиться для всех моделей. Модели перечисляются через запятую без пробелов.'
28
+ )
29
+ parser.add_argument(
30
+ '--models',
31
+ action='store',
32
+ dest='models',
33
+ type=lambda ml: [m.strip().upper() for m in ml.strip().split(',')] if ml else None,
34
+ help=models_help_text,
35
+ )
36
+
37
+ parser.add_argument(
38
+ '--safe',
39
+ action='store_true',
40
+ dest='safe',
41
+ default=False,
42
+ help='Запускать команду в безопасном режиме (без удаления данных, только логирование).',
43
+ )
44
+
45
+ parser.add_argument(
46
+ '--log-sql',
47
+ action='store_true',
48
+ dest='log_sql',
49
+ default=False,
50
+ help='Включить логирование SQL-запросов, выполняемых во время работы команды.',
51
+ )
52
+
17
53
  def handle(self, *args, **options):
18
54
  """Запуск очистки устаревших данных РВД."""
19
- model_data_cleaner_manager = ModelOutdatedDataCleanerManager()
55
+ model_data_cleaner_manager = ModelOutdatedDataCleanerManager(
56
+ models=options['models'], safe=options['safe'], log_sql=options['log_sql']
57
+ )
20
58
  model_data_cleaner_manager.run()
@@ -16,8 +16,17 @@ if TYPE_CHECKING:
16
16
  class BaseModelOutdatedDataCleaner(metaclass=ABCMeta):
17
17
  """Базовый класс уборщика устаревших данных моделей РВД."""
18
18
 
19
- def __init__(self, model_enum_value: 'ModelEnumValue', *args, **kwargs):
19
+ def __init__(
20
+ self,
21
+ model_enum_value: 'ModelEnumValue',
22
+ *args,
23
+ safe: bool = False,
24
+ log_sql: bool = False,
25
+ **kwargs,
26
+ ):
20
27
  self._model_enum_value = model_enum_value
28
+ self._safe = safe
29
+ self._log_sql = log_sql
21
30
 
22
31
  super().__init__(*args, **kwargs)
23
32
 
@@ -1,6 +1,7 @@
1
1
  import importlib
2
2
  from typing import (
3
3
  TYPE_CHECKING,
4
+ Optional,
4
5
  )
5
6
 
6
7
  from edu_rdm_integration.rdm_models.models import (
@@ -22,6 +23,20 @@ class ModelOutdatedDataCleanerManager:
22
23
  метод run.
23
24
  """
24
25
 
26
+ def __init__(
27
+ self,
28
+ *args,
29
+ models: Optional[list[str]] = None,
30
+ safe: bool = False,
31
+ log_sql: bool = False,
32
+ **kwargs,
33
+ ):
34
+ self._models = models
35
+ self._safe = safe
36
+ self._log_sql = log_sql
37
+
38
+ super().__init__(*args, **kwargs)
39
+
25
40
  def _process_model(self, model_enum_value: 'ModelEnumValue'):
26
41
  """Обрабатывает модель РВД."""
27
42
  if not hasattr(model_enum_value, 'outdated_data_cleaners'):
@@ -33,11 +48,14 @@ class ModelOutdatedDataCleanerManager:
33
48
  outdated_data_cleaner_module = importlib.import_module(outdated_data_cleaner_module_path)
34
49
  outdated_data_cleaner = getattr(outdated_data_cleaner_module, cleaner_name)
35
50
 
36
- outdated_data_cleaner(model_enum_value=model_enum_value).run()
51
+ outdated_data_cleaner(model_enum_value=model_enum_value, safe=self._safe, log_sql=self._log_sql).run()
37
52
 
38
53
  def _process_models(self):
39
54
  """Обрабатывает все модели РВД."""
40
55
  for model_enum_value in RDMModelEnum.get_model_enum_values():
56
+ if self._models is not None and model_enum_value.key not in self._models:
57
+ continue
58
+
41
59
  self._process_model(model_enum_value=model_enum_value)
42
60
 
43
61
  def run(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: edu-rdm-integration
3
- Version: 3.18.2
3
+ Version: 3.18.4
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
@@ -18,7 +18,7 @@ edu_rdm_integration/core/redis_cache.py,sha256=R9_C1H8XbCHxZUoPbr7lfepI7Ic7td_NQ
18
18
  edu_rdm_integration/core/signals.py,sha256=3eRlpkDcFCF6TN80-QM8yBYLcyozzcmoPjz6r4_ApWg,73
19
19
  edu_rdm_integration/core/storages.py,sha256=9nlRfHe4DJMNVgr0N4DGIEnsYLsEGDEO9KFvNac-B_E,6635
20
20
  edu_rdm_integration/core/typing.py,sha256=2asD8biX0l_DVqJSU4y19-zzEBJMk967PUj3UhzICzs,785
21
- edu_rdm_integration/core/utils.py,sha256=MaZ-78hR_dlvm6_r2uoYY4Jvv8adMfGz9dIk3QMlPDA,9856
21
+ edu_rdm_integration/core/utils.py,sha256=KAqzToW3fwnWuPAmJplWZwDkBxqjOkjaNsGZnti5gB8,9813
22
22
  edu_rdm_integration/core/registry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  edu_rdm_integration/core/registry/actions.py,sha256=DF5x1OjuVnfFFuPfK1HVIbDdhVArmlSv0-inqf-Gl6s,3886
24
24
  edu_rdm_integration/core/registry/apps.py,sha256=ioBzfLzvKb36KmuVVCHbg9wxM6PHy4ZnxxbLm2Da_yI,378
@@ -48,7 +48,7 @@ edu_rdm_integration/pipelines/cleanup_outdated_data/__init__.py,sha256=47DEQpj8H
48
48
  edu_rdm_integration/pipelines/cleanup_outdated_data/apps.py,sha256=tyTlr1Wt574eby2vIV68FMm7SPFSZKYw6zNkD8x6COE,507
49
49
  edu_rdm_integration/pipelines/cleanup_outdated_data/management/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
50
  edu_rdm_integration/pipelines/cleanup_outdated_data/management/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
- edu_rdm_integration/pipelines/cleanup_outdated_data/management/commands/rdm_cleanup_outdated_data.py,sha256=Mhas_dqs3NPpCKyRxdGFkQCrsic8_48fRDFhVAmq2MU,676
51
+ edu_rdm_integration/pipelines/cleanup_outdated_data/management/commands/rdm_cleanup_outdated_data.py,sha256=7sdBe-if4Nz66saTFN8Q35cEVpHse3vQvokas8MQi44,2586
52
52
  edu_rdm_integration/pipelines/transfer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
53
  edu_rdm_integration/pipelines/transfer/actions.py,sha256=e94NVtTcFIqBBTZ9vbSfh_0oXUWK9ZOx2pDYnIePJVc,5920
54
54
  edu_rdm_integration/pipelines/transfer/app_meta.py,sha256=jshfepDDJrbCACtJBJBPuidAVJ6rcziQiet27wqOIjk,373
@@ -220,9 +220,9 @@ edu_rdm_integration/stages/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
220
220
  edu_rdm_integration/stages/service/apps.py,sha256=lgCG4_kpwgfDWh6y-GNuUwz5SOjkP7oS8kkUyVUcNRg,648
221
221
  edu_rdm_integration/stages/service/tasks.py,sha256=PPCtT6EpLkAKRczY0KIT6GeE9eBkv60fl2W6KFvCRqc,2302
222
222
  edu_rdm_integration/stages/service/model_outdated_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
- edu_rdm_integration/stages/service/model_outdated_data/cleaners.py,sha256=gk5_wUNVJwr3D6k5fJDzbSGEhWUXqk9yT6xPK7OP1hw,637
224
- edu_rdm_integration/stages/service/model_outdated_data/managers.py,sha256=U2rBg-t-X9YfapP4xRRfKiou7sX0V10WxrPHyeCQ-oI,1880
225
- edu_rdm_integration/stages/service/outdated_service_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
223
+ edu_rdm_integration/stages/service/model_outdated_data/cleaners.py,sha256=D4NX5BryzlOORfFRHUElRAsHVLObppPUq4DPGCKTmtw,793
224
+ edu_rdm_integration/stages/service/model_outdated_data/managers.py,sha256=0LNjvycTtSMGsN37U-otlPL_vlYJKZXtNXxwkseK1wA,2353
225
+ edu_rdm_integration/stages/service/service_outdated_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
226
226
  edu_rdm_integration/stages/upload_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
227
227
  edu_rdm_integration/stages/upload_data/apps.py,sha256=aFhVPK-65b35CGKoAeAgQ0mm3STaWtZg7rqk3eL-b7s,620
228
228
  edu_rdm_integration/stages/upload_data/consts.py,sha256=yTygXxS5dBRCvrE7Q3D0jEGSC5apIKvVAAViDM8QcKA,223
@@ -254,8 +254,8 @@ edu_rdm_integration/stages/upload_data/uploader_log/ui.py,sha256=mU3XA9zVKHGqzNk
254
254
  edu_rdm_integration/stages/upload_data/uploader_log/migrations/0001_initial.py,sha256=r5oOB7DBK9-mfuqPAgjXUJY5-hEcmMdILCwDTpaLnBc,753
255
255
  edu_rdm_integration/stages/upload_data/uploader_log/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
256
256
  edu_rdm_integration/stages/upload_data/uploader_log/templates/ui-js/object-grid-buttons.js,sha256=2xyGe0wdVokM0RhpzRzcRvJPBkBmPe3SlZry4oP4Nzs,6201
257
- edu_rdm_integration-3.18.2.dist-info/licenses/LICENSE,sha256=uw43Gjjj-1vXWCItfSrNDpbejnOwZMrNerUh8oWbq8Q,3458
258
- edu_rdm_integration-3.18.2.dist-info/METADATA,sha256=zd1jKvBCnNe9yQII04MTYP7vkbcpmHsnH-3TIz1xMdY,39873
259
- edu_rdm_integration-3.18.2.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
260
- edu_rdm_integration-3.18.2.dist-info/top_level.txt,sha256=nRJV0O14UtNE-jGIYG03sohgFnZClvf57H5m6VBXe9Y,20
261
- edu_rdm_integration-3.18.2.dist-info/RECORD,,
257
+ edu_rdm_integration-3.18.4.dist-info/licenses/LICENSE,sha256=uw43Gjjj-1vXWCItfSrNDpbejnOwZMrNerUh8oWbq8Q,3458
258
+ edu_rdm_integration-3.18.4.dist-info/METADATA,sha256=UkQWafoZO26RSQc_CZ61h-QOT5oywXhbDyPJ-kB06nM,39873
259
+ edu_rdm_integration-3.18.4.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
260
+ edu_rdm_integration-3.18.4.dist-info/top_level.txt,sha256=nRJV0O14UtNE-jGIYG03sohgFnZClvf57H5m6VBXe9Y,20
261
+ edu_rdm_integration-3.18.4.dist-info/RECORD,,