File indexing completed on 2026-04-20 07:59:01
0001 import sys
0002 import time
0003
0004 from pandaharvester.harvestercore.job_spec import JobSpec
0005 from pandaharvester.harvestercore.plugin_factory import PluginFactory
0006 from pandaharvester.harvestercore.queue_config_mapper import QueueConfigMapper
0007 from pilot.info.filespec import FileSpec
0008
0009 queueName = sys.argv[1]
0010
0011 queueConfigMapper = QueueConfigMapper()
0012
0013 queueConfig = queueConfigMapper.get_queue(queueName)
0014
0015 jobSpec = JobSpec()
0016 new_file_data = {"scope": "test", "lfn": "TXT.19772875._044894.tar.gz.1", "attemptNr": 0}
0017 new_file_spec = FileSpec(filetype="input", **new_file_data)
0018 new_file_spec.attemptNr = 0
0019 new_file_spec.path = "/home/psvirin/harvester3"
0020
0021 jobSpec.inFiles = {new_file_spec}
0022 jobSpec.outFiles = {}
0023 jobSpec.jobParams = {
0024 "inFiles": "TXT.19772875._044894.tar.gz.1",
0025 "scopeIn": "mc15_13TeV",
0026 "fsize": "658906675",
0027 "GUID": "7e3776f9bb0af341b03e59d3de895a13",
0028 "checksum": "ad:3734bdd9",
0029 "ddmEndPointIn": "BNL-OSG2_DATADISK",
0030 "realDatasetsIn": "mc15_13TeV.363638.MGPy8EG_N30NLO_Wmunu_Ht500_700_BFilter.merge.DAOD_STDM4.e4944_s2726_r7772_r7676_p2842_tid09596175_00",
0031 }
0032 jobSpec.computingSite = queueName
0033 jobSpec.PandaID = "11111"
0034
0035
0036 pluginFactory = PluginFactory()
0037
0038
0039 preparatorCore = pluginFactory.get_plugin(queueConfig.preparator)
0040 print(f"plugin={preparatorCore.__class__.__name__}")
0041
0042 print(jobSpec)
0043
0044 print("testing stagein:")
0045 print(f"BasePath from preparator configuration: {preparatorCore.basePath} ")
0046 preparatorCore.basePath = preparatorCore.basePath + "/testdata/"
0047 print(f"basePath redifuned for test data: {preparatorCore.basePath} ")
0048
0049 tmpStat, tmpOut = preparatorCore.trigger_preparation(jobSpec)
0050 if tmpStat:
0051 print(" OK")
0052 else:
0053 print(f" NG {tmpOut}")
0054
0055 print
0056
0057 print("testing status check")
0058 while True:
0059 tmpStat, tmpOut = preparatorCore.check_stage_in_status(jobSpec)
0060 if tmpStat is True:
0061 print(" OK")
0062 break
0063 elif tmpStat is False:
0064 print(f" NG {tmpOut}")
0065 sys.exit(1)
0066 else:
0067 print(" still running. sleep 1 min")
0068 time.sleep(60)
0069
0070 print
0071
0072 print("checking path resolution")
0073 tmpStat, tmpOut = preparatorCore.resolve_input_paths(jobSpec)
0074 if tmpStat:
0075 print(f" OK {jobSpec.jobParams['inFilePaths']}")
0076 else:
0077 print(f" NG {tmpOut}")