idds-server 2.6.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.
- idds/agents/__init__.py +9 -0
- idds/agents/archive/__init__.py +9 -0
- idds/agents/archive/archiver.py +77 -0
- idds/agents/archive/run_archive.py +146 -0
- idds/agents/carrier/__init__.py +9 -0
- idds/agents/carrier/finisher.py +616 -0
- idds/agents/carrier/iutils.py +226 -0
- idds/agents/carrier/plugins/__init__.py +9 -0
- idds/agents/carrier/plugins/base.py +224 -0
- idds/agents/carrier/plugins/panda.py +203 -0
- idds/agents/carrier/poller.py +730 -0
- idds/agents/carrier/receiver.py +341 -0
- idds/agents/carrier/submitter.py +616 -0
- idds/agents/carrier/trigger.py +294 -0
- idds/agents/carrier/utils.py +2413 -0
- idds/agents/clerk/__init__.py +9 -0
- idds/agents/clerk/clerk.py +2104 -0
- idds/agents/common/__init__.py +9 -0
- idds/agents/common/baseagent.py +431 -0
- idds/agents/common/cache/__init__.py +9 -0
- idds/agents/common/cache/redis.py +108 -0
- idds/agents/common/eventbus/__init__.py +9 -0
- idds/agents/common/eventbus/baseeventbusbackend.py +132 -0
- idds/agents/common/eventbus/baseeventbusbackendopt.py +172 -0
- idds/agents/common/eventbus/dbeventbusbackend.py +85 -0
- idds/agents/common/eventbus/event.py +11 -0
- idds/agents/common/eventbus/eventbus.py +150 -0
- idds/agents/common/eventbus/msgeventbusbackend.py +620 -0
- idds/agents/common/plugins/__init__.py +9 -0
- idds/agents/common/plugins/messaging.py +409 -0
- idds/agents/common/timerscheduler.py +239 -0
- idds/agents/common/timertask.py +68 -0
- idds/agents/conductor/__init__.py +9 -0
- idds/agents/conductor/conductor.py +360 -0
- idds/agents/conductor/consumer.py +107 -0
- idds/agents/coordinator/__init__.py +9 -0
- idds/agents/coordinator/coordinator.py +375 -0
- idds/agents/coordinator/nats_coordinator.py +377 -0
- idds/agents/main.py +169 -0
- idds/agents/marshaller/__init__.py +9 -0
- idds/agents/marshaller/marshaller.py +293 -0
- idds/agents/prompt/__init__.py +9 -0
- idds/agents/prompt/handlers/__init__.py +9 -0
- idds/agents/prompt/handlers/panda.py +244 -0
- idds/agents/prompt/handlers/slicehandler.py +182 -0
- idds/agents/prompt/handlers/workerhandler.py +572 -0
- idds/agents/prompt/transceiver.py +395 -0
- idds/agents/transformer/__init__.py +9 -0
- idds/agents/transformer/transformer.py +1616 -0
- idds/agents/transporter/__init__.py +9 -0
- idds/agents/transporter/transporter.py +427 -0
- idds/api/__init__.py +9 -0
- idds/api/catalog.py +84 -0
- idds/api/collections.py +80 -0
- idds/api/contents.py +88 -0
- idds/api/processings.py +71 -0
- idds/api/requests.py +87 -0
- idds/api/transforms.py +68 -0
- idds/core/__init__.py +9 -0
- idds/core/authentication.py +140 -0
- idds/core/catalog.py +898 -0
- idds/core/commands.py +106 -0
- idds/core/conditions.py +104 -0
- idds/core/events.py +104 -0
- idds/core/health.py +102 -0
- idds/core/messages.py +151 -0
- idds/core/meta.py +58 -0
- idds/core/processings.py +462 -0
- idds/core/requests.py +515 -0
- idds/core/requests_group.py +76 -0
- idds/core/throttlers.py +64 -0
- idds/core/transforms.py +661 -0
- idds/core/version.py +12 -0
- idds/core/workprogress.py +212 -0
- idds/orm/__init__.py +9 -0
- idds/orm/base/__init__.py +9 -0
- idds/orm/base/alembic/__init__.py +9 -0
- idds/orm/base/alembic/env.py +100 -0
- idds/orm/base/alembic/versions/0204f391c32d_add_poll_period_in_message.py +42 -0
- idds/orm/base/alembic/versions/1bc6e82e8514_using_hash_on_contents_long_name.py +61 -0
- idds/orm/base/alembic/versions/2553ccb45260_add_unmapped_num_in_processing.py +61 -0
- idds/orm/base/alembic/versions/3073c5de8f73_add_conditions_and_campaign.py +86 -0
- idds/orm/base/alembic/versions/354f8e5a5879_add_meta_info_table.py +57 -0
- idds/orm/base/alembic/versions/40ead97e63c6_messages_table_add_internal_id.py +39 -0
- idds/orm/base/alembic/versions/53d0af715dab_add_site_throttler.py +97 -0
- idds/orm/base/alembic/versions/5e0aa2aa1fa3_add_fetch_status_in_contents_update.py +41 -0
- idds/orm/base/alembic/versions/6931b48500a2_add_campaign_group.py +112 -0
- idds/orm/base/alembic/versions/6ae1f334bf41_create_contents_dep_index.py +40 -0
- idds/orm/base/alembic/versions/6ca0e5e466eb_update_message_null_constraints.py +43 -0
- idds/orm/base/alembic/versions/87df821d153a_opt_group_table.py +41 -0
- idds/orm/base/alembic/versions/8c3a2b989a93_update_campaign_columns.py +71 -0
- idds/orm/base/alembic/versions/8fe5cab9bde1_update_transforms_adding_constraint.py +42 -0
- idds/orm/base/alembic/versions/__init__.py +9 -0
- idds/orm/base/alembic/versions/a844dae57021_add_process_thread_locking_information.py +67 -0
- idds/orm/base/alembic/versions/abf9fce65c86_add_parent_internal_id_in_transforms.py +43 -0
- idds/orm/base/alembic/versions/ad6d53a69afa_add_cloud_info_in_requests.py +49 -0
- idds/orm/base/alembic/versions/b0ec813021d6_add_sub_map_id.py +48 -0
- idds/orm/base/alembic/versions/cc9f730e54c5_add_parent_transform_id_and_processing_.py +51 -0
- idds/orm/base/alembic/versions/e3f3af2cadc7_add_new_requests_in_requests_group.py +41 -0
- idds/orm/base/alembic/versions/f26b00cc867d_add_more_files_statistics_items.py +43 -0
- idds/orm/base/alembic/versions/f79663a7e94e_add_external_content_id.py +45 -0
- idds/orm/base/enum.py +120 -0
- idds/orm/base/models.py +1236 -0
- idds/orm/base/session.py +417 -0
- idds/orm/base/types.py +194 -0
- idds/orm/base/utils.py +151 -0
- idds/orm/collections.py +441 -0
- idds/orm/commands.py +195 -0
- idds/orm/conditions.py +167 -0
- idds/orm/contents.py +1656 -0
- idds/orm/events.py +323 -0
- idds/orm/health.py +107 -0
- idds/orm/messages.py +260 -0
- idds/orm/meta.py +102 -0
- idds/orm/processings.py +614 -0
- idds/orm/requests.py +1416 -0
- idds/orm/requests_group.py +120 -0
- idds/orm/throttlers.py +151 -0
- idds/orm/transforms.py +718 -0
- idds/orm/workprogress.py +304 -0
- idds/rest/__init__.py +9 -0
- idds/rest/v1/__init__.py +9 -0
- idds/rest/v1/app.py +193 -0
- idds/rest/v1/auth.py +139 -0
- idds/rest/v1/cacher.py +99 -0
- idds/rest/v1/catalog.py +218 -0
- idds/rest/v1/controller.py +93 -0
- idds/rest/v1/hyperparameteropt.py +158 -0
- idds/rest/v1/logs.py +104 -0
- idds/rest/v1/messages.py +194 -0
- idds/rest/v1/metainfo.py +60 -0
- idds/rest/v1/monitor.py +528 -0
- idds/rest/v1/ping.py +52 -0
- idds/rest/v1/requests.py +559 -0
- idds/rest/v1/transforms.py +127 -0
- idds/rest/v1/utils.py +268 -0
- idds/tests/__init__.py +9 -0
- idds/tests/activelearning_test.py +56 -0
- idds/tests/activelearning_test_codes/merge.py +31 -0
- idds/tests/activelearning_test_codes/runtasklocal.py +43 -0
- idds/tests/activelearning_test_codes/simplescript.py +30 -0
- idds/tests/auth_test_script.py +137 -0
- idds/tests/cacher_test.py +32 -0
- idds/tests/catalog_test.py +45 -0
- idds/tests/client_test.py +50 -0
- idds/tests/common.py +337 -0
- idds/tests/core_tests.py +311 -0
- idds/tests/core_tests_atlas.py +157 -0
- idds/tests/core_tests_dep_id.py +35 -0
- idds/tests/core_tests_stat.py +35 -0
- idds/tests/datacarousel_test.py +115 -0
- idds/tests/doma_build_test.py +164 -0
- idds/tests/doma_build_test_pandaclient.py +189 -0
- idds/tests/find_dependencies.py +73 -0
- idds/tests/fix_content_dep_id.py +69 -0
- idds/tests/fix_trasnform_name.py +27 -0
- idds/tests/group_submission.py +92 -0
- idds/tests/hyperparameteropt_bayesian_test.py +56 -0
- idds/tests/hyperparameteropt_client_test.py +49 -0
- idds/tests/hyperparameteropt_docker_local_test.py +176 -0
- idds/tests/hyperparameteropt_docker_test.py +57 -0
- idds/tests/hyperparameteropt_nevergrad_test.py +56 -0
- idds/tests/jsonload_test.py +81 -0
- idds/tests/kill_workflow_task.py +41 -0
- idds/tests/logs_test.py +34 -0
- idds/tests/match_test.py +49 -0
- idds/tests/message_test.py +22 -0
- idds/tests/message_test1.py +25 -0
- idds/tests/migrating_requests_v1_to_v2.py +80 -0
- idds/tests/os_boto3_test.py +86 -0
- idds/tests/panda_client_submit_test.py +66 -0
- idds/tests/panda_client_test.py +24 -0
- idds/tests/panda_iam_test.py +41 -0
- idds/tests/panda_test.py +352 -0
- idds/tests/performance_test_with_cx_oracle.py +169 -0
- idds/tests/performance_test_with_sqlalchemy.py +133 -0
- idds/tests/relation_map_test.py +64 -0
- idds/tests/rest_test.py +29 -0
- idds/tests/retry_processing.py +9 -0
- idds/tests/run_sql.py +65 -0
- idds/tests/scaling_checks.py +45 -0
- idds/tests/set_throttlers.py +10 -0
- idds/tests/split_messages.py +30 -0
- idds/tests/subprocess_test.py +45 -0
- idds/tests/test_activelearning.py +181 -0
- idds/tests/test_atlaspandawork.py +194 -0
- idds/tests/test_auth.py +128 -0
- idds/tests/test_big_request.py +68 -0
- idds/tests/test_catalog.py +546 -0
- idds/tests/test_catalog_core.py +48 -0
- idds/tests/test_class_attr.py +39 -0
- idds/tests/test_client.py +73 -0
- idds/tests/test_core_debug.py +50 -0
- idds/tests/test_datacarousel.py +145 -0
- idds/tests/test_domapanda.py +363 -0
- idds/tests/test_domapanda_big.py +328 -0
- idds/tests/test_domapanda_build.py +207 -0
- idds/tests/test_domapanda_build_pandaclient.py +226 -0
- idds/tests/test_domapanda_es.py +319 -0
- idds/tests/test_domapanda_long_name.py +272 -0
- idds/tests/test_domapanda_lsst_workflow.py +330 -0
- idds/tests/test_domapanda_mem.py +290 -0
- idds/tests/test_domapanda_pandaclient.py +196 -0
- idds/tests/test_domapanda_small_mem.py +279 -0
- idds/tests/test_domapanda_workflow.py +185 -0
- idds/tests/test_get_dn.py +127 -0
- idds/tests/test_get_request_info.py +36 -0
- idds/tests/test_get_request_info_panda.py +38 -0
- idds/tests/test_get_source_code.py +24 -0
- idds/tests/test_hyperparameteropt.py +65 -0
- idds/tests/test_iworkflow/optimize.py +437 -0
- idds/tests/test_iworkflow/optimize_iworkflow.py +124 -0
- idds/tests/test_iworkflow/test_asyncresults.py +51 -0
- idds/tests/test_iworkflow/test_imports.py +40 -0
- idds/tests/test_iworkflow/test_iworkflow.py +144 -0
- idds/tests/test_iworkflow/test_iworkflow1.py +136 -0
- idds/tests/test_iworkflow/test_iworkflow_local.py +122 -0
- idds/tests/test_iworkflow/test_iworkflow_local_mul.py +122 -0
- idds/tests/test_iworkflow/test_iworkflow_mul.py +152 -0
- idds/tests/test_iworkflow/test_plot.py +70 -0
- idds/tests/test_logger.py +83 -0
- idds/tests/test_merge_dict.py +48 -0
- idds/tests/test_migrate_requests.py +120 -0
- idds/tests/test_nats.py +88 -0
- idds/tests/test_prompt_transformer.py +97 -0
- idds/tests/test_prompt_worker.py +168 -0
- idds/tests/test_property.py +17 -0
- idds/tests/test_request_transform.py +70 -0
- idds/tests/test_requests.py +91 -0
- idds/tests/test_running_data.py +212 -0
- idds/tests/test_scaling.py +51 -0
- idds/tests/test_sequence.py +4 -0
- idds/tests/test_token.py +48 -0
- idds/tests/test_token_refresh.py +81 -0
- idds/tests/test_transform_collection_content.py +219 -0
- idds/tests/test_transform_processing.py +56 -0
- idds/tests/test_workflow.py +127 -0
- idds/tests/test_workflow_condition.py +723 -0
- idds/tests/test_workflow_condition_v2.py +1926 -0
- idds/tests/test_workflow_condition_v2_1.py +248 -0
- idds/tests/test_wrapper.py +86 -0
- idds/tests/trigger_release.py +34 -0
- idds_server-2.6.0.data/data/config_default/alembic.ini +107 -0
- idds_server-2.6.0.data/data/config_default/auth.cfg +8 -0
- idds_server-2.6.0.data/data/config_default/gacl +29 -0
- idds_server-2.6.0.data/data/config_default/healthmonitor_daemon +4 -0
- idds_server-2.6.0.data/data/config_default/httpd-idds-443-py311-al9.conf +205 -0
- idds_server-2.6.0.data/data/config_default/httpd-idds-443-py39-cc7.conf +205 -0
- idds_server-2.6.0.data/data/config_default/httpd_daemon.sh +28 -0
- idds_server-2.6.0.data/data/config_default/idds.cfg +230 -0
- idds_server-2.6.0.data/data/config_default/idds.cfg.orig +132 -0
- idds_server-2.6.0.data/data/config_default/idds_health_check.py +223 -0
- idds_server-2.6.0.data/data/config_default/logrotate_daemon +14 -0
- idds_server-2.6.0.data/data/config_default/logrotate_idds +19 -0
- idds_server-2.6.0.data/data/config_default/nats_daemon.sh +44 -0
- idds_server-2.6.0.data/data/config_default/panda.cfg +9 -0
- idds_server-2.6.0.data/data/config_default/rucio.cfg +22 -0
- idds_server-2.6.0.data/data/config_default/supervisord_healthmonitor.ini +17 -0
- idds_server-2.6.0.data/data/config_default/supervisord_httpd.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds.ini +25 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_clerk.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_finisher.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_poller.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_receiver.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_submitter.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_transformer.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_idds_trigger.ini +26 -0
- idds_server-2.6.0.data/data/config_default/supervisord_iddsfake.ini +24 -0
- idds_server-2.6.0.data/data/config_default/supervisord_logrotate.ini +17 -0
- idds_server-2.6.0.data/data/config_default/supervisord_nats.ini +22 -0
- idds_server-2.6.0.data/data/config_default/supervisord_syslog-ng.ini +22 -0
- idds_server-2.6.0.data/data/config_default/vomsprox-renew +27 -0
- idds_server-2.6.0.data/data/etc/condor/collector/00personal_condor.config +42 -0
- idds_server-2.6.0.data/data/etc/condor/collector/09_flin_condor.config +3 -0
- idds_server-2.6.0.data/data/etc/condor/submitter/00personal_condor.config +43 -0
- idds_server-2.6.0.data/data/etc/idds/alembic.ini.template +107 -0
- idds_server-2.6.0.data/data/etc/idds/auth/auth.cfg.template +34 -0
- idds_server-2.6.0.data/data/etc/idds/condor/client/00personal_condor.config +43 -0
- idds_server-2.6.0.data/data/etc/idds/condor/server/00personal_condor.config +42 -0
- idds_server-2.6.0.data/data/etc/idds/idds.cfg.client.template +25 -0
- idds_server-2.6.0.data/data/etc/idds/idds.cfg.template +132 -0
- idds_server-2.6.0.data/data/etc/idds/rest/gacl.template +29 -0
- idds_server-2.6.0.data/data/etc/idds/rest/httpd-idds-443-py36-cc7.conf.template +120 -0
- idds_server-2.6.0.data/data/etc/idds/rest/httpd-idds-443-py36-cc7_normal.conf.template +63 -0
- idds_server-2.6.0.data/data/etc/idds/rest/httpd-idds-443-py39-cc7.conf.template +133 -0
- idds_server-2.6.0.data/data/etc/idds/rest/ssl.conf +55 -0
- idds_server-2.6.0.data/data/etc/idds/supervisord.d/idds.ini +29 -0
- idds_server-2.6.0.data/data/etc/idds/website/25-port443.conf +30 -0
- idds_server-2.6.0.data/data/etc/idds/website/25-port80.conf +10 -0
- idds_server-2.6.0.data/data/etc/panda/panda.cfg +12 -0
- idds_server-2.6.0.data/data/etc/sql/oracle_11.sql +688 -0
- idds_server-2.6.0.data/data/etc/sql/oracle_11_test.sql +43 -0
- idds_server-2.6.0.data/data/etc/sql/oracle_19.sql +651 -0
- idds_server-2.6.0.data/data/etc/sql/oracle_19_sqlalchemy.sql +625 -0
- idds_server-2.6.0.data/data/etc/sql/oracle_update.sql +619 -0
- idds_server-2.6.0.data/data/etc/sql/postgres_partition.sql +15 -0
- idds_server-2.6.0.data/data/etc/sql/postgresql.sql +563 -0
- idds_server-2.6.0.data/data/etc/sql/postgresql_init.sql +18 -0
- idds_server-2.6.0.data/data/etc/sql/postgresql_update.sql +21 -0
- idds_server-2.6.0.data/data/tools/env/clean_heartbeat.py +33 -0
- idds_server-2.6.0.data/data/tools/env/config_monitor.py +32 -0
- idds_server-2.6.0.data/data/tools/env/config_server +20 -0
- idds_server-2.6.0.data/data/tools/env/create_database.py +21 -0
- idds_server-2.6.0.data/data/tools/env/create_postgres_db.sh +16 -0
- idds_server-2.6.0.data/data/tools/env/destroy_database.py +28 -0
- idds_server-2.6.0.data/data/tools/env/dump_database.py +21 -0
- idds_server-2.6.0.data/data/tools/env/environment.yml +34 -0
- idds_server-2.6.0.data/data/tools/env/flake +8 -0
- idds_server-2.6.0.data/data/tools/env/install_env_conda.sh +19 -0
- idds_server-2.6.0.data/data/tools/env/install_idds.sh +47 -0
- idds_server-2.6.0.data/data/tools/env/install_idds_example.sh +117 -0
- idds_server-2.6.0.data/data/tools/env/install_idds_full.sh +136 -0
- idds_server-2.6.0.data/data/tools/env/install_packages.sh +13 -0
- idds_server-2.6.0.data/data/tools/env/merge_configmap.py +99 -0
- idds_server-2.6.0.data/data/tools/env/merge_idds_configs.py +130 -0
- idds_server-2.6.0.data/data/tools/env/setup_dev.sh +36 -0
- idds_server-2.6.0.data/data/tools/env/setup_httpd_conf.py +121 -0
- idds_server-2.6.0.data/data/tools/env/setup_idds.sh +10 -0
- idds_server-2.6.0.data/data/tools/env/setup_idds_path.py +177 -0
- idds_server-2.6.0.data/data/tools/env/setup_panda.sh +189 -0
- idds_server-2.6.0.data/scripts/idds-daemon +68 -0
- idds_server-2.6.0.data/scripts/idds.wsgi +25 -0
- idds_server-2.6.0.data/scripts/idds.wsgi.template +25 -0
- idds_server-2.6.0.data/scripts/run-idds +21 -0
- idds_server-2.6.0.data/scripts/run-idds-fake +5 -0
- idds_server-2.6.0.dist-info/METADATA +58 -0
- idds_server-2.6.0.dist-info/RECORD +330 -0
- idds_server-2.6.0.dist-info/WHEEL +5 -0
- idds_server-2.6.0.dist-info/licenses/LICENSE.rst +14 -0
- idds_server-2.6.0.dist-info/top_level.txt +1 -0
idds/agents/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0OA
|
|
7
|
+
#
|
|
8
|
+
# Authors:
|
|
9
|
+
# - Wen Guan, <wen.guan@cern.ch>, 2019
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0OA
|
|
7
|
+
#
|
|
8
|
+
# Authors:
|
|
9
|
+
# - Wen Guan, <wen.guan@cern.ch>, 2019
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0OA
|
|
7
|
+
#
|
|
8
|
+
# Authors:
|
|
9
|
+
# - Wen Guan, <wen.guan@cern.ch>, 2019 - 2023
|
|
10
|
+
|
|
11
|
+
import traceback
|
|
12
|
+
|
|
13
|
+
from idds.common.constants import Sections, RequestStatus
|
|
14
|
+
from idds.common.utils import setup_logging
|
|
15
|
+
from idds.core import (requests as core_requests,
|
|
16
|
+
messages as core_messages)
|
|
17
|
+
from idds.agents.common.baseagent import BaseAgent
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
setup_logging(__name__)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Archiver(BaseAgent):
|
|
24
|
+
"""
|
|
25
|
+
Archiver works to archive data
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, num_threads=1, poll_period=7, older_than=30, **kwargs):
|
|
29
|
+
self.set_max_workers()
|
|
30
|
+
num_threads = self.max_number_workers
|
|
31
|
+
super(Archiver, self).__init__(num_threads=num_threads, name='Archive', **kwargs)
|
|
32
|
+
if not poll_period:
|
|
33
|
+
poll_period = 7 # days
|
|
34
|
+
self.poll_period = int(poll_period) * 3600 * 24
|
|
35
|
+
if not older_than:
|
|
36
|
+
older_than = 30
|
|
37
|
+
self.older_than = int(older_than) # days
|
|
38
|
+
self.config_section = Sections.Archiver
|
|
39
|
+
|
|
40
|
+
def clean_messages(self):
|
|
41
|
+
try:
|
|
42
|
+
status = [RequestStatus.Finished, RequestStatus.SubFinished,
|
|
43
|
+
RequestStatus.Failed, RequestStatus.Cancelled,
|
|
44
|
+
RequestStatus.Suspended, RequestStatus.Expired]
|
|
45
|
+
request_id = core_requests.get_last_request_id(older_than=self.older_than, status=status)
|
|
46
|
+
if request_id:
|
|
47
|
+
self.logger.info("cleaning old mesages older than request id %s" % request_id)
|
|
48
|
+
core_messages.clean_old_messages(request_id=request_id)
|
|
49
|
+
except Exception as ex:
|
|
50
|
+
self.logger.error(ex)
|
|
51
|
+
self.logger.error(traceback.format_exc())
|
|
52
|
+
|
|
53
|
+
def run(self):
|
|
54
|
+
"""
|
|
55
|
+
Main run function.
|
|
56
|
+
"""
|
|
57
|
+
try:
|
|
58
|
+
self.logger.info("Starting main thread")
|
|
59
|
+
self.init_thread_info()
|
|
60
|
+
|
|
61
|
+
self.add_default_tasks()
|
|
62
|
+
|
|
63
|
+
self.logger.info("poll period: %s seconds" % self.poll_period)
|
|
64
|
+
self.logger.info("older_than: %s days" % self.older_than)
|
|
65
|
+
|
|
66
|
+
task = self.create_task(task_func=self.clean_messages, task_output_queue=None,
|
|
67
|
+
task_args=tuple(), task_kwargs={}, delay_time=self.poll_period, priority=1)
|
|
68
|
+
self.add_task(task)
|
|
69
|
+
|
|
70
|
+
self.execute()
|
|
71
|
+
except KeyboardInterrupt:
|
|
72
|
+
self.stop()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if __name__ == '__main__':
|
|
76
|
+
agent = Archiver()
|
|
77
|
+
agent()
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0OA
|
|
7
|
+
#
|
|
8
|
+
# Authors:
|
|
9
|
+
# - Wen Guan, <wen.guan@cern.ch>, 2021
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
"""
|
|
13
|
+
performance test to insert contents.
|
|
14
|
+
"""
|
|
15
|
+
import cx_Oracle
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
from idds.common.config import config_get
|
|
19
|
+
# from idds.core.contents import add_content
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def get_archive_sql(schema):
|
|
23
|
+
sql = """
|
|
24
|
+
BEGIN
|
|
25
|
+
FOR i in (SELECT request_id, scope, name, requester, request_type, transform_tag,
|
|
26
|
+
workload_id, priority, status, substatus, locking, created_at,
|
|
27
|
+
updated_at, next_poll_at, accessed_at, expired_at, errors,
|
|
28
|
+
request_metadata, processing_metadata
|
|
29
|
+
FROM {schema}.requests
|
|
30
|
+
WHERE status in (3, 5, 9, 17) and created_at < sysdate - interval '3' month
|
|
31
|
+
order by request_id asc)
|
|
32
|
+
LOOP
|
|
33
|
+
--- archive records
|
|
34
|
+
insert into {schema}.requests_archive(request_id, scope, name, requester,
|
|
35
|
+
request_type, transform_tag, workload_id, priority, status,
|
|
36
|
+
substatus, locking, created_at, updated_at, next_poll_at,
|
|
37
|
+
accessed_at, expired_at, errors, request_metadata,
|
|
38
|
+
processing_metadata)
|
|
39
|
+
values(i.request_id, i.scope, i.name, i.requester, i.request_type, i.transform_tag,
|
|
40
|
+
i.workload_id, i.priority, i.status, i.substatus, i.locking, i.created_at,
|
|
41
|
+
i.updated_at, i.next_poll_at, i.accessed_at, i.expired_at, i.errors,
|
|
42
|
+
i.request_metadata, i.processing_metadata);
|
|
43
|
+
|
|
44
|
+
insert into {schema}.transforms_archive(transform_id, request_id, workload_id,
|
|
45
|
+
transform_type, transform_tag, priority,
|
|
46
|
+
safe2get_output_from_input, status,
|
|
47
|
+
substatus, locking, retries, created_at,
|
|
48
|
+
updated_at, next_poll_at, started_at,
|
|
49
|
+
finished_at, expired_at, transform_metadata,
|
|
50
|
+
running_metadata)
|
|
51
|
+
select transform_id, request_id, workload_id, transform_type, transform_tag,
|
|
52
|
+
priority, safe2get_output_from_input, status, substatus, locking,
|
|
53
|
+
retries, created_at, updated_at, next_poll_at, started_at, finished_at,
|
|
54
|
+
expired_at, transform_metadata, running_metadata
|
|
55
|
+
from {schema}.transforms where request_id=i.request_id;
|
|
56
|
+
|
|
57
|
+
insert into {schema}.processings_archive(processing_id, transform_id, request_id,
|
|
58
|
+
workload_id, status, substatus, locking, submitter, submitted_id,
|
|
59
|
+
granularity, granularity_type, created_at, updated_at, next_poll_at,
|
|
60
|
+
submitted_at, finished_at, expired_at, processing_metadata,
|
|
61
|
+
running_metadata, output_metadata)
|
|
62
|
+
select processing_id, transform_id, request_id, workload_id, status, substatus,
|
|
63
|
+
locking, submitter, submitted_id, granularity, granularity_type,
|
|
64
|
+
created_at, updated_at, next_poll_at, submitted_at, finished_at, expired_at,
|
|
65
|
+
processing_metadata, running_metadata, output_metadata
|
|
66
|
+
from {schema}.processings where request_id=i.request_id;
|
|
67
|
+
|
|
68
|
+
insert into {schema}.collections_archive(coll_id, coll_type, transform_id, request_id,
|
|
69
|
+
workload_id, relation_type, scope, name, bytes, status, substatus, locking,
|
|
70
|
+
total_files, storage_id, new_files, processed_files, processing_files,
|
|
71
|
+
processing_id, retries, created_at, updated_at, next_poll_at, accessed_at,
|
|
72
|
+
expired_at, coll_metadata)
|
|
73
|
+
select coll_id, coll_type, transform_id, request_id, workload_id, relation_type,
|
|
74
|
+
scope, name, bytes, status, substatus, locking, total_files, storage_id,
|
|
75
|
+
new_files, processed_files, processing_files, processing_id, retries,
|
|
76
|
+
created_at, updated_at, next_poll_at, accessed_at, expired_at,
|
|
77
|
+
coll_metadata
|
|
78
|
+
from {schema}.collections where request_id=i.request_id;
|
|
79
|
+
|
|
80
|
+
insert into {schema}.contents_archive(content_id, transform_id, coll_id, request_id,
|
|
81
|
+
workload_id, map_id, scope, name, min_id, max_id, content_type,
|
|
82
|
+
content_relation_type, status, substatus, locking, bytes, md5, adler32,
|
|
83
|
+
processing_id, storage_id, retries, path, created_at, updated_at,
|
|
84
|
+
accessed_at, expired_at, content_metadata)
|
|
85
|
+
select content_id, transform_id, coll_id, request_id, workload_id, map_id,
|
|
86
|
+
scope, name, min_id, max_id, content_type, content_relation_type,
|
|
87
|
+
status, substatus, locking, bytes, md5, adler32, processing_id,
|
|
88
|
+
storage_id, retries, path, created_at, updated_at, accessed_at,
|
|
89
|
+
expired_at, content_metadata
|
|
90
|
+
from {schema}.contents where request_id=i.request_id;
|
|
91
|
+
|
|
92
|
+
insert into {schema}.messages_archive(msg_id, msg_type, status, substatus, locking,
|
|
93
|
+
source, destination, request_id, workload_id, transform_id, processing_id,
|
|
94
|
+
num_contents, created_at, updated_at, msg_content)
|
|
95
|
+
select msg_id, msg_type, status, substatus, locking, source, destination,
|
|
96
|
+
request_id, workload_id, transform_id, processing_id, num_contents,
|
|
97
|
+
created_at, updated_at, msg_content
|
|
98
|
+
from {schema}.messages where request_id=i.request_id;
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
-- clean records
|
|
102
|
+
delete from {schema}.messages where request_id = i.request_id;
|
|
103
|
+
delete from {schema}.contents where request_id = i.request_id;
|
|
104
|
+
delete from {schema}.collections where request_id = i.request_id;
|
|
105
|
+
delete from {schema}.processings where request_id = i.request_id;
|
|
106
|
+
delete from {schema}.transforms where request_id = i.request_id;
|
|
107
|
+
delete from {schema}.requests where request_id = i.request_id;
|
|
108
|
+
END LOOP;
|
|
109
|
+
COMMIT;
|
|
110
|
+
END;
|
|
111
|
+
"""
|
|
112
|
+
sql = sql.format(schema=schema)
|
|
113
|
+
return sql
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def run_archive_sql(db_pool, schema):
|
|
117
|
+
connection = db_pool.acquire()
|
|
118
|
+
|
|
119
|
+
sql = get_archive_sql(schema)
|
|
120
|
+
# print(sql)
|
|
121
|
+
cursor = connection.cursor()
|
|
122
|
+
cursor.execute(sql)
|
|
123
|
+
cursor.close()
|
|
124
|
+
|
|
125
|
+
connection.commit()
|
|
126
|
+
db_pool.release(connection)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def get_session_pool():
|
|
130
|
+
sql_connection = config_get('database', 'default')
|
|
131
|
+
sql_connection = sql_connection.replace("oracle://", "")
|
|
132
|
+
user_pass, tns = sql_connection.split('@')
|
|
133
|
+
user, passwd = user_pass.split(':')
|
|
134
|
+
db_pool = cx_Oracle.SessionPool(user, passwd, tns, min=12, max=20, increment=1)
|
|
135
|
+
|
|
136
|
+
schema = config_get('database', 'schema')
|
|
137
|
+
return db_pool, schema
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def run_archive():
|
|
141
|
+
pool, schema = get_session_pool()
|
|
142
|
+
run_archive_sql(pool, schema)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if __name__ == '__main__':
|
|
146
|
+
run_archive()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
# http://www.apache.org/licenses/LICENSE-2.0OA
|
|
7
|
+
#
|
|
8
|
+
# Authors:
|
|
9
|
+
# - Wen Guan, <wen.guan@cern.ch>, 2019
|