edu-rdm-integration 3.9.2__py3-none-any.whl → 3.10.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/__init__.py +0 -1
- edu_rdm_integration/adapters/apps.py +15 -2
- edu_rdm_integration/adapters/caches.py +25 -12
- edu_rdm_integration/adapters/errors.py +13 -2
- edu_rdm_integration/adapters/functions.py +53 -14
- edu_rdm_integration/adapters/helpers.py +34 -8
- edu_rdm_integration/adapters/managers.py +41 -5
- edu_rdm_integration/adapters/presenters.py +26 -2
- edu_rdm_integration/adapters/receivers.py +16 -2
- edu_rdm_integration/adapters/results.py +50 -4
- edu_rdm_integration/adapters/runners.py +79 -20
- edu_rdm_integration/adapters/strategies.py +56 -54
- edu_rdm_integration/adapters/validators.py +43 -4
- edu_rdm_integration/apps.py +3 -23
- edu_rdm_integration/collect_and_export_data/__init__.py +1 -1
- edu_rdm_integration/collect_and_export_data/apps.py +1 -0
- edu_rdm_integration/collect_and_export_data/migrations/0001_initial.py +107 -17
- edu_rdm_integration/collect_and_export_data/migrations/0002_auto_20250204_1413.py +4 -2
- edu_rdm_integration/{consts.py → core/consts.py} +0 -11
- edu_rdm_integration/{enums.py → core/enums.py} +7 -54
- edu_rdm_integration/core/helpers.py +331 -0
- edu_rdm_integration/core/operations.py +71 -0
- edu_rdm_integration/core/redis_cache.py +20 -0
- edu_rdm_integration/{collect_and_export_data → core/registry}/actions.py +6 -12
- edu_rdm_integration/core/registry/apps.py +11 -0
- edu_rdm_integration/{collect_and_export_data → core/registry}/ui.py +1 -1
- edu_rdm_integration/{storages.py → core/storages.py} +8 -17
- edu_rdm_integration/{utils.py → core/utils.py} +29 -91
- edu_rdm_integration/migrations/0001_initial.py +294 -44
- edu_rdm_integration/migrations/0002_init_data_uploadstatus.py +1 -3
- edu_rdm_integration/migrations/0003_create_index_file_upload_status.py +0 -1
- edu_rdm_integration/migrations/0004_uploaderclientlog.py +1 -2
- edu_rdm_integration/migrations/0005_auto_20231204_1224.py +16 -4
- edu_rdm_integration/migrations/0006_request_status_data.py +60 -58
- edu_rdm_integration/migrations/0007_delete_upload_status.py +0 -1
- edu_rdm_integration/migrations/0009_auto_20240522_1619.py +1 -5
- edu_rdm_integration/migrations/0010_transferredentity_export_enabled.py +0 -1
- edu_rdm_integration/migrations/0011_exportingdatasubstageentity.py +16 -3
- edu_rdm_integration/migrations/0012_exportingdatasubstageattachment_attachment_size.py +0 -1
- edu_rdm_integration/migrations/0013_set_attachment_size.py +8 -12
- edu_rdm_integration/migrations/0014_uploaddatacommand.py +33 -6
- edu_rdm_integration/migrations/0015_set_exporting_sub_stage_status.py +1 -5
- edu_rdm_integration/migrations/0016_transferredentity_queue_level.py +2 -2
- edu_rdm_integration/migrations/0017_delete_uploaddatacommand.py +3 -2
- edu_rdm_integration/migrations/__init__.py +1 -0
- edu_rdm_integration/{registry → pipelines/transfer}/actions.py +13 -26
- edu_rdm_integration/pipelines/transfer/app_meta.py +18 -0
- edu_rdm_integration/pipelines/transfer/apps.py +19 -0
- edu_rdm_integration/pipelines/transfer/enums.py +34 -0
- edu_rdm_integration/pipelines/transfer/migrations/0001_initial.py +57 -0
- edu_rdm_integration/{base.py → pipelines/transfer/mixins.py} +29 -53
- edu_rdm_integration/pipelines/transfer/models.py +48 -0
- edu_rdm_integration/{tasks.py → pipelines/transfer/tasks.py} +51 -150
- edu_rdm_integration/{registry → pipelines/transfer}/ui.py +4 -10
- edu_rdm_integration/rdm_entities/apps.py +11 -0
- edu_rdm_integration/{entities.py → rdm_entities/entities.py} +67 -57
- edu_rdm_integration/rdm_entities/migrations/0001_initial.py +44 -0
- edu_rdm_integration/{enum_register → rdm_entities}/mixins.py +8 -59
- edu_rdm_integration/rdm_entities/models.py +63 -0
- edu_rdm_integration/rdm_entities/utils.py +33 -0
- edu_rdm_integration/rdm_models/apps.py +16 -0
- edu_rdm_integration/rdm_models/migrations/0001_initial.py +40 -0
- edu_rdm_integration/rdm_models/mixins.py +67 -0
- edu_rdm_integration/rdm_models/models.py +73 -0
- edu_rdm_integration/rdm_models/utils.py +23 -0
- edu_rdm_integration/stages/collect_data/apps.py +11 -0
- edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/functions.py-tpl +2 -2
- edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/managers.py-tpl +1 -1
- edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/runners.py-tpl +1 -1
- edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/tests.py-tpl +2 -1
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/caches.py +2 -2
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/functions.py +15 -18
- edu_rdm_integration/stages/collect_data/functions/base/helpers.py +20 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/managers.py +20 -27
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/mixins.py +38 -55
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/runners.py +2 -5
- edu_rdm_integration/stages/collect_data/functions/calculated/base/__init__.py +0 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/caches.py +3 -7
- edu_rdm_integration/stages/collect_data/functions/calculated/base/errors.py +7 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/functions.py +8 -16
- edu_rdm_integration/stages/collect_data/functions/calculated/base/helpers.py +24 -0
- edu_rdm_integration/stages/collect_data/functions/calculated/base/managers.py +19 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/presenters.py +1 -3
- edu_rdm_integration/stages/collect_data/functions/calculated/base/results.py +12 -0
- edu_rdm_integration/stages/collect_data/functions/calculated/base/runners.py +28 -0
- edu_rdm_integration/stages/collect_data/functions/calculated/base/validators.py +20 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/strategies.py +32 -70
- edu_rdm_integration/stages/collect_data/functions/non_calculated/__init__.py +0 -0
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/__init__.py +0 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/caches.py +13 -22
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/errors.py +7 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/functions.py +8 -16
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/helpers.py +24 -0
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/managers.py +19 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/presenters.py +1 -3
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/results.py +12 -0
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/runners.py +28 -0
- edu_rdm_integration/stages/collect_data/functions/non_calculated/base/validators.py +20 -0
- edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/strategies.py +32 -70
- edu_rdm_integration/{collect_data → stages/collect_data}/generators.py +9 -14
- edu_rdm_integration/stages/collect_data/helpers.py +154 -0
- edu_rdm_integration/stages/collect_data/management/__init__.py +0 -0
- edu_rdm_integration/stages/collect_data/management/base.py +100 -0
- edu_rdm_integration/stages/collect_data/management/commands/__init__.py +0 -0
- edu_rdm_integration/{management → stages/collect_data/management}/commands/collect_latest_models_data.py +5 -7
- edu_rdm_integration/{management → stages/collect_data/management}/commands/collect_models_data.py +5 -7
- edu_rdm_integration/stages/collect_data/migrations/0001_initial.py +187 -0
- edu_rdm_integration/stages/collect_data/migrations/0002_edurdmcollectdatacommandprogress.py +105 -0
- edu_rdm_integration/stages/collect_data/migrations/__init__.py +0 -0
- edu_rdm_integration/stages/collect_data/mixins.py +56 -0
- edu_rdm_integration/stages/collect_data/models.py +318 -0
- edu_rdm_integration/{collect_data/collect.py → stages/collect_data/operations.py} +30 -43
- edu_rdm_integration/stages/collect_data/registry/__init__.py +0 -0
- edu_rdm_integration/{collect_data → stages/collect_data/registry}/actions.py +17 -20
- edu_rdm_integration/stages/collect_data/registry/apps.py +11 -0
- edu_rdm_integration/{collect_data → stages/collect_data/registry}/ui.py +8 -15
- edu_rdm_integration/{collect_data → stages/collect_data}/tests.py +2 -2
- edu_rdm_integration/stages/export_data/__init__.py +0 -0
- edu_rdm_integration/stages/export_data/apps.py +11 -0
- edu_rdm_integration/stages/export_data/function_templates/__init__.py +0 -0
- edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/functions.py-tpl +2 -2
- edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/managers.py-tpl +2 -2
- edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/runners.py-tpl +2 -2
- edu_rdm_integration/stages/export_data/functions/__init__.py +0 -0
- edu_rdm_integration/stages/export_data/functions/base/__init__.py +0 -0
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/caches.py +3 -8
- edu_rdm_integration/stages/export_data/functions/base/errors.py +7 -0
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/functions.py +28 -59
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/helpers.py +7 -17
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/managers.py +19 -28
- edu_rdm_integration/stages/export_data/functions/base/presenters.py +11 -0
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/requests.py +13 -40
- edu_rdm_integration/stages/export_data/functions/base/results.py +12 -0
- edu_rdm_integration/{export_data → stages/export_data/functions}/base/runners.py +9 -21
- edu_rdm_integration/stages/export_data/functions/base/validators.py +20 -0
- edu_rdm_integration/{export_data → stages/export_data}/generators.py +7 -6
- edu_rdm_integration/stages/export_data/helpers.py +203 -0
- edu_rdm_integration/stages/export_data/management/__init__.py +0 -0
- edu_rdm_integration/stages/export_data/management/base.py +101 -0
- edu_rdm_integration/stages/export_data/management/commands/__init__.py +0 -0
- edu_rdm_integration/{management → stages/export_data/management}/commands/export_entities_data.py +5 -7
- edu_rdm_integration/{management → stages/export_data/management}/commands/export_latest_entities_data.py +5 -7
- edu_rdm_integration/stages/export_data/migrations/0001_initial.py +324 -0
- edu_rdm_integration/stages/export_data/migrations/__init__.py +0 -0
- edu_rdm_integration/stages/export_data/mixins.py +50 -0
- edu_rdm_integration/stages/export_data/models.py +362 -0
- edu_rdm_integration/{export_data/export.py → stages/export_data/operations.py} +13 -152
- edu_rdm_integration/stages/export_data/registry/__init__.py +0 -0
- edu_rdm_integration/{export_data → stages/export_data/registry}/actions.py +18 -18
- edu_rdm_integration/stages/export_data/registry/apps.py +11 -0
- edu_rdm_integration/{export_data → stages/export_data/registry}/ui.py +5 -7
- edu_rdm_integration/{export_data → stages/export_data}/strategies.py +30 -68
- edu_rdm_integration/stages/service/__init__.py +0 -0
- edu_rdm_integration/stages/service/apps.py +19 -0
- edu_rdm_integration/stages/service/tasks.py +63 -0
- edu_rdm_integration/stages/upload_data/__init__.py +0 -0
- edu_rdm_integration/stages/upload_data/apps.py +19 -0
- edu_rdm_integration/stages/upload_data/consts.py +10 -0
- edu_rdm_integration/{export_data → stages/upload_data}/dataclasses.py +1 -0
- edu_rdm_integration/stages/upload_data/enums.py +17 -0
- edu_rdm_integration/{export_data/export_manager.py → stages/upload_data/export_managers.py} +73 -68
- edu_rdm_integration/stages/upload_data/helpers.py +164 -0
- edu_rdm_integration/stages/upload_data/management/__init__.py +0 -0
- edu_rdm_integration/stages/upload_data/management/base.py +134 -0
- edu_rdm_integration/stages/upload_data/management/commands/__init__.py +0 -0
- edu_rdm_integration/{management → stages/upload_data/management}/commands/async_fix_attachment_size.py +32 -54
- edu_rdm_integration/{management → stages/upload_data/management}/commands/check_upload_status.py +7 -6
- edu_rdm_integration/{management → stages/upload_data/management}/commands/datamart_status.py +3 -3
- edu_rdm_integration/{management → stages/upload_data/management}/commands/datamart_upload.py +4 -4
- edu_rdm_integration/stages/upload_data/migrations/0001_initial.py +161 -0
- edu_rdm_integration/stages/upload_data/migrations/__init__.py +0 -0
- edu_rdm_integration/stages/upload_data/models.py +175 -0
- edu_rdm_integration/stages/upload_data/operations.py +156 -0
- edu_rdm_integration/{export_data/queue.py → stages/upload_data/queues.py} +10 -8
- edu_rdm_integration/stages/upload_data/tasks.py +103 -0
- edu_rdm_integration/stages/upload_data/uploader_log/__init__.py +0 -0
- edu_rdm_integration/{uploader_log → stages/upload_data/uploader_log}/actions.py +14 -16
- edu_rdm_integration/stages/upload_data/uploader_log/apps.py +11 -0
- edu_rdm_integration/{uploader_log → stages/upload_data/uploader_log}/managers.py +15 -30
- edu_rdm_integration/stages/upload_data/uploader_log/migrations/0001_initial.py +31 -0
- edu_rdm_integration/stages/upload_data/uploader_log/migrations/__init__.py +0 -0
- edu_rdm_integration/stages/upload_data/uploader_log/models.py +86 -0
- edu_rdm_integration/{uploader_log → stages/upload_data/uploader_log}/ui.py +8 -6
- {edu_rdm_integration-3.9.2.dist-info → edu_rdm_integration-3.10.0.dist-info}/METADATA +238 -238
- edu_rdm_integration-3.10.0.dist-info/RECORD +255 -0
- edu_rdm_integration/app_meta.py +0 -16
- edu_rdm_integration/app_settings.py +0 -77
- edu_rdm_integration/collect_and_export_data/models.py +0 -67
- edu_rdm_integration/collect_and_export_data/utils.py +0 -224
- edu_rdm_integration/collect_data/base/helpers.py +0 -26
- edu_rdm_integration/collect_data/calculated/base/errors.py +0 -9
- edu_rdm_integration/collect_data/calculated/base/helpers.py +0 -32
- edu_rdm_integration/collect_data/calculated/base/managers.py +0 -23
- edu_rdm_integration/collect_data/calculated/base/results.py +0 -16
- edu_rdm_integration/collect_data/calculated/base/runners.py +0 -36
- edu_rdm_integration/collect_data/calculated/base/validators.py +0 -28
- edu_rdm_integration/collect_data/helpers.py +0 -92
- edu_rdm_integration/collect_data/non_calculated/base/errors.py +0 -9
- edu_rdm_integration/collect_data/non_calculated/base/helpers.py +0 -32
- edu_rdm_integration/collect_data/non_calculated/base/managers.py +0 -23
- edu_rdm_integration/collect_data/non_calculated/base/results.py +0 -16
- edu_rdm_integration/collect_data/non_calculated/base/runners.py +0 -36
- edu_rdm_integration/collect_data/non_calculated/base/validators.py +0 -28
- edu_rdm_integration/enum_register/register.py +0 -79
- edu_rdm_integration/export_data/base/errors.py +0 -9
- edu_rdm_integration/export_data/base/presenters.py +0 -13
- edu_rdm_integration/export_data/base/results.py +0 -16
- edu_rdm_integration/export_data/base/validators.py +0 -28
- edu_rdm_integration/export_data/helpers.py +0 -92
- edu_rdm_integration/helpers.py +0 -412
- edu_rdm_integration/management/general.py +0 -327
- edu_rdm_integration/models.py +0 -982
- edu_rdm_integration/redis_cache.py +0 -51
- edu_rdm_integration/uploader_log/apps.py +0 -10
- edu_rdm_integration-3.9.2.dist-info/RECORD +0 -198
- /edu_rdm_integration/{collect_and_export_data/migrations → core}/__init__.py +0 -0
- /edu_rdm_integration/{mapping.py → core/mapping.py} +0 -0
- /edu_rdm_integration/{collect_data → core/registry}/__init__.py +0 -0
- /edu_rdm_integration/{templates → core/registry/templates}/ui-js/start-task.js +0 -0
- /edu_rdm_integration/{signals.py → core/signals.py} +0 -0
- /edu_rdm_integration/{typing.py → core/typing.py} +0 -0
- /edu_rdm_integration/{collect_data/base → pipelines}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data/calculated → pipelines/transfer}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data/calculated/base → pipelines/transfer/migrations}/__init__.py +0 -0
- /edu_rdm_integration/{templates → pipelines/transfer/templates}/ui-js/transferred-entity-list.js +0 -0
- /edu_rdm_integration/{collect_data/non_calculated → rdm_entities}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data/non_calculated/base → rdm_entities/migrations}/__init__.py +0 -0
- /edu_rdm_integration/{enum_register → rdm_models}/__init__.py +0 -0
- /edu_rdm_integration/{export_data → rdm_models/migrations}/__init__.py +0 -0
- /edu_rdm_integration/{export_data/base → stages}/__init__.py +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data/const.py → stages/collect_data/consts.py} +0 -0
- /edu_rdm_integration/{management → stages/collect_data/function_templates}/__init__.py +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/__init__.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/apps.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/caches.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/consts.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/enums.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/errors.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/helpers.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/presenters.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/results.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/strings.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/collect_data/function_templates}/function_collect_data_template/validators.py-tpl +0 -0
- /edu_rdm_integration/{management/commands → stages/collect_data/functions}/__init__.py +0 -0
- /edu_rdm_integration/{registry → stages/collect_data/functions/base}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/base/consts.py +0 -0
- /edu_rdm_integration/{uploader_log → stages/collect_data/functions/calculated}/__init__.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/consts.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/enums.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/strings.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/calculated/base/tests.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/consts.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/enums.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/strings.py +0 -0
- /edu_rdm_integration/{collect_data → stages/collect_data/functions}/non_calculated/base/tests.py +0 -0
- /edu_rdm_integration/{export_data → stages/export_data}/consts.py +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/__init__.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/apps.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/caches.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/consts.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/enums.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/errors.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/helpers.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/presenters.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/results.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/strings.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/tests.py-tpl +0 -0
- /edu_rdm_integration/{function_templates → stages/export_data/function_templates}/function_export_data_template/validators.py-tpl +0 -0
- /edu_rdm_integration/{export_data → stages/export_data/functions}/base/consts.py +0 -0
- /edu_rdm_integration/{export_data → stages/export_data/functions}/base/enums.py +0 -0
- /edu_rdm_integration/{export_data → stages/export_data/functions}/base/strings.py +0 -0
- /edu_rdm_integration/{export_data → stages/export_data/functions}/base/tests.py +0 -0
- /edu_rdm_integration/{templates → stages/export_data/registry/templates}/ui-js/stage_for_export.js +0 -0
- /edu_rdm_integration/{uploader_log → stages/upload_data/uploader_log}/enums.py +0 -0
- /edu_rdm_integration/{uploader_log → stages/upload_data/uploader_log}/templates/ui-js/object-grid-buttons.js +0 -0
- {edu_rdm_integration-3.9.2.dist-info → edu_rdm_integration-3.10.0.dist-info}/WHEEL +0 -0
- {edu_rdm_integration-3.9.2.dist-info → edu_rdm_integration-3.10.0.dist-info}/licenses/LICENSE +0 -0
- {edu_rdm_integration-3.9.2.dist-info → edu_rdm_integration-3.10.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,362 @@
|
|
1
|
+
import uuid
|
2
|
+
from datetime import (
|
3
|
+
datetime,
|
4
|
+
)
|
5
|
+
|
6
|
+
from django.db.models import (
|
7
|
+
CASCADE,
|
8
|
+
PROTECT,
|
9
|
+
SET_NULL,
|
10
|
+
DateTimeField,
|
11
|
+
FileField,
|
12
|
+
ForeignKey,
|
13
|
+
PositiveIntegerField,
|
14
|
+
PositiveSmallIntegerField,
|
15
|
+
SmallIntegerField,
|
16
|
+
UUIDField,
|
17
|
+
)
|
18
|
+
from django.utils import (
|
19
|
+
timezone,
|
20
|
+
)
|
21
|
+
from m3.db import (
|
22
|
+
BaseObjectModel,
|
23
|
+
)
|
24
|
+
|
25
|
+
from educommon.django.db.mixins import (
|
26
|
+
ReprStrPreModelMixin,
|
27
|
+
)
|
28
|
+
from educommon.integration_entities.enums import (
|
29
|
+
EntityLogOperation,
|
30
|
+
)
|
31
|
+
from function_tools.models import (
|
32
|
+
Entity,
|
33
|
+
)
|
34
|
+
from m3_db_utils.models import (
|
35
|
+
ModelEnumValue,
|
36
|
+
TitledModelEnum,
|
37
|
+
)
|
38
|
+
|
39
|
+
from edu_rdm_integration.core.enums import (
|
40
|
+
CommandType,
|
41
|
+
)
|
42
|
+
from edu_rdm_integration.core.utils import (
|
43
|
+
get_data_command_progress_attachment_path,
|
44
|
+
)
|
45
|
+
from edu_rdm_integration.rdm_entities.models import (
|
46
|
+
RegionalDataMartEntityEnum,
|
47
|
+
)
|
48
|
+
from edu_rdm_integration.stages.export_data.helpers import (
|
49
|
+
get_exporting_data_stage_attachment_path,
|
50
|
+
)
|
51
|
+
|
52
|
+
|
53
|
+
class ExportingDataStageStatus(TitledModelEnum):
|
54
|
+
"""Статус этапа выгрузки данных."""
|
55
|
+
|
56
|
+
CREATED = ModelEnumValue(
|
57
|
+
title='Создан',
|
58
|
+
)
|
59
|
+
|
60
|
+
IN_PROGRESS = ModelEnumValue(
|
61
|
+
title='В процессе',
|
62
|
+
)
|
63
|
+
|
64
|
+
FAILED = ModelEnumValue(
|
65
|
+
title='Завершено с ошибками',
|
66
|
+
)
|
67
|
+
|
68
|
+
FINISHED = ModelEnumValue(
|
69
|
+
title='Завершено',
|
70
|
+
)
|
71
|
+
|
72
|
+
class Meta:
|
73
|
+
db_table = 'rdm_exporting_data_stage_status'
|
74
|
+
verbose_name = 'Модель-перечисление статусов этапа выгрузки данных'
|
75
|
+
verbose_name_plural = 'Модели-перечисления статусов этапов выгрузки данных'
|
76
|
+
|
77
|
+
|
78
|
+
class ExportingDataStage(ReprStrPreModelMixin, BaseObjectModel):
|
79
|
+
"""Этап выгрузки данных."""
|
80
|
+
|
81
|
+
manager = ForeignKey(
|
82
|
+
to=Entity,
|
83
|
+
verbose_name='Менеджер ранера Функции',
|
84
|
+
on_delete=PROTECT,
|
85
|
+
null=True,
|
86
|
+
blank=True,
|
87
|
+
)
|
88
|
+
|
89
|
+
period_started_at = DateTimeField(
|
90
|
+
'Левая граница периода выборки данных для выгрузки',
|
91
|
+
db_index=True,
|
92
|
+
)
|
93
|
+
|
94
|
+
period_ended_at = DateTimeField(
|
95
|
+
'Правая граница периода выборки данных для выгрузки',
|
96
|
+
db_index=True,
|
97
|
+
)
|
98
|
+
|
99
|
+
started_at = DateTimeField(
|
100
|
+
'Время начала выгрузки данных',
|
101
|
+
auto_now_add=True,
|
102
|
+
)
|
103
|
+
|
104
|
+
ended_at = DateTimeField(
|
105
|
+
'Время завершения выгрузки данных',
|
106
|
+
null=True,
|
107
|
+
blank=True,
|
108
|
+
)
|
109
|
+
|
110
|
+
status = ForeignKey(
|
111
|
+
to=ExportingDataStageStatus,
|
112
|
+
verbose_name='Статус',
|
113
|
+
on_delete=PROTECT,
|
114
|
+
default=ExportingDataStageStatus.CREATED.key,
|
115
|
+
)
|
116
|
+
|
117
|
+
class Meta:
|
118
|
+
db_table = 'rdm_exporting_data_stage'
|
119
|
+
verbose_name = 'Этап формирования данных для выгрузки'
|
120
|
+
verbose_name_plural = 'Этапы формирования данных для выгрузки'
|
121
|
+
|
122
|
+
@property
|
123
|
+
def attrs_for_repr_str(self):
|
124
|
+
"""Список атрибутов для отображения экземпляра модели."""
|
125
|
+
return ['manager_id', 'started_at', 'ended_at', 'status_id']
|
126
|
+
|
127
|
+
def save(self, *args, **kwargs):
|
128
|
+
"""Сохранение этапа экспорта данных."""
|
129
|
+
if (
|
130
|
+
self.status_id in (ExportingDataStageStatus.FAILED.key, ExportingDataStageStatus.FINISHED.key)
|
131
|
+
and not self.ended_at
|
132
|
+
):
|
133
|
+
self.ended_at = datetime.now()
|
134
|
+
|
135
|
+
super().save(*args, **kwargs)
|
136
|
+
|
137
|
+
|
138
|
+
class ExportingDataSubStageStatus(TitledModelEnum):
|
139
|
+
"""Модель-перечисление статусов этапа выгрузки данных."""
|
140
|
+
|
141
|
+
CREATED = ModelEnumValue(
|
142
|
+
title='Создан',
|
143
|
+
)
|
144
|
+
|
145
|
+
IN_PROGRESS = ModelEnumValue(
|
146
|
+
title='Запущен',
|
147
|
+
)
|
148
|
+
|
149
|
+
FAILED = ModelEnumValue(
|
150
|
+
title='Завершено с ошибками',
|
151
|
+
)
|
152
|
+
|
153
|
+
FINISHED = ModelEnumValue(
|
154
|
+
title='Завершен',
|
155
|
+
)
|
156
|
+
READY_FOR_EXPORT = ModelEnumValue(
|
157
|
+
title='Готов к выгрузке',
|
158
|
+
)
|
159
|
+
PROCESS_ERROR = ModelEnumValue(title='Ошибка обработки витриной')
|
160
|
+
|
161
|
+
class Meta:
|
162
|
+
db_table = 'rdm_exporting_data_sub_stage_status'
|
163
|
+
verbose_name = 'Модель-перечисление статусов подэтапа выгрузки данных'
|
164
|
+
verbose_name_plural = 'Модели-перечисления статусов подэтапов выгрузки данных'
|
165
|
+
|
166
|
+
|
167
|
+
class ExportingDataSubStage(ReprStrPreModelMixin, BaseObjectModel):
|
168
|
+
"""Подэтап выгрузки данных."""
|
169
|
+
|
170
|
+
function = ForeignKey(
|
171
|
+
to=Entity,
|
172
|
+
verbose_name='Функция',
|
173
|
+
on_delete=PROTECT,
|
174
|
+
null=True,
|
175
|
+
blank=True,
|
176
|
+
)
|
177
|
+
|
178
|
+
stage = ForeignKey(
|
179
|
+
to=ExportingDataStage,
|
180
|
+
verbose_name='Этап выгрузки данных',
|
181
|
+
on_delete=CASCADE,
|
182
|
+
)
|
183
|
+
|
184
|
+
started_at = DateTimeField(
|
185
|
+
verbose_name='Время начала сбора данных',
|
186
|
+
auto_now_add=True,
|
187
|
+
db_index=True,
|
188
|
+
)
|
189
|
+
|
190
|
+
ended_at = DateTimeField(
|
191
|
+
verbose_name='Время завершения сбора данных',
|
192
|
+
null=True,
|
193
|
+
blank=True,
|
194
|
+
db_index=True,
|
195
|
+
)
|
196
|
+
|
197
|
+
status = ForeignKey(
|
198
|
+
to=ExportingDataSubStageStatus,
|
199
|
+
verbose_name='Статус',
|
200
|
+
on_delete=PROTECT,
|
201
|
+
default=ExportingDataSubStageStatus.CREATED.key,
|
202
|
+
)
|
203
|
+
|
204
|
+
class Meta:
|
205
|
+
db_table = 'rdm_exporting_data_sub_stage'
|
206
|
+
verbose_name = 'Стадия выгрузки данных'
|
207
|
+
verbose_name_plural = 'Стадии выгрузки данных'
|
208
|
+
|
209
|
+
@property
|
210
|
+
def attrs_for_repr_str(self):
|
211
|
+
"""Список атрибутов для отображения экземпляра модели."""
|
212
|
+
return ['function_id', 'collecting_data_sub_stage_id', 'stage_id', 'started_at', 'ended_at', 'status_id']
|
213
|
+
|
214
|
+
def save(self, *args, **kwargs):
|
215
|
+
"""Сохранение экземпляра модели."""
|
216
|
+
if (
|
217
|
+
self.status_id
|
218
|
+
in {
|
219
|
+
ExportingDataSubStageStatus.FAILED.key,
|
220
|
+
ExportingDataSubStageStatus.FINISHED.key,
|
221
|
+
ExportingDataSubStageStatus.READY_FOR_EXPORT.key,
|
222
|
+
}
|
223
|
+
and not self.ended_at
|
224
|
+
):
|
225
|
+
self.ended_at = datetime.now()
|
226
|
+
|
227
|
+
super().save(*args, **kwargs)
|
228
|
+
|
229
|
+
|
230
|
+
class ExportingDataSubStageAttachment(ReprStrPreModelMixin, BaseObjectModel):
|
231
|
+
"""Сгенерированный файл для дальнейшей выгрузки в "Региональная витрина данных"."""
|
232
|
+
|
233
|
+
exporting_data_sub_stage = ForeignKey(
|
234
|
+
to=ExportingDataSubStage,
|
235
|
+
verbose_name='Подэтап выгрузки данных',
|
236
|
+
on_delete=CASCADE,
|
237
|
+
)
|
238
|
+
|
239
|
+
# TODO PYTD-22 В зависимости от принятого решения по инструменту ограничения доступа к media-файлам, нужно будет
|
240
|
+
# изменить тип поля или оставить как есть
|
241
|
+
attachment = FileField(
|
242
|
+
verbose_name='Сгенерированный файл',
|
243
|
+
upload_to=get_exporting_data_stage_attachment_path,
|
244
|
+
max_length=512,
|
245
|
+
null=True,
|
246
|
+
blank=True,
|
247
|
+
)
|
248
|
+
|
249
|
+
operation = SmallIntegerField(
|
250
|
+
verbose_name='Действие',
|
251
|
+
choices=EntityLogOperation.get_choices(),
|
252
|
+
)
|
253
|
+
|
254
|
+
created = DateTimeField(
|
255
|
+
verbose_name='Дата создания',
|
256
|
+
auto_now_add=True,
|
257
|
+
null=True,
|
258
|
+
blank=True,
|
259
|
+
)
|
260
|
+
modified = DateTimeField(
|
261
|
+
verbose_name='Дата изменения',
|
262
|
+
auto_now=True,
|
263
|
+
null=True,
|
264
|
+
blank=True,
|
265
|
+
)
|
266
|
+
attachment_size = PositiveIntegerField(null=True, verbose_name='Размер файла (байт)')
|
267
|
+
|
268
|
+
class Meta:
|
269
|
+
db_table = 'rdm_exporting_data_sub_stage_attachment'
|
270
|
+
verbose_name = 'Сгенерированный файл для дальнейшей выгрузки в "Региональная витрина данных"'
|
271
|
+
verbose_name_plural = 'Сгенерированные файлы для дальнейшей выгрузки в "Региональная витрина данных"'
|
272
|
+
|
273
|
+
@property
|
274
|
+
def attrs_for_repr_str(self):
|
275
|
+
"""Список атрибутов для отображения экземпляра модели."""
|
276
|
+
return ['exporting_data_sub_stage_id', 'attachment', 'operation', 'created', 'modified']
|
277
|
+
|
278
|
+
|
279
|
+
class ExportingDataSubStageEntity(BaseObjectModel):
|
280
|
+
"""Модель связи сущности и подэтапа выгрузки."""
|
281
|
+
|
282
|
+
entity = ForeignKey(
|
283
|
+
to=RegionalDataMartEntityEnum,
|
284
|
+
verbose_name='Сущность РВД',
|
285
|
+
on_delete=PROTECT,
|
286
|
+
)
|
287
|
+
|
288
|
+
exporting_data_sub_stage = ForeignKey(
|
289
|
+
to=ExportingDataSubStage,
|
290
|
+
verbose_name='Подэтап выгрузки данных',
|
291
|
+
on_delete=CASCADE,
|
292
|
+
)
|
293
|
+
|
294
|
+
class Meta:
|
295
|
+
db_table = 'rdm_exporting_data_sub_stage_entity'
|
296
|
+
verbose_name = 'Связь сущности и подэтапа выгрузки'
|
297
|
+
verbose_name_plural = 'Связи сущности и подэтапа выгрузки'
|
298
|
+
|
299
|
+
|
300
|
+
class AbstractExportDataCommandProgress(ReprStrPreModelMixin, BaseObjectModel):
|
301
|
+
"""Команда экспорта данных."""
|
302
|
+
|
303
|
+
task = ...
|
304
|
+
|
305
|
+
logs_link = ...
|
306
|
+
|
307
|
+
stage = ForeignKey(
|
308
|
+
to='edu_rdm_integration_export_data_stage.ExportingDataStage',
|
309
|
+
verbose_name='Этап выгрузки данных',
|
310
|
+
null=True,
|
311
|
+
blank=True,
|
312
|
+
on_delete=SET_NULL,
|
313
|
+
)
|
314
|
+
entity = ForeignKey(
|
315
|
+
to=RegionalDataMartEntityEnum,
|
316
|
+
verbose_name='Сущность РВД',
|
317
|
+
on_delete=PROTECT,
|
318
|
+
)
|
319
|
+
created = DateTimeField(
|
320
|
+
verbose_name='Дата создания',
|
321
|
+
default=timezone.now,
|
322
|
+
)
|
323
|
+
period_started_at = DateTimeField(
|
324
|
+
'Левая граница периода выборки данных для выгрузки',
|
325
|
+
)
|
326
|
+
period_ended_at = DateTimeField(
|
327
|
+
'Правая граница периода выборки данных для выгрузки',
|
328
|
+
)
|
329
|
+
generation_id = UUIDField(
|
330
|
+
'Идентификатор генерации',
|
331
|
+
default=uuid.uuid4,
|
332
|
+
)
|
333
|
+
|
334
|
+
class Meta:
|
335
|
+
abstract = True
|
336
|
+
db_table = 'rdm_exporting_data_command_progress'
|
337
|
+
verbose_name = 'Команда экспорта данных'
|
338
|
+
verbose_name_plural = 'Команды экспорта данных'
|
339
|
+
|
340
|
+
|
341
|
+
class EduRdmExportDataCommandProgress(AbstractExportDataCommandProgress):
|
342
|
+
"""Команда экспорта данных."""
|
343
|
+
|
344
|
+
task = ForeignKey(
|
345
|
+
to='async_task.RunningTask',
|
346
|
+
verbose_name='Асинхронная задача',
|
347
|
+
null=True,
|
348
|
+
blank=True,
|
349
|
+
on_delete=SET_NULL,
|
350
|
+
)
|
351
|
+
logs_link = FileField(
|
352
|
+
upload_to=get_data_command_progress_attachment_path,
|
353
|
+
max_length=255,
|
354
|
+
verbose_name='Файл лога',
|
355
|
+
)
|
356
|
+
type = PositiveSmallIntegerField( # noqa: A003
|
357
|
+
verbose_name='Тип команды',
|
358
|
+
choices=CommandType.get_choices(),
|
359
|
+
)
|
360
|
+
|
361
|
+
class Meta(AbstractExportDataCommandProgress.Meta):
|
362
|
+
db_table = 'edu_rdm_exporting_data_command_progress'
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import logging
|
2
1
|
import os
|
3
2
|
from collections import (
|
4
3
|
defaultdict,
|
@@ -12,7 +11,6 @@ from datetime import (
|
|
12
11
|
from typing import (
|
13
12
|
TYPE_CHECKING,
|
14
13
|
Iterable,
|
15
|
-
Union,
|
16
14
|
)
|
17
15
|
|
18
16
|
from django.conf import (
|
@@ -59,38 +57,27 @@ from m3_db_utils.models import (
|
|
59
57
|
ModelEnumValue,
|
60
58
|
)
|
61
59
|
|
62
|
-
from edu_rdm_integration.
|
63
|
-
BaseOperationData,
|
64
|
-
)
|
65
|
-
from edu_rdm_integration.consts import (
|
60
|
+
from edu_rdm_integration.core.consts import (
|
66
61
|
REGIONAL_DATA_MART_INTEGRATION_EXPORTING_DATA,
|
67
62
|
)
|
68
|
-
from edu_rdm_integration.
|
69
|
-
|
63
|
+
from edu_rdm_integration.core.operations import (
|
64
|
+
BaseOperationData,
|
65
|
+
)
|
66
|
+
from edu_rdm_integration.core.signals import (
|
67
|
+
manager_created,
|
70
68
|
)
|
71
|
-
from edu_rdm_integration.
|
72
|
-
|
73
|
-
WorkerSender,
|
69
|
+
from edu_rdm_integration.core.storages import (
|
70
|
+
RegionalDataMartEntityStorage,
|
74
71
|
)
|
75
|
-
from edu_rdm_integration.
|
76
|
-
|
72
|
+
from edu_rdm_integration.rdm_entities.models import (
|
73
|
+
RegionalDataMartEntityEnum,
|
77
74
|
)
|
78
|
-
from edu_rdm_integration.helpers import (
|
75
|
+
from edu_rdm_integration.stages.export_data.helpers import (
|
79
76
|
get_exporting_managers_max_period_ended_dates,
|
80
77
|
)
|
81
|
-
from edu_rdm_integration.models import (
|
78
|
+
from edu_rdm_integration.stages.export_data.models import (
|
82
79
|
ExportingDataStage,
|
83
80
|
ExportingDataSubStageStatus,
|
84
|
-
RegionalDataMartEntityEnum,
|
85
|
-
)
|
86
|
-
from edu_rdm_integration.redis_cache import (
|
87
|
-
AbstractCache,
|
88
|
-
)
|
89
|
-
from edu_rdm_integration.signals import (
|
90
|
-
manager_created,
|
91
|
-
)
|
92
|
-
from edu_rdm_integration.storages import (
|
93
|
-
RegionalDataMartEntityStorage,
|
94
81
|
)
|
95
82
|
|
96
83
|
|
@@ -249,7 +236,7 @@ class BaseExportLatestEntitiesData(BaseExportEntitiesData):
|
|
249
236
|
description=Substr(
|
250
237
|
Concat('description', Value(f': {entities_str}')),
|
251
238
|
1,
|
252
|
-
self.async_task._meta.get_field('description').max_length
|
239
|
+
self.async_task._meta.get_field('description').max_length,
|
253
240
|
)
|
254
241
|
)
|
255
242
|
|
@@ -344,129 +331,3 @@ class ExportLatestEntitiesData(BaseExportLatestEntitiesData):
|
|
344
331
|
def _get_async_task(self) -> Model:
|
345
332
|
"""Возвращает модель асинхронной задачи."""
|
346
333
|
return RunningTask
|
347
|
-
|
348
|
-
|
349
|
-
class UploadData(BaseOperationData):
|
350
|
-
"""Класс отправки файлов в витрину."""
|
351
|
-
|
352
|
-
def __init__(
|
353
|
-
self,
|
354
|
-
data_cache: AbstractCache,
|
355
|
-
queue: Queue,
|
356
|
-
**kwargs,
|
357
|
-
):
|
358
|
-
super().__init__(**kwargs)
|
359
|
-
|
360
|
-
self.data_cache = data_cache
|
361
|
-
self.queue = queue
|
362
|
-
|
363
|
-
self._configure_agent_client()
|
364
|
-
self.result = {
|
365
|
-
'total_file_size': 0, # Общий размер отправленных файлов
|
366
|
-
'queue_is_full': False, # Признак переполнения очереди
|
367
|
-
'uploaded_entities': '', # Список сущностей, попавших в выгрузку
|
368
|
-
}
|
369
|
-
|
370
|
-
@property
|
371
|
-
def _log_file_path(self) -> Union[str, bytes]:
|
372
|
-
"""Путь до лог файла."""
|
373
|
-
return os.path.join(settings.MEDIA_ROOT, settings.RDM_UPLOAD_LOG_DIR, 'upload_entity.log')
|
374
|
-
|
375
|
-
def _add_file_handler(self) -> None:
|
376
|
-
"""Добавляет обработчик логов."""
|
377
|
-
self._file_handler = logging.FileHandler(self._log_file_path)
|
378
|
-
|
379
|
-
logging.getLogger('info_logger').addHandler(self._file_handler)
|
380
|
-
logging.getLogger('exception_logger').addHandler(self._file_handler)
|
381
|
-
|
382
|
-
# TODO https://jira.bars.group/browse/EDUSCHL-22492. Вынужденная мера, т.к. при запуске команды не производится
|
383
|
-
# проверка готовности конфигов приложений. Нужно переработать механизм конфигурирования клиента загрузчика.
|
384
|
-
def _configure_agent_client(self):
|
385
|
-
"""Конфигурирование клиента загрузчика данных в Витрину."""
|
386
|
-
import uploader_client
|
387
|
-
from django.core.cache import (
|
388
|
-
DEFAULT_CACHE_ALIAS,
|
389
|
-
caches,
|
390
|
-
)
|
391
|
-
from uploader_client.contrib.rdm.interfaces.configurations import (
|
392
|
-
RegionalDataMartEmulationUploaderConfig,
|
393
|
-
RegionalDataMartUploaderConfig,
|
394
|
-
)
|
395
|
-
|
396
|
-
if settings.RDM_UPLOADER_CLIENT_ENABLE_REQUEST_EMULATION:
|
397
|
-
uploader_client.set_config(
|
398
|
-
RegionalDataMartEmulationUploaderConfig(
|
399
|
-
interface='uploader_client.contrib.rdm.interfaces.rest.OpenAPIInterfaceEmulation',
|
400
|
-
url=settings.RDM_UPLOADER_CLIENT_URL,
|
401
|
-
datamart_name=settings.RDM_UPLOADER_CLIENT_DATAMART_NAME,
|
402
|
-
timeout=1,
|
403
|
-
request_retries=1,
|
404
|
-
file_status=settings.RDM_RESPONSE_FILE_STATUS,
|
405
|
-
)
|
406
|
-
)
|
407
|
-
elif settings.RDM_UPLOADER_CLIENT_USE_PROXY_API:
|
408
|
-
uploader_client.set_config(
|
409
|
-
RegionalDataMartUploaderConfig(
|
410
|
-
interface='uploader_client.contrib.rdm.interfaces.rest.ProxyAPIInterface',
|
411
|
-
cache=caches[DEFAULT_CACHE_ALIAS],
|
412
|
-
url=settings.RDM_UPLOADER_CLIENT_URL,
|
413
|
-
datamart_name=settings.RDM_UPLOADER_CLIENT_DATAMART_NAME,
|
414
|
-
timeout=settings.RDM_UPLOADER_CLIENT_REQUEST_TIMEOUT,
|
415
|
-
request_retries=settings.RDM_UPLOADER_CLIENT_REQUEST_RETRIES,
|
416
|
-
organization_ogrn=settings.RDM_UPLOADER_CLIENT_ORGANIZATION_OGRN,
|
417
|
-
installation_name=settings.RDM_UPLOADER_CLIENT_INSTALLATION_NAME,
|
418
|
-
installation_id=settings.RDM_UPLOADER_CLIENT_INSTALLATION_ID,
|
419
|
-
username=settings.RDM_UPLOADER_CLIENT_USERNAME,
|
420
|
-
password=settings.RDM_UPLOADER_CLIENT_PASSWORD,
|
421
|
-
)
|
422
|
-
)
|
423
|
-
else:
|
424
|
-
uploader_client.set_config(
|
425
|
-
RegionalDataMartUploaderConfig(
|
426
|
-
url=settings.RDM_UPLOADER_CLIENT_URL,
|
427
|
-
datamart_name=settings.RDM_UPLOADER_CLIENT_DATAMART_NAME,
|
428
|
-
timeout=settings.RDM_UPLOADER_CLIENT_REQUEST_TIMEOUT,
|
429
|
-
request_retries=settings.RDM_UPLOADER_CLIENT_REQUEST_RETRIES,
|
430
|
-
)
|
431
|
-
)
|
432
|
-
|
433
|
-
def update_total_queue_size_in_cache(self, received_files_size: int):
|
434
|
-
"""Обновление размера файлов в кеш."""
|
435
|
-
with self.data_cache.lock(f'{TOTAL_ATTACHMENTS_SIZE_KEY}:lock', timeout=300):
|
436
|
-
queue_total_file_size = self.data_cache.get(TOTAL_ATTACHMENTS_SIZE_KEY) or 0
|
437
|
-
if queue_total_file_size:
|
438
|
-
queue_total_file_size -= received_files_size
|
439
|
-
if queue_total_file_size > 0:
|
440
|
-
self.data_cache.set(
|
441
|
-
TOTAL_ATTACHMENTS_SIZE_KEY,
|
442
|
-
queue_total_file_size,
|
443
|
-
timeout=settings.RDM_REDIS_CACHE_TIMEOUT_SECONDS,
|
444
|
-
)
|
445
|
-
|
446
|
-
def upload_data(self, *args, **kwargs):
|
447
|
-
"""Запускает отправку данных в витрину."""
|
448
|
-
try:
|
449
|
-
exporter = ExportQueueSender(self.data_cache, self.queue, settings.RDM_UPLOAD_DATA_TASK_EXPORT_STAGES)
|
450
|
-
exporter.run()
|
451
|
-
|
452
|
-
self.result['queue_is_full'] = exporter.queue_is_full
|
453
|
-
self.result['total_file_size'] = exporter.queue_total_file_size
|
454
|
-
|
455
|
-
# Если очередь не переполнена - то отправляем данные в витрину
|
456
|
-
if not exporter.queue_is_full:
|
457
|
-
sender = WorkerSender(self.queue)
|
458
|
-
sender.run()
|
459
|
-
|
460
|
-
if sender.entities:
|
461
|
-
self.result['uploaded_entities'] = ','.join(sender.entities)
|
462
|
-
|
463
|
-
if sender.received_file_size:
|
464
|
-
self.update_total_queue_size_in_cache(sender.received_file_size)
|
465
|
-
|
466
|
-
except Exception as err:
|
467
|
-
logger.exception(err)
|
468
|
-
raise err
|
469
|
-
finally:
|
470
|
-
self._remove_file_handler()
|
471
|
-
|
472
|
-
return self.result
|
File without changes
|
@@ -31,37 +31,37 @@ from educommon.utils.ui import (
|
|
31
31
|
DatetimeFilterCreator,
|
32
32
|
)
|
33
33
|
|
34
|
-
from edu_rdm_integration.
|
34
|
+
from edu_rdm_integration.core.enums import (
|
35
|
+
CommandType,
|
36
|
+
)
|
37
|
+
from edu_rdm_integration.core.helpers import (
|
38
|
+
make_download_link,
|
39
|
+
)
|
40
|
+
from edu_rdm_integration.core.registry.actions import (
|
35
41
|
BaseCommandProgressPack,
|
36
42
|
BaseStartTaskAction,
|
37
43
|
)
|
38
|
-
from edu_rdm_integration.
|
39
|
-
|
40
|
-
)
|
41
|
-
from edu_rdm_integration.enums import (
|
42
|
-
CommandType,
|
44
|
+
from edu_rdm_integration.rdm_entities.models import (
|
45
|
+
RegionalDataMartEntityEnum,
|
43
46
|
)
|
44
|
-
from edu_rdm_integration.export_data.generators import (
|
47
|
+
from edu_rdm_integration.stages.export_data.generators import (
|
45
48
|
BaseFirstExportEntitiesDataCommandsGenerator,
|
46
49
|
)
|
47
|
-
from edu_rdm_integration.export_data.
|
48
|
-
|
49
|
-
DetailExportCommandWindow,
|
50
|
-
ExportCommandProgressListWindow,
|
51
|
-
)
|
52
|
-
from edu_rdm_integration.helpers import (
|
53
|
-
make_download_link,
|
54
|
-
)
|
55
|
-
from edu_rdm_integration.models import (
|
50
|
+
from edu_rdm_integration.stages.export_data.models import (
|
51
|
+
EduRdmExportDataCommandProgress,
|
56
52
|
ExportingDataStageStatus,
|
57
53
|
ExportingDataSubStage,
|
58
54
|
ExportingDataSubStageStatus,
|
59
|
-
|
55
|
+
)
|
56
|
+
from edu_rdm_integration.stages.export_data.registry.ui import (
|
57
|
+
CreateExportCommandWindow,
|
58
|
+
DetailExportCommandWindow,
|
59
|
+
ExportCommandProgressListWindow,
|
60
60
|
)
|
61
61
|
|
62
62
|
|
63
63
|
class BaseExportingDataProgressPack(BaseCommandProgressPack):
|
64
|
-
"""
|
64
|
+
"""Базовый пак команд экспорта данных сущностей РВД."""
|
65
65
|
|
66
66
|
model = EduRdmExportDataCommandProgress
|
67
67
|
title = 'Экспорт данных сущностей РВД'
|
@@ -0,0 +1,11 @@
|
|
1
|
+
from django.apps import (
|
2
|
+
AppConfig,
|
3
|
+
)
|
4
|
+
|
5
|
+
|
6
|
+
class RDMExportDataRegistryAppConfig(AppConfig):
|
7
|
+
"""Приложение для организации экспорта данных моделей РВД из интерфейса."""
|
8
|
+
|
9
|
+
name = 'edu_rdm_integration.stages.export_data.registry'
|
10
|
+
label = 'edu_rdm_integration_export_data_registry'
|
11
|
+
verbose_name = 'Экспорт данных моделей РВД из интерфейса'
|
@@ -29,16 +29,14 @@ from educommon.utils.ui import (
|
|
29
29
|
append_template_globals,
|
30
30
|
)
|
31
31
|
|
32
|
-
from edu_rdm_integration.
|
33
|
-
|
32
|
+
from edu_rdm_integration.core.consts import (
|
33
|
+
BATCH_SIZE,
|
34
34
|
)
|
35
|
-
from edu_rdm_integration.
|
35
|
+
from edu_rdm_integration.core.registry.ui import (
|
36
36
|
BaseCreateCommandWindow,
|
37
|
+
CommandProgressListWindow,
|
37
38
|
)
|
38
|
-
from edu_rdm_integration.
|
39
|
-
BATCH_SIZE,
|
40
|
-
)
|
41
|
-
from edu_rdm_integration.models import (
|
39
|
+
from edu_rdm_integration.rdm_entities.models import (
|
42
40
|
RegionalDataMartEntityEnum,
|
43
41
|
)
|
44
42
|
|