Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:39:07

0001 import sys
0002 
0003 from pandaserver.config import panda_config
0004 from pandaserver.taskbuffer.OraDBProxy import DBProxy
0005 
0006 if __name__ == "__main__":
0007     """
0008     Functional testing of the shares tree
0009     """
0010     proxyS = DBProxy()
0011     proxyS.connect(
0012         panda_config.dbhost,
0013         panda_config.dbpasswd,
0014         panda_config.dbuser,
0015         panda_config.dbname,
0016     )
0017 
0018     # print the shares in order of under usage
0019     print("--------------LEAVE SHARES SORTED BY UNDER-PLEDGING---------------")
0020     print(proxyS.get_sorted_leaves())
0021 
0022     # print the global share structure
0023     print("--------------GLOBAL SHARES TREE---------------")
0024     print(proxyS.tree)
0025 
0026     # print the normalized leaves, which will be the actual applied shares
0027     print("--------------LEAVE SHARES---------------")
0028     print(proxyS.leave_shares)
0029 
0030     # print the current grid status
0031     print("--------------CURRENT GRID STATUS---------------")
0032     print(proxyS.tree.pretty_print_hs_distribution(proxyS._DBProxy__hs_distribution))
0033 
0034     # check a couple of shares if they are valid leave names
0035     share_name = "wrong_share"
0036     print(f"Share {share_name} is valid: {proxyS.is_valid_share(share_name)}")
0037     share_name = "MC16Pile"
0038     print(f"Share {share_name} is valid: {proxyS.is_valid_share(share_name)}")
0039 
0040     try:
0041         from pandajedi.jedicore.JediTaskSpec import JediTaskSpec
0042     except ImportError:
0043         print("Skipped task tests since JEDI module depency not satisfied")
0044         sys.exit(0)
0045 
0046     # create a fake tasks with relevant fields and retrieve its share
0047     task_spec = JediTaskSpec()
0048 
0049     # Analysis task
0050     task_spec.prodSourceLabel = "user"
0051     task_spec.campaign = "dummy_campaign"
0052     task_spec.workingGroup = "dummy_wg"
0053     task_spec.processingType = "dummy_type"
0054     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Analysis')")
0055 
0056     # Production task without any matching leave
0057     task_spec.prodSourceLabel = "managed"
0058     task_spec.campaign = "dummy_campaign"
0059     task_spec.workingGroup = "dummy_wg"
0060     task_spec.processingType = "dummy_type"
0061     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Undefined')")
0062 
0063     # Test task
0064     task_spec.prodSourceLabel = "test123"
0065     task_spec.campaign = "dummy_campaign"
0066     task_spec.workingGroup = "dummy_wg"
0067     task_spec.processingType = "dummy_type"
0068     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Test')")
0069 
0070     # Derivations task without any matching leave
0071     task_spec.prodSourceLabel = "managed"
0072     task_spec.campaign = "dummy_campaign"
0073     task_spec.workingGroup = "GP_PHYS"
0074     task_spec.processingType = "dummy_type"
0075     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Undefined')")
0076 
0077     # Reprocessing task without any matching leave
0078     task_spec.prodSourceLabel = "managed"
0079     task_spec.campaign = "dummy_campaign"
0080     task_spec.workingGroup = "AP_REPR"
0081     task_spec.processingType = "dummy_type"
0082     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Undefined')")
0083 
0084     # Group production task
0085     task_spec.prodSourceLabel = "managed"
0086     task_spec.campaign = "dummy_campaign"
0087     task_spec.workingGroup = "GP_LOL"
0088     task_spec.processingType = "dummy_type"
0089     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Group production')")
0090 
0091     # Upgrade task
0092     task_spec.prodSourceLabel = "managed"
0093     task_spec.campaign = "dummy_campaign"
0094     task_spec.workingGroup = "AP_UPG"
0095     task_spec.processingType = "dummy_type"
0096     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Upgrade')")
0097 
0098     # HLT Reprocessing
0099     task_spec.prodSourceLabel = "managed"
0100     task_spec.campaign = "dummy_campaign"
0101     task_spec.workingGroup = "AP_THLT"
0102     task_spec.processingType = "dummy_type"
0103     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'HLT Reprocessing')")
0104 
0105     # Validation
0106     task_spec.prodSourceLabel = "managed"
0107     task_spec.campaign = "dummy_campaign"
0108     task_spec.workingGroup = "AP_VALI"
0109     task_spec.processingType = "dummy_type"
0110     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Validation')")
0111 
0112     # Event Index
0113     task_spec.prodSourceLabel = "managed"
0114     task_spec.campaign = "dummy_campaign"
0115     task_spec.workingGroup = "proj-evind"
0116     task_spec.processingType = "dummy_type"
0117     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Event Index')")
0118 
0119     # MC Derivations
0120     task_spec.prodSourceLabel = "managed"
0121     task_spec.campaign = "mc.*"
0122     task_spec.workingGroup = "GP_PHYS"
0123     task_spec.processingType = "dummy_type"
0124     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'MC Derivations')")
0125 
0126     # Data Derivations
0127     task_spec.prodSourceLabel = "managed"
0128     task_spec.campaign = "data.*"
0129     task_spec.workingGroup = "GP_PHYS"
0130     task_spec.processingType = "dummy_type"
0131     print(f"Share for task is {proxyS.get_share_for_task(task_spec)}(should be 'Data Derivations')")