File indexing completed on 2026-04-10 08:39:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 from pilot.info import infosys
0015
0016 import logging
0017 logger = logging.getLogger(__name__)
0018
0019
0020 def get_maximum_input_sizes():
0021 """
0022 This function returns the maximum allowed size for all input files. The sum of all input file sizes should not
0023 exceed this value.
0024
0025 :return: maxinputsizes (integer value in MB).
0026 """
0027
0028 try:
0029 _maxinputsizes = infosys.queuedata.maxwdir
0030 except TypeError as e:
0031 from pilot.util.config import config
0032 _maxinputsizes = config.Pilot.maximum_input_file_sizes
0033 logger.warning('could not convert schedconfig value for maxwdir: %s (will use default value instead - %s)' %
0034 (e, _maxinputsizes))
0035
0036 if type(_maxinputsizes) == str and ' MB' in _maxinputsizes:
0037 _maxinputsizes = _maxinputsizes.replace(' MB', '')
0038
0039 try:
0040 _maxinputsizes = int(_maxinputsizes)
0041 except Exception as e:
0042 _maxinputsizes = 14336 + 2000
0043 logger.warning('failed to convert maxinputsizes to int: %s (using value: %d MB)' % (e, _maxinputsizes))
0044
0045 return _maxinputsizes
0046
0047
0048 def convert_to_int(parameter, default=None):
0049 """
0050 Try to convert a given parameter to an integer value.
0051 The default parameter can be used to force the function to always return a given value in case the integer
0052 conversion, int(parameter), fails.
0053
0054 :param parameter: parameter (any type).
0055 :param default: None by default (if set, always return an integer; the given value will be returned if
0056 conversion to integer fails).
0057 :return: converted integer.
0058 """
0059
0060 try:
0061 value = int(parameter)
0062 except Exception:
0063 value = default
0064
0065 return value