panda-server-source 0.8.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.
- panda_server_source-0.8.0.dist-info/METADATA +55 -0
- panda_server_source-0.8.0.dist-info/RECORD +375 -0
- panda_server_source-0.8.0.dist-info/WHEEL +4 -0
- panda_server_source-0.8.0.dist-info/licenses/LICENSE.txt +202 -0
- pandajedi/__init__.py +0 -0
- pandajedi/jedibrokerage/AtlasAnalJobBroker.py +2343 -0
- pandajedi/jedibrokerage/AtlasBrokerUtils.py +1292 -0
- pandajedi/jedibrokerage/AtlasProdJobBroker.py +2064 -0
- pandajedi/jedibrokerage/AtlasProdTaskBroker.py +629 -0
- pandajedi/jedibrokerage/GenJobBroker.py +381 -0
- pandajedi/jedibrokerage/JobBrokerBase.py +133 -0
- pandajedi/jedibrokerage/TaskBrokerBase.py +15 -0
- pandajedi/jedibrokerage/__init__.py +0 -0
- pandajedi/jediconfig/__init__.py +0 -0
- pandajedi/jediconfig/jedi_config.py +40 -0
- pandajedi/jedicore/FactoryBase.py +182 -0
- pandajedi/jedicore/Interaction.py +433 -0
- pandajedi/jedicore/JediDBProxy.py +56 -0
- pandajedi/jedicore/JediDBProxyPool.py +37 -0
- pandajedi/jedicore/JediDBSchemaInfo.py +17 -0
- pandajedi/jedicore/JediException.py +13 -0
- pandajedi/jedicore/JediTaskBuffer.py +984 -0
- pandajedi/jedicore/JediTaskBufferInterface.py +50 -0
- pandajedi/jedicore/MsgWrapper.py +124 -0
- pandajedi/jedicore/ProcessUtils.py +34 -0
- pandajedi/jedicore/SiteCandidate.py +90 -0
- pandajedi/jedicore/ThreadUtils.py +205 -0
- pandajedi/jedicore/__init__.py +0 -0
- pandajedi/jediddm/AtlasDDMClient.py +1708 -0
- pandajedi/jediddm/DDMClientBase.py +16 -0
- pandajedi/jediddm/DDMInterface.py +83 -0
- pandajedi/jediddm/GenDDMClient.py +17 -0
- pandajedi/jediddm/__init__.py +0 -0
- pandajedi/jedidog/AtlasAnalWatchDog.py +648 -0
- pandajedi/jedidog/AtlasDataCarouselWatchDog.py +189 -0
- pandajedi/jedidog/AtlasDataLocalityUpdaterWatchDog.py +215 -0
- pandajedi/jedidog/AtlasProdWatchDog.py +443 -0
- pandajedi/jedidog/AtlasQueueFillerWatchDog.py +800 -0
- pandajedi/jedidog/AtlasTaskWithholderWatchDog.py +245 -0
- pandajedi/jedidog/AtlasWorkflowManagerWatchDog.py +63 -0
- pandajedi/jedidog/GenWatchDog.py +21 -0
- pandajedi/jedidog/JumboWatchDog.py +147 -0
- pandajedi/jedidog/TypicalWatchDogBase.py +122 -0
- pandajedi/jedidog/WatchDogBase.py +53 -0
- pandajedi/jedidog/__init__.py +0 -0
- pandajedi/jediexec/reniceJEDI.py +25 -0
- pandajedi/jedigen/AtlasTaskGenerator.py +110 -0
- pandajedi/jedigen/TaskGeneratorBase.py +15 -0
- pandajedi/jedigen/__init__.py +0 -0
- pandajedi/jedimsgprocessor/__init__.py +0 -0
- pandajedi/jedimsgprocessor/ai_parameter_adjuster_msg_processor +71 -0
- pandajedi/jedimsgprocessor/atlas_idds_msg_processor.py +66 -0
- pandajedi/jedimsgprocessor/base_msg_processor.py +33 -0
- pandajedi/jedimsgprocessor/forwarding_msg_processor.py +29 -0
- pandajedi/jedimsgprocessor/hpo_msg_processor.py +93 -0
- pandajedi/jedimsgprocessor/jedi_contents_feeder_msg_processor.py +63 -0
- pandajedi/jedimsgprocessor/jedi_job_generator_msg_processor.py +185 -0
- pandajedi/jedimsgprocessor/jedi_post_processor_msg_processor.py +82 -0
- pandajedi/jedimsgprocessor/kafka_msg_processor.py +44 -0
- pandajedi/jedimsgprocessor/panda_callback_msg_processor.py +182 -0
- pandajedi/jedimsgprocessor/panda_to_jedi_msg_processor.py +74 -0
- pandajedi/jedimsgprocessor/processing_msg_processor.py +134 -0
- pandajedi/jedimsgprocessor/status_report_msg_processor.py +129 -0
- pandajedi/jedimsgprocessor/tape_carousel_msg_processor.py +118 -0
- pandajedi/jedimsgprocessor/workflow_manager_msg_processor.py +89 -0
- pandajedi/jediorder/ContentsFeeder.py +785 -0
- pandajedi/jediorder/JediDaemon.py +27 -0
- pandajedi/jediorder/JediKnight.py +55 -0
- pandajedi/jediorder/JediMaster.py +238 -0
- pandajedi/jediorder/JediMsgProcessor.py +32 -0
- pandajedi/jediorder/JobBroker.py +33 -0
- pandajedi/jediorder/JobGenerator.py +2763 -0
- pandajedi/jediorder/JobSplitter.py +308 -0
- pandajedi/jediorder/JobThrottler.py +28 -0
- pandajedi/jediorder/PostProcessor.py +166 -0
- pandajedi/jediorder/TaskBroker.py +268 -0
- pandajedi/jediorder/TaskCommando.py +334 -0
- pandajedi/jediorder/TaskGenerator.py +17 -0
- pandajedi/jediorder/TaskRefiner.py +611 -0
- pandajedi/jediorder/TaskSetupper.py +17 -0
- pandajedi/jediorder/WatchDog.py +79 -0
- pandajedi/jediorder/__init__.py +0 -0
- pandajedi/jedipprocess/AtlasAnalPostProcessor.py +404 -0
- pandajedi/jedipprocess/AtlasPostProcessorUtils.py +50 -0
- pandajedi/jedipprocess/AtlasProdPostProcessor.py +178 -0
- pandajedi/jedipprocess/GenPostProcessor.py +35 -0
- pandajedi/jedipprocess/MailTemplates.py +185 -0
- pandajedi/jedipprocess/PostProcessorBase.py +269 -0
- pandajedi/jedipprocess/__init__.py +0 -0
- pandajedi/jedirefine/AtlasAnalTaskRefiner.py +259 -0
- pandajedi/jedirefine/AtlasProdTaskRefiner.py +162 -0
- pandajedi/jedirefine/GenTaskRefiner.py +61 -0
- pandajedi/jedirefine/RefinerUtils.py +154 -0
- pandajedi/jedirefine/TaskRefinerBase.py +996 -0
- pandajedi/jedirefine/__init__.py +0 -0
- pandajedi/jedisetup/AtlasTaskSetupper.py +309 -0
- pandajedi/jedisetup/GenTaskSetupper.py +16 -0
- pandajedi/jedisetup/SimpleTaskSetupper.py +152 -0
- pandajedi/jedisetup/TaskSetupperBase.py +15 -0
- pandajedi/jedisetup/__init__.py +0 -0
- pandajedi/jeditest/SchemaChecker.py +41 -0
- pandajedi/jeditest/addContWoSoTask.py +54 -0
- pandajedi/jeditest/addDataCarouselRequest.py +47 -0
- pandajedi/jeditest/addEventServiceTask.py +101 -0
- pandajedi/jeditest/addHpoTask.py +81 -0
- pandajedi/jeditest/addIDDSStageInRequest.py +56 -0
- pandajedi/jeditest/addNonAtlasTask.py +71 -0
- pandajedi/jeditest/addNonAtlasTaskEnc.py +64 -0
- pandajedi/jeditest/addTestTask.py +124 -0
- pandajedi/jeditest/addTestTaskParamToDEFT.py +70 -0
- pandajedi/jeditest/addTestTaskWithMerger.py +97 -0
- pandajedi/jeditest/brokerTest.py +78 -0
- pandajedi/jeditest/cancelDataCarouselRequest.py +35 -0
- pandajedi/jeditest/contentsFeederTest.py +28 -0
- pandajedi/jeditest/contentsFeederTestWithTask.py +18 -0
- pandajedi/jeditest/ddmTest.py +4 -0
- pandajedi/jeditest/jobGenForOneTask.py +38 -0
- pandajedi/jeditest/jobGeneratorTest.py +43 -0
- pandajedi/jeditest/jobSplitterTest.py +104 -0
- pandajedi/jeditest/jobThrottlerTest.py +22 -0
- pandajedi/jeditest/msgProcessorTest.py +9 -0
- pandajedi/jeditest/postProcessorTest.py +18 -0
- pandajedi/jeditest/resubmitDataCarouselRequest.py +35 -0
- pandajedi/jeditest/resubmitTaskParam.py +20 -0
- pandajedi/jeditest/taskBrokerTest.py +22 -0
- pandajedi/jeditest/taskBrokerTestWithTask.py +38 -0
- pandajedi/jeditest/taskBufferTest.py +5 -0
- pandajedi/jeditest/taskCommandoTest.py +28 -0
- pandajedi/jeditest/taskRefinerTest.py +30 -0
- pandajedi/jeditest/testOneTaskToRefine.py +49 -0
- pandajedi/jeditest/testOneTaskToTaskBroker.py +42 -0
- pandajedi/jeditest/testPandaDDMMap.py +62 -0
- pandajedi/jeditest/updateDataCarouselRequestParams.py +50 -0
- pandajedi/jeditest/watchDogTest.py +25 -0
- pandajedi/jeditest/workQueueTest.py +22 -0
- pandajedi/jedithrottle/AtlasAnalJobThrottler.py +19 -0
- pandajedi/jedithrottle/AtlasProdJobThrottler.py +18 -0
- pandajedi/jedithrottle/GenJobThrottler.py +26 -0
- pandajedi/jedithrottle/JobThrottlerBase.py +496 -0
- pandajedi/jedithrottle/__init__.py +0 -0
- pandaserver/__init__.py +0 -0
- pandaserver/api/__init__.py +0 -0
- pandaserver/api/v1/__init__.py +0 -0
- pandaserver/api/v1/common.py +339 -0
- pandaserver/api/v1/credential_management_api.py +372 -0
- pandaserver/api/v1/data_carousel_api.py +264 -0
- pandaserver/api/v1/event_api.py +269 -0
- pandaserver/api/v1/file_server_api.py +942 -0
- pandaserver/api/v1/harvester_api.py +445 -0
- pandaserver/api/v1/http_client.py +166 -0
- pandaserver/api/v1/idds_api.py +180 -0
- pandaserver/api/v1/job_api.py +463 -0
- pandaserver/api/v1/metaconfig_api.py +122 -0
- pandaserver/api/v1/pilot_api.py +895 -0
- pandaserver/api/v1/statistics_api.py +207 -0
- pandaserver/api/v1/system_api.py +186 -0
- pandaserver/api/v1/task_api.py +1520 -0
- pandaserver/api/v1/tests/__init__.py +0 -0
- pandaserver/api/v1/tests/credential_management_api_tests.py +116 -0
- pandaserver/api/v1/tests/data_carousel_api_tests.py +82 -0
- pandaserver/api/v1/tests/harvester_api_tests.py +188 -0
- pandaserver/api/v1/tests/idds_api_tests.py +45 -0
- pandaserver/api/v1/tests/job_api_tests.py +112 -0
- pandaserver/api/v1/tests/pilot_api_tests.py +154 -0
- pandaserver/api/v1/tests/statistics_api_tests.py +104 -0
- pandaserver/api/v1/tests/system_api_tests.py +58 -0
- pandaserver/api/v1/tests/task_api_tests.py +590 -0
- pandaserver/api/v1/version.py +2 -0
- pandaserver/api/v1/workflow_api.py +136 -0
- pandaserver/brokerage/SiteMapper.py +406 -0
- pandaserver/brokerage/__init__.py +0 -0
- pandaserver/brokerage/broker.py +272 -0
- pandaserver/config/__init__.py +0 -0
- pandaserver/config/config_utils.py +15 -0
- pandaserver/config/daemon_config.py +29 -0
- pandaserver/config/mcp_config.py +38 -0
- pandaserver/config/panda_config.py +233 -0
- pandaserver/configurator/Carbon.py +65 -0
- pandaserver/configurator/Configurator.py +908 -0
- pandaserver/configurator/__init__.py +0 -0
- pandaserver/configurator/aux.py +73 -0
- pandaserver/daemons/__init__.py +0 -0
- pandaserver/daemons/master.py +110 -0
- pandaserver/daemons/master_systemd.py +79 -0
- pandaserver/daemons/scripts/__init__.py +0 -0
- pandaserver/daemons/scripts/add_main.py +264 -0
- pandaserver/daemons/scripts/add_sub.py +221 -0
- pandaserver/daemons/scripts/cache_pilots.py +47 -0
- pandaserver/daemons/scripts/cache_schedconfig.py +286 -0
- pandaserver/daemons/scripts/carbon.py +50 -0
- pandaserver/daemons/scripts/configurator.py +94 -0
- pandaserver/daemons/scripts/copyArchive.py +1387 -0
- pandaserver/daemons/scripts/datasetManager.py +1154 -0
- pandaserver/daemons/scripts/dummy_test.py +25 -0
- pandaserver/daemons/scripts/evpPD2P.py +144 -0
- pandaserver/daemons/scripts/hs_scrapers.py +264 -0
- pandaserver/daemons/scripts/metric_collector.py +927 -0
- pandaserver/daemons/scripts/panda_activeusers_query.py +80 -0
- pandaserver/daemons/scripts/pilotStreaming.py +109 -0
- pandaserver/daemons/scripts/process_workflow_files_daemon.py +166 -0
- pandaserver/daemons/scripts/recover_lost_files_daemon.py +177 -0
- pandaserver/daemons/scripts/task_evaluator.py +405 -0
- pandaserver/daemons/scripts/tmpwatch.py +70 -0
- pandaserver/daemons/scripts/worker_synchronization.py +97 -0
- pandaserver/daemons/utils.py +753 -0
- pandaserver/dataservice/DataServiceUtils.py +323 -0
- pandaserver/dataservice/ErrorCode.py +25 -0
- pandaserver/dataservice/RecoverLostFilesCore.py +322 -0
- pandaserver/dataservice/__init__.py +0 -0
- pandaserver/dataservice/activator.py +79 -0
- pandaserver/dataservice/adder_atlas_plugin.py +1106 -0
- pandaserver/dataservice/adder_dummy_plugin.py +31 -0
- pandaserver/dataservice/adder_gen.py +954 -0
- pandaserver/dataservice/adder_plugin_base.py +27 -0
- pandaserver/dataservice/adder_result.py +75 -0
- pandaserver/dataservice/adder_simple_plugin.py +160 -0
- pandaserver/dataservice/closer.py +247 -0
- pandaserver/dataservice/closer_atlas_plugin.py +90 -0
- pandaserver/dataservice/ddm.py +1381 -0
- pandaserver/dataservice/ddm_handler.py +95 -0
- pandaserver/dataservice/dyn_data_distributer.py +824 -0
- pandaserver/dataservice/event_lookup_client_ei.py +77 -0
- pandaserver/dataservice/event_picker.py +268 -0
- pandaserver/dataservice/finisher.py +194 -0
- pandaserver/dataservice/setupper.py +225 -0
- pandaserver/dataservice/setupper_atlas_plugin.py +1851 -0
- pandaserver/dataservice/setupper_dummy_plugin.py +47 -0
- pandaserver/dataservice/setupper_plugin_base.py +67 -0
- pandaserver/jobdispatcher/DispatcherUtils.py +35 -0
- pandaserver/jobdispatcher/ErrorCode.py +19 -0
- pandaserver/jobdispatcher/JobDispatcher.py +1625 -0
- pandaserver/jobdispatcher/Protocol.py +443 -0
- pandaserver/jobdispatcher/Watcher.py +186 -0
- pandaserver/jobdispatcher/__init__.py +0 -0
- pandaserver/pandamcp/__init__.py +0 -0
- pandaserver/pandamcp/mcp_main.py +56 -0
- pandaserver/pandamcp/mcp_test_client.py +95 -0
- pandaserver/pandamcp/mcp_utils.py +74 -0
- pandaserver/proxycache/__init__.py +0 -0
- pandaserver/proxycache/panda_proxy_cache.py +240 -0
- pandaserver/proxycache/token_cache.py +141 -0
- pandaserver/server/.gacl +6 -0
- pandaserver/server/panda.py +539 -0
- pandaserver/srvcore/CoreUtils.py +572 -0
- pandaserver/srvcore/MailUtils.py +106 -0
- pandaserver/srvcore/__init__.py +0 -0
- pandaserver/srvcore/allowed_methods.py +100 -0
- pandaserver/srvcore/oidc_utils.py +152 -0
- pandaserver/srvcore/panda_request.py +196 -0
- pandaserver/srvcore/srv_msg_utils.py +42 -0
- pandaserver/taskbuffer/ConBridge.py +513 -0
- pandaserver/taskbuffer/DBProxyPool.py +95 -0
- pandaserver/taskbuffer/DataCarousel.py +3053 -0
- pandaserver/taskbuffer/DatasetSpec.py +137 -0
- pandaserver/taskbuffer/DdmSpec.py +201 -0
- pandaserver/taskbuffer/ErrorCode.py +87 -0
- pandaserver/taskbuffer/EventServiceUtils.py +396 -0
- pandaserver/taskbuffer/FileSpec.py +290 -0
- pandaserver/taskbuffer/GlobalShares.py +244 -0
- pandaserver/taskbuffer/HarvesterMetricsSpec.py +92 -0
- pandaserver/taskbuffer/Initializer.py +82 -0
- pandaserver/taskbuffer/InputChunk.py +1080 -0
- pandaserver/taskbuffer/JediCacheSpec.py +57 -0
- pandaserver/taskbuffer/JediDatasetSpec.py +588 -0
- pandaserver/taskbuffer/JediFileSpec.py +242 -0
- pandaserver/taskbuffer/JediTaskSpec.py +1687 -0
- pandaserver/taskbuffer/JobSpec.py +1006 -0
- pandaserver/taskbuffer/JobUtils.py +232 -0
- pandaserver/taskbuffer/NucleusSpec.py +116 -0
- pandaserver/taskbuffer/OraDBProxy.py +174 -0
- pandaserver/taskbuffer/PanDAMsgProcessor.py +8 -0
- pandaserver/taskbuffer/PandaDBSchemaInfo.py +18 -0
- pandaserver/taskbuffer/ParseJobXML.py +350 -0
- pandaserver/taskbuffer/PickleFileSpec.py +18 -0
- pandaserver/taskbuffer/PickleJobSpec.py +25 -0
- pandaserver/taskbuffer/PrioUtil.py +40 -0
- pandaserver/taskbuffer/ProcessGroups.py +111 -0
- pandaserver/taskbuffer/ResourceSpec.py +175 -0
- pandaserver/taskbuffer/SQLDumper.py +37 -0
- pandaserver/taskbuffer/SQLManager.py +60 -0
- pandaserver/taskbuffer/SiteSpec.py +304 -0
- pandaserver/taskbuffer/SupErrors.py +10 -0
- pandaserver/taskbuffer/TaskBuffer.py +2882 -0
- pandaserver/taskbuffer/TaskBufferInterface.py +163 -0
- pandaserver/taskbuffer/Utils.py +848 -0
- pandaserver/taskbuffer/WorkQueue.py +227 -0
- pandaserver/taskbuffer/WorkQueueMapper.py +203 -0
- pandaserver/taskbuffer/WorkerSpec.py +143 -0
- pandaserver/taskbuffer/WrappedCursor.py +487 -0
- pandaserver/taskbuffer/WrappedPickle.py +88 -0
- pandaserver/taskbuffer/WrappedPostgresConn.py +24 -0
- pandaserver/taskbuffer/__init__.py +0 -0
- pandaserver/taskbuffer/db_proxy_mods/OraDBProxy_structure.png +0 -0
- pandaserver/taskbuffer/db_proxy_mods/__init__.py +7 -0
- pandaserver/taskbuffer/db_proxy_mods/base_module.py +841 -0
- pandaserver/taskbuffer/db_proxy_mods/data_carousel_module.py +772 -0
- pandaserver/taskbuffer/db_proxy_mods/entity_module.py +3804 -0
- pandaserver/taskbuffer/db_proxy_mods/job_complex_module.py +5661 -0
- pandaserver/taskbuffer/db_proxy_mods/job_standalone_module.py +2640 -0
- pandaserver/taskbuffer/db_proxy_mods/metrics_module.py +874 -0
- pandaserver/taskbuffer/db_proxy_mods/misc_standalone_module.py +4272 -0
- pandaserver/taskbuffer/db_proxy_mods/task_complex_module.py +6172 -0
- pandaserver/taskbuffer/db_proxy_mods/task_event_module.py +4953 -0
- pandaserver/taskbuffer/db_proxy_mods/task_standalone_module.py +4999 -0
- pandaserver/taskbuffer/db_proxy_mods/task_utils_module.py +2063 -0
- pandaserver/taskbuffer/db_proxy_mods/worker_module.py +1944 -0
- pandaserver/taskbuffer/db_proxy_mods/workflow_module.py +832 -0
- pandaserver/taskbuffer/retryModule.py +552 -0
- pandaserver/taskbuffer/task_split_rules.py +308 -0
- pandaserver/taskbuffer/workflow_processor.py +249 -0
- pandaserver/taskbuffer/wrapped_oracle_conn.py +18 -0
- pandaserver/test/SchemaChecker.py +40 -0
- pandaserver/test/__init__.py +0 -0
- pandaserver/test/banUser.py +43 -0
- pandaserver/test/boostPrio.py +19 -0
- pandaserver/test/boostUser.py +35 -0
- pandaserver/test/callbackDDM.py +11 -0
- pandaserver/test/daod_on_demand.py +95 -0
- pandaserver/test/finishJob.py +184 -0
- pandaserver/test/finishTaskJEDI.py +11 -0
- pandaserver/test/getJobs.py +53 -0
- pandaserver/test/killJob.py +79 -0
- pandaserver/test/killJobLowPrio.py +99 -0
- pandaserver/test/killJobsInTask.py +56 -0
- pandaserver/test/killTask.py +80 -0
- pandaserver/test/killTaskJEDI.py +11 -0
- pandaserver/test/killUser.py +83 -0
- pandaserver/test/lsst/README.txt +7 -0
- pandaserver/test/lsst/lsstSubmit.py +139 -0
- pandaserver/test/lsst/lsstSubmitMERGEtest.py +141 -0
- pandaserver/test/lsst/lsstSubmitPhosim332.py +53 -0
- pandaserver/test/lsst/prepare-client-tarball-from-bigpanda-server.sh +41 -0
- pandaserver/test/reassignJobs.py +17 -0
- pandaserver/test/reassignSite.py +82 -0
- pandaserver/test/reassignTask.py +117 -0
- pandaserver/test/reassignWaiting.py +39 -0
- pandaserver/test/recoverLostFiles.py +7 -0
- pandaserver/test/reloadInputDS.py +51 -0
- pandaserver/test/sendCommandToJob.py +26 -0
- pandaserver/test/setDebugMode.py +38 -0
- pandaserver/test/setPriority.py +28 -0
- pandaserver/test/testEvgen.py +60 -0
- pandaserver/test/testEvgen17.py +58 -0
- pandaserver/test/testG4sim.py +81 -0
- pandaserver/test/testG4sim17.py +90 -0
- pandaserver/test/testGlobalShares.py +131 -0
- pandaserver/test/testReco.py +103 -0
- pandaserver/test/testSimulReco14.py +98 -0
- pandaserver/test/testSiteMap.py +26 -0
- pandaserver/test/testUpdateWorkerPilotStatus.py +9 -0
- pandaserver/userinterface/Client.py +1686 -0
- pandaserver/userinterface/UserIF.py +1799 -0
- pandaserver/userinterface/__init__.py +0 -0
- pandaserver/workflow/__init__.py +0 -0
- pandaserver/workflow/data_handler_plugins/base_data_handler.py +48 -0
- pandaserver/workflow/data_handler_plugins/ddm_collection_data_handler.py +100 -0
- pandaserver/workflow/data_handler_plugins/panda_task_data_handler.py +140 -0
- pandaserver/workflow/pcwl_test.py +122 -0
- pandaserver/workflow/pcwl_utils.py +384 -0
- pandaserver/workflow/psnakemake_container.json +68 -0
- pandaserver/workflow/psnakemake_task.json +62 -0
- pandaserver/workflow/psnakemake_test.py +60 -0
- pandaserver/workflow/snakeparser/__init__.py +3 -0
- pandaserver/workflow/snakeparser/extensions.py +74 -0
- pandaserver/workflow/snakeparser/log.py +53 -0
- pandaserver/workflow/snakeparser/names.py +3 -0
- pandaserver/workflow/snakeparser/parser.py +332 -0
- pandaserver/workflow/snakeparser/utils.py +29 -0
- pandaserver/workflow/step_handler_plugins/base_step_handler.py +85 -0
- pandaserver/workflow/step_handler_plugins/panda_task_step_handler.py +280 -0
- pandaserver/workflow/workflow_base.py +531 -0
- pandaserver/workflow/workflow_core.py +1974 -0
- pandaserver/workflow/workflow_core_smoketest.py +388 -0
- pandaserver/workflow/workflow_parser.py +222 -0
- pandaserver/workflow/workflow_utils.py +1047 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
from pandacommon.pandalogger.LogWrapper import LogWrapper
|
|
4
|
+
from pandacommon.pandalogger.PandaLogger import PandaLogger
|
|
5
|
+
from pandacommon.pandautils.thread_utils import GenericThread
|
|
6
|
+
|
|
7
|
+
from pandaserver.config import panda_config
|
|
8
|
+
from pandaserver.proxycache import panda_proxy_cache, token_cache
|
|
9
|
+
from pandaserver.srvcore import CoreUtils
|
|
10
|
+
|
|
11
|
+
# logger
|
|
12
|
+
_logger = PandaLogger().getLogger("activeusers_query")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# main
|
|
16
|
+
def main(tbuf=None, **kwargs):
|
|
17
|
+
# logger
|
|
18
|
+
tmpLog = LogWrapper(_logger)
|
|
19
|
+
requester_id = GenericThread().get_full_id(__name__, sys.modules[__name__].__file__)
|
|
20
|
+
|
|
21
|
+
tmpLog.debug("================= start ==================")
|
|
22
|
+
# instantiate TB
|
|
23
|
+
if tbuf is None:
|
|
24
|
+
tmpLog.debug("Getting new connection")
|
|
25
|
+
from pandaserver.taskbuffer.TaskBuffer import taskBuffer
|
|
26
|
+
|
|
27
|
+
taskBuffer.init(
|
|
28
|
+
panda_config.dbhost,
|
|
29
|
+
panda_config.dbpasswd,
|
|
30
|
+
nDBConnection=1,
|
|
31
|
+
useTimeout=True,
|
|
32
|
+
requester=requester_id,
|
|
33
|
+
)
|
|
34
|
+
tmpLog.debug("Getting new connection - done")
|
|
35
|
+
else:
|
|
36
|
+
tmpLog.debug("Reusing connection")
|
|
37
|
+
taskBuffer = tbuf
|
|
38
|
+
|
|
39
|
+
# instantiate MyProxy I/F
|
|
40
|
+
my_proxy_interface_instance = panda_proxy_cache.MyProxyInterface()
|
|
41
|
+
|
|
42
|
+
# roles
|
|
43
|
+
if hasattr(panda_config, "proxy_cache_roles"):
|
|
44
|
+
roles = panda_config.proxy_cache_roles.split(",")
|
|
45
|
+
else:
|
|
46
|
+
roles = ["atlas", "atlas:/atlas/Role=production", "atlas:/atlas/Role=pilot"]
|
|
47
|
+
|
|
48
|
+
# get users
|
|
49
|
+
sql = "select distinct DN FROM ATLAS_PANDAMETA.users WHERE GRIDPREF LIKE :patt"
|
|
50
|
+
varMap = {}
|
|
51
|
+
varMap[":patt"] = "%p%"
|
|
52
|
+
tmpLog.debug("Querying users")
|
|
53
|
+
tmpStat, tmpRes = taskBuffer.querySQLS(sql, varMap)
|
|
54
|
+
tmpLog.debug("Querying done")
|
|
55
|
+
for (realDN,) in tmpRes:
|
|
56
|
+
if realDN is None:
|
|
57
|
+
continue
|
|
58
|
+
realDN = CoreUtils.get_bare_dn(realDN, keep_digits=False)
|
|
59
|
+
name = CoreUtils.clean_user_id(realDN)
|
|
60
|
+
# check proxy
|
|
61
|
+
tmpLog.debug(f"check proxy cache for {name}")
|
|
62
|
+
for role in roles:
|
|
63
|
+
my_proxy_interface_instance.checkProxy(realDN, role=role, name=name)
|
|
64
|
+
|
|
65
|
+
# instantiate Token Cache
|
|
66
|
+
tmpLog.debug("Token Cache start")
|
|
67
|
+
token_cacher = token_cache.TokenCache(task_buffer=taskBuffer)
|
|
68
|
+
token_cacher.run()
|
|
69
|
+
tmpLog.debug("Token Cache done")
|
|
70
|
+
|
|
71
|
+
# stop taskBuffer if created inside this script
|
|
72
|
+
if tbuf is None:
|
|
73
|
+
taskBuffer.cleanup(requester=requester_id)
|
|
74
|
+
tmpLog.debug("Stopped the new connection")
|
|
75
|
+
tmpLog.debug("done")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# run
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
main()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import time
|
|
3
|
+
import traceback
|
|
4
|
+
|
|
5
|
+
from pandacommon.pandalogger.PandaLogger import PandaLogger
|
|
6
|
+
from pandacommon.pandautils.thread_utils import GenericThread
|
|
7
|
+
|
|
8
|
+
from pandaserver.config import panda_config
|
|
9
|
+
|
|
10
|
+
_logger = PandaLogger().getLogger("pilot_streaming")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PilotStreaming(object):
|
|
14
|
+
def __init__(self, tbuf):
|
|
15
|
+
self._logger = _logger
|
|
16
|
+
self.tbuf = tbuf
|
|
17
|
+
return
|
|
18
|
+
|
|
19
|
+
def run(self):
|
|
20
|
+
"""
|
|
21
|
+
Gets and iterates over ups queues, deciding the job requirements and sending these to Harvester
|
|
22
|
+
via the command interface
|
|
23
|
+
:return:
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# timing
|
|
27
|
+
time_start = time.time()
|
|
28
|
+
self._logger.debug("Start.")
|
|
29
|
+
|
|
30
|
+
# get unified pilot streaming (ups) queues
|
|
31
|
+
ups_queues = self.tbuf.ups_get_queues()
|
|
32
|
+
self._logger.debug(f"UPS queues: {ups_queues}")
|
|
33
|
+
|
|
34
|
+
# load the worker stats from the database
|
|
35
|
+
worker_stats = self.tbuf.ups_load_worker_stats()
|
|
36
|
+
|
|
37
|
+
# iterate over the UPS queues
|
|
38
|
+
for ups_queue in ups_queues:
|
|
39
|
+
# separate the worker and job stats for the queue
|
|
40
|
+
try:
|
|
41
|
+
tmp_worker_stats = worker_stats[ups_queue]
|
|
42
|
+
self._logger.debug(f"worker_stats for queue {ups_queue}: {tmp_worker_stats}")
|
|
43
|
+
except KeyError:
|
|
44
|
+
# skip queue if no data available
|
|
45
|
+
self._logger.debug(f"No worker stats for queue {ups_queue}")
|
|
46
|
+
continue
|
|
47
|
+
|
|
48
|
+
# calculate the new worker distribution and save the harvester commands in the database
|
|
49
|
+
try:
|
|
50
|
+
new_workers_per_harvester = self.tbuf.ups_new_worker_distribution(ups_queue, tmp_worker_stats)
|
|
51
|
+
self._logger.info(f"queue: {ups_queue}, results: {new_workers_per_harvester}")
|
|
52
|
+
|
|
53
|
+
# variables for the harvester command
|
|
54
|
+
command = f"SET_N_WORKERS_JOBTYPE:{ups_queue}"
|
|
55
|
+
status = "new"
|
|
56
|
+
ack_requested = False
|
|
57
|
+
lock_interval = None
|
|
58
|
+
com_interval = None
|
|
59
|
+
|
|
60
|
+
for harvester_id in new_workers_per_harvester:
|
|
61
|
+
params = new_workers_per_harvester[harvester_id]
|
|
62
|
+
self.tbuf.commandToHarvester(
|
|
63
|
+
harvester_id,
|
|
64
|
+
command,
|
|
65
|
+
ack_requested,
|
|
66
|
+
status,
|
|
67
|
+
lock_interval,
|
|
68
|
+
com_interval,
|
|
69
|
+
params,
|
|
70
|
+
)
|
|
71
|
+
except Exception:
|
|
72
|
+
self._logger.error(traceback.format_exc())
|
|
73
|
+
|
|
74
|
+
# log the timing
|
|
75
|
+
time_stop = time.time()
|
|
76
|
+
self._logger.debug(f"Done. Pilot streaming took: {time_stop - time_start} s")
|
|
77
|
+
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# main
|
|
82
|
+
def main(tbuf=None, **kwargs):
|
|
83
|
+
requester_id = GenericThread().get_full_id(__name__, sys.modules[__name__].__file__)
|
|
84
|
+
|
|
85
|
+
# instantiate TB
|
|
86
|
+
if tbuf is None:
|
|
87
|
+
from pandaserver.taskbuffer.TaskBuffer import taskBuffer
|
|
88
|
+
|
|
89
|
+
taskBuffer.init(
|
|
90
|
+
panda_config.dbhost,
|
|
91
|
+
panda_config.dbpasswd,
|
|
92
|
+
nDBConnection=1,
|
|
93
|
+
useTimeout=True,
|
|
94
|
+
requester=requester_id,
|
|
95
|
+
)
|
|
96
|
+
else:
|
|
97
|
+
taskBuffer = tbuf
|
|
98
|
+
|
|
99
|
+
# run the pilot streaming logic
|
|
100
|
+
PilotStreaming(tbuf=taskBuffer).run()
|
|
101
|
+
|
|
102
|
+
# stop the taskBuffer if it was created inside this script
|
|
103
|
+
if tbuf is None:
|
|
104
|
+
taskBuffer.cleanup(requester=requester_id)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# run
|
|
108
|
+
if __name__ == "__main__":
|
|
109
|
+
main()
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import glob
|
|
3
|
+
import os.path
|
|
4
|
+
import sys
|
|
5
|
+
import threading
|
|
6
|
+
import time
|
|
7
|
+
import traceback
|
|
8
|
+
|
|
9
|
+
from pandacommon.pandalogger.PandaLogger import PandaLogger
|
|
10
|
+
from pandacommon.pandautils.PandaUtils import naive_utcnow
|
|
11
|
+
from pandacommon.pandautils.thread_utils import GenericThread
|
|
12
|
+
|
|
13
|
+
from pandaserver.config import panda_config
|
|
14
|
+
from pandaserver.taskbuffer.workflow_processor import WorkflowProcessor
|
|
15
|
+
|
|
16
|
+
# logger
|
|
17
|
+
_logger = PandaLogger().getLogger("process_workflow_files")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# main
|
|
21
|
+
def main(tbuf=None, **kwargs):
|
|
22
|
+
_logger.debug("===================== start =====================")
|
|
23
|
+
|
|
24
|
+
# overall timeout value
|
|
25
|
+
overallTimeout = 300
|
|
26
|
+
# prefix of the files
|
|
27
|
+
if "target" in kwargs and kwargs["target"]:
|
|
28
|
+
evpFilePatt = kwargs["target"]
|
|
29
|
+
else:
|
|
30
|
+
prefixEVP = "/workflow."
|
|
31
|
+
# file pattern of evp files
|
|
32
|
+
evpFilePatt = panda_config.cache_dir + "/" + prefixEVP + "*"
|
|
33
|
+
|
|
34
|
+
from pandaserver.taskbuffer.TaskBuffer import taskBuffer
|
|
35
|
+
|
|
36
|
+
requester_id = GenericThread().get_full_id(__name__, sys.modules[__name__].__file__)
|
|
37
|
+
taskBuffer.init(
|
|
38
|
+
panda_config.dbhost,
|
|
39
|
+
panda_config.dbpasswd,
|
|
40
|
+
nDBConnection=1,
|
|
41
|
+
useTimeout=True,
|
|
42
|
+
requester=requester_id,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
test_mode = kwargs.get("test_mode", False)
|
|
46
|
+
dump_workflow = kwargs.get("dump_workflow", False)
|
|
47
|
+
|
|
48
|
+
# thread pool
|
|
49
|
+
class ThreadPool:
|
|
50
|
+
def __init__(self):
|
|
51
|
+
self.lock = threading.Lock()
|
|
52
|
+
self.list = []
|
|
53
|
+
|
|
54
|
+
def add(self, obj):
|
|
55
|
+
self.lock.acquire()
|
|
56
|
+
self.list.append(obj)
|
|
57
|
+
self.lock.release()
|
|
58
|
+
|
|
59
|
+
def remove(self, obj):
|
|
60
|
+
self.lock.acquire()
|
|
61
|
+
self.list.remove(obj)
|
|
62
|
+
self.lock.release()
|
|
63
|
+
|
|
64
|
+
def join(self):
|
|
65
|
+
self.lock.acquire()
|
|
66
|
+
thrlist = tuple(self.list)
|
|
67
|
+
self.lock.release()
|
|
68
|
+
for thr in thrlist:
|
|
69
|
+
thr.join()
|
|
70
|
+
|
|
71
|
+
# thread
|
|
72
|
+
class EvpThr(threading.Thread):
|
|
73
|
+
def __init__(self, task_buffer, lock, pool, file_name, to_delete, get_log):
|
|
74
|
+
threading.Thread.__init__(self)
|
|
75
|
+
self.lock = lock
|
|
76
|
+
self.pool = pool
|
|
77
|
+
self.fileName = file_name
|
|
78
|
+
self.to_delete = to_delete
|
|
79
|
+
self.get_log = get_log
|
|
80
|
+
self.pool.add(self)
|
|
81
|
+
self.processor = WorkflowProcessor(task_buffer=task_buffer, log_stream=_logger)
|
|
82
|
+
|
|
83
|
+
def run(self):
|
|
84
|
+
self.lock.acquire()
|
|
85
|
+
try:
|
|
86
|
+
self.processor.process(
|
|
87
|
+
self.fileName,
|
|
88
|
+
self.to_delete,
|
|
89
|
+
test_mode,
|
|
90
|
+
self.get_log,
|
|
91
|
+
dump_workflow,
|
|
92
|
+
)
|
|
93
|
+
except Exception as e:
|
|
94
|
+
_logger.error(f"{str(e)} {traceback.format_exc()}")
|
|
95
|
+
self.pool.remove(self)
|
|
96
|
+
self.lock.release()
|
|
97
|
+
|
|
98
|
+
# get files
|
|
99
|
+
timeNow = naive_utcnow()
|
|
100
|
+
timeInt = naive_utcnow()
|
|
101
|
+
fileList = sorted(glob.glob(evpFilePatt))
|
|
102
|
+
|
|
103
|
+
# create thread pool and semaphore
|
|
104
|
+
adderLock = threading.Semaphore(1)
|
|
105
|
+
adderThreadPool = ThreadPool()
|
|
106
|
+
|
|
107
|
+
# add
|
|
108
|
+
while len(fileList) != 0:
|
|
109
|
+
# time limit to aviod too many copyArchve running at the sametime
|
|
110
|
+
if (naive_utcnow() - timeNow) > datetime.timedelta(minutes=overallTimeout):
|
|
111
|
+
_logger.debug("time over in main session")
|
|
112
|
+
break
|
|
113
|
+
# try to get Semaphore
|
|
114
|
+
adderLock.acquire()
|
|
115
|
+
# get fileList
|
|
116
|
+
if (naive_utcnow() - timeInt) > datetime.timedelta(minutes=15):
|
|
117
|
+
timeInt = naive_utcnow()
|
|
118
|
+
# get file
|
|
119
|
+
fileList = sorted(glob.glob(evpFilePatt))
|
|
120
|
+
# choose a file
|
|
121
|
+
fileName = fileList.pop(0)
|
|
122
|
+
# release lock
|
|
123
|
+
adderLock.release()
|
|
124
|
+
if not os.path.exists(fileName):
|
|
125
|
+
continue
|
|
126
|
+
try:
|
|
127
|
+
modTime = datetime.datetime(*(time.gmtime(os.path.getmtime(fileName))[:7]))
|
|
128
|
+
to_go = True
|
|
129
|
+
if test_mode:
|
|
130
|
+
_logger.debug(f"Testing : {fileName}")
|
|
131
|
+
to_delete = False
|
|
132
|
+
elif (timeNow - modTime) > datetime.timedelta(hours=2):
|
|
133
|
+
# last chance
|
|
134
|
+
_logger.debug(f"Last attempt : {fileName}")
|
|
135
|
+
to_delete = True
|
|
136
|
+
elif (timeInt - modTime) > datetime.timedelta(seconds=5):
|
|
137
|
+
# try
|
|
138
|
+
_logger.debug(f"Normal attempt : {fileName}")
|
|
139
|
+
to_delete = False
|
|
140
|
+
else:
|
|
141
|
+
_logger.debug(f"Wait {timeInt - modTime} : {fileName}")
|
|
142
|
+
to_go = False
|
|
143
|
+
if to_go:
|
|
144
|
+
thr = EvpThr(taskBuffer, adderLock, adderThreadPool, fileName, to_delete, False)
|
|
145
|
+
thr.start()
|
|
146
|
+
except Exception as e:
|
|
147
|
+
_logger.error(f"{str(e)} {traceback.format_exc()}")
|
|
148
|
+
|
|
149
|
+
# join all threads
|
|
150
|
+
adderThreadPool.join()
|
|
151
|
+
|
|
152
|
+
# stop taskBuffer if created inside this script
|
|
153
|
+
taskBuffer.cleanup(requester=requester_id)
|
|
154
|
+
|
|
155
|
+
_logger.debug("===================== end =====================")
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# run
|
|
159
|
+
if __name__ == "__main__":
|
|
160
|
+
import sys
|
|
161
|
+
|
|
162
|
+
if len(sys.argv) > 1:
|
|
163
|
+
data = {"target": sys.argv[1], "test_mode": True, "dump_workflow": True}
|
|
164
|
+
else:
|
|
165
|
+
data = {}
|
|
166
|
+
main(**data)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
import fcntl
|
|
3
|
+
import glob
|
|
4
|
+
import json
|
|
5
|
+
import os.path
|
|
6
|
+
import sys
|
|
7
|
+
import threading
|
|
8
|
+
import time
|
|
9
|
+
import traceback
|
|
10
|
+
|
|
11
|
+
from pandacommon.pandalogger.LogWrapper import LogWrapper
|
|
12
|
+
from pandacommon.pandalogger.PandaLogger import PandaLogger
|
|
13
|
+
from pandacommon.pandautils.PandaUtils import naive_utcnow
|
|
14
|
+
from pandacommon.pandautils.thread_utils import GenericThread
|
|
15
|
+
|
|
16
|
+
from pandaserver.config import panda_config
|
|
17
|
+
from pandaserver.dataservice import RecoverLostFilesCore
|
|
18
|
+
|
|
19
|
+
# logger
|
|
20
|
+
_logger = PandaLogger().getLogger("recover_lost_files")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# main
|
|
24
|
+
def main(tbuf=None, **kwargs):
|
|
25
|
+
_logger.debug("===================== start =====================")
|
|
26
|
+
|
|
27
|
+
# overall timeout value
|
|
28
|
+
overallTimeout = 300
|
|
29
|
+
# prefix of the files
|
|
30
|
+
prefixEVP = "recov."
|
|
31
|
+
# file pattern of evp files
|
|
32
|
+
evpFilePatt = panda_config.cache_dir + "/" + prefixEVP + "*"
|
|
33
|
+
|
|
34
|
+
from pandaserver.taskbuffer.TaskBuffer import taskBuffer
|
|
35
|
+
|
|
36
|
+
requester_id = GenericThread().get_full_id(__name__, sys.modules[__name__].__file__)
|
|
37
|
+
taskBuffer.init(
|
|
38
|
+
panda_config.dbhost,
|
|
39
|
+
panda_config.dbpasswd,
|
|
40
|
+
nDBConnection=1,
|
|
41
|
+
useTimeout=True,
|
|
42
|
+
requester=requester_id,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# thread pool
|
|
46
|
+
class ThreadPool:
|
|
47
|
+
def __init__(self):
|
|
48
|
+
self.lock = threading.Lock()
|
|
49
|
+
self.list = []
|
|
50
|
+
|
|
51
|
+
def add(self, obj):
|
|
52
|
+
self.lock.acquire()
|
|
53
|
+
self.list.append(obj)
|
|
54
|
+
self.lock.release()
|
|
55
|
+
|
|
56
|
+
def remove(self, obj):
|
|
57
|
+
self.lock.acquire()
|
|
58
|
+
self.list.remove(obj)
|
|
59
|
+
self.lock.release()
|
|
60
|
+
|
|
61
|
+
def join(self):
|
|
62
|
+
self.lock.acquire()
|
|
63
|
+
thrlist = tuple(self.list)
|
|
64
|
+
self.lock.release()
|
|
65
|
+
for thr in thrlist:
|
|
66
|
+
thr.join()
|
|
67
|
+
|
|
68
|
+
# thread to ev-pd2p
|
|
69
|
+
class EvpThr(threading.Thread):
|
|
70
|
+
def __init__(self, lock, pool, tb_if, file_name, to_delete):
|
|
71
|
+
threading.Thread.__init__(self)
|
|
72
|
+
self.lock = lock
|
|
73
|
+
self.pool = pool
|
|
74
|
+
self.fileName = file_name
|
|
75
|
+
self.to_delete = to_delete
|
|
76
|
+
self.taskBuffer = tb_if
|
|
77
|
+
self.pool.add(self)
|
|
78
|
+
|
|
79
|
+
def run(self):
|
|
80
|
+
base_log = LogWrapper(_logger, self.fileName)
|
|
81
|
+
base_log.debug("start processing")
|
|
82
|
+
self.lock.acquire()
|
|
83
|
+
try:
|
|
84
|
+
with open(self.fileName) as f:
|
|
85
|
+
try:
|
|
86
|
+
# acquire an exclusive file lock
|
|
87
|
+
fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
|
88
|
+
base_log.debug("file lock acquired")
|
|
89
|
+
ops = json.load(f)
|
|
90
|
+
tag = ops.get("jediTaskID")
|
|
91
|
+
if tag:
|
|
92
|
+
tag = f"< jediTaskID={tag} >"
|
|
93
|
+
else:
|
|
94
|
+
tag = ops.get("dataset")
|
|
95
|
+
tag = f"< dataset={tag} >"
|
|
96
|
+
tmp_log = LogWrapper(_logger, tag)
|
|
97
|
+
tmp_log.info(f"start {self.fileName}")
|
|
98
|
+
s, o = RecoverLostFilesCore.main(self.taskBuffer, ops, tmp_log)
|
|
99
|
+
tmp_log.info(f"status={s}. {o}")
|
|
100
|
+
if s is not None or self.to_delete:
|
|
101
|
+
tmp_log.debug(f"delete {self.fileName}")
|
|
102
|
+
try:
|
|
103
|
+
os.remove(self.fileName)
|
|
104
|
+
except Exception:
|
|
105
|
+
pass
|
|
106
|
+
finally:
|
|
107
|
+
# release the file lock
|
|
108
|
+
base_log.debug("release file lock")
|
|
109
|
+
try:
|
|
110
|
+
fcntl.flock(f, fcntl.LOCK_EX)
|
|
111
|
+
except Exception:
|
|
112
|
+
pass
|
|
113
|
+
except FileNotFoundError:
|
|
114
|
+
pass
|
|
115
|
+
except Exception as e:
|
|
116
|
+
base_log.error(f"process failure with {str(e)} {traceback.format_exc()}")
|
|
117
|
+
self.pool.remove(self)
|
|
118
|
+
self.lock.release()
|
|
119
|
+
base_log.debug("end processing")
|
|
120
|
+
|
|
121
|
+
# get files
|
|
122
|
+
timeNow = naive_utcnow()
|
|
123
|
+
timeInt = naive_utcnow()
|
|
124
|
+
fileList = sorted(glob.glob(evpFilePatt))
|
|
125
|
+
|
|
126
|
+
# create thread pool and semaphore
|
|
127
|
+
adderLock = threading.Semaphore(1)
|
|
128
|
+
adderThreadPool = ThreadPool()
|
|
129
|
+
|
|
130
|
+
# add
|
|
131
|
+
while len(fileList) != 0:
|
|
132
|
+
# time limit to aviod too many copyArchve running at the sametime
|
|
133
|
+
if (naive_utcnow() - timeNow) > datetime.timedelta(minutes=overallTimeout):
|
|
134
|
+
_logger.debug("time over in main session")
|
|
135
|
+
break
|
|
136
|
+
# try to get Semaphore
|
|
137
|
+
adderLock.acquire()
|
|
138
|
+
# get fileList
|
|
139
|
+
if (naive_utcnow() - timeInt) > datetime.timedelta(minutes=15):
|
|
140
|
+
timeInt = naive_utcnow()
|
|
141
|
+
# get file
|
|
142
|
+
fileList = sorted(glob.glob(evpFilePatt))
|
|
143
|
+
# choose a file
|
|
144
|
+
fileName = fileList.pop(0)
|
|
145
|
+
# release lock
|
|
146
|
+
adderLock.release()
|
|
147
|
+
if not os.path.exists(fileName):
|
|
148
|
+
continue
|
|
149
|
+
try:
|
|
150
|
+
modTime = datetime.datetime(*(time.gmtime(os.path.getmtime(fileName))[:7]))
|
|
151
|
+
if (timeNow - modTime) > datetime.timedelta(hours=2):
|
|
152
|
+
# last chance
|
|
153
|
+
_logger.debug(f"Last attempt : {fileName}")
|
|
154
|
+
thr = EvpThr(adderLock, adderThreadPool, taskBuffer, fileName, False)
|
|
155
|
+
thr.start()
|
|
156
|
+
elif (timeInt - modTime) > datetime.timedelta(seconds=5):
|
|
157
|
+
# try
|
|
158
|
+
_logger.debug(f"Normal attempt : {fileName}")
|
|
159
|
+
thr = EvpThr(adderLock, adderThreadPool, taskBuffer, fileName, True)
|
|
160
|
+
thr.start()
|
|
161
|
+
else:
|
|
162
|
+
_logger.debug(f"Wait {timeInt - modTime} : {fileName}")
|
|
163
|
+
except Exception as e:
|
|
164
|
+
_logger.error(f"{str(e)} {traceback.format_exc()}")
|
|
165
|
+
|
|
166
|
+
# join all threads
|
|
167
|
+
adderThreadPool.join()
|
|
168
|
+
|
|
169
|
+
# stop taskBuffer if created inside this script
|
|
170
|
+
taskBuffer.cleanup(requester=requester_id)
|
|
171
|
+
|
|
172
|
+
_logger.debug("===================== end =====================")
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# run
|
|
176
|
+
if __name__ == "__main__":
|
|
177
|
+
main()
|