File indexing completed on 2026-04-10 08:39:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 """
0011 Pilot Information component
0012
0013 A set of low-level information providers to aggregate, prioritize (overwrite),
0014 hide dependency to external storages and expose (queue, site, storage, etc) details
0015 in a unified structured way to all Pilot modules by providing high-level API
0016
0017 :author: Alexey Anisenkov
0018 :contact: anisyonk@cern.ch
0019 :date: January 2018
0020 """
0021
0022
0023 from .infoservice import InfoService
0024 from .jobinfo import JobInfoProvider
0025 from .jobdata import JobData
0026 from .filespec import FileSpec
0027
0028
0029
0030 from pilot.common.exception import PilotException
0031
0032 import collections
0033
0034 import logging
0035 logger = logging.getLogger(__name__)
0036
0037
0038 def set_info(args):
0039 """
0040 Set up all necessary site information for given PandaQueue name.
0041 Resolve everything from the specified queue name (passed via `args.queue`)
0042 and fill extra lookup structure (Populate `args.info`).
0043
0044 raise PilotException in case of errors.
0045
0046 :param args: input (shared) agruments
0047 :return: None
0048 """
0049
0050
0051 infosys.init(args.queue)
0052
0053 args.info = collections.namedtuple('info', ['queue', 'infoservice',
0054
0055 'site', 'storages',
0056
0057 'storages_info'])
0058 args.info.queue = args.queue
0059 args.info.infoservice = infosys
0060
0061
0062
0063 if infosys.queuedata.state != 'ACTIVE':
0064 logger.critical('specified queue is NOT ACTIVE: %s -- aborting' % infosys.queuedata.name)
0065 raise PilotException("Panda Queue is NOT ACTIVE")
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080 try:
0081 args.info.storages = [ddm for ddm, dat in infosys.storages_info.iteritems() if dat.site == infosys.queuedata.site]
0082 except Exception:
0083 args.info.storages = [ddm for ddm, dat in list(infosys.storages_info.items()) if dat.site == infosys.queuedata.site]
0084
0085
0086
0087 logger.info('queue: %s' % args.info.queue)
0088
0089
0090
0091
0092
0093
0094
0095
0096 infosys = InfoService()