コード例 #1
0
    def __init__(self, **kwarg):
        self.logBaseURL = None
        PluginBase.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace, config_file=self.k8s_config_file)

        # number of processes
        try:
            self.nProcesses
        except AttributeError:
            self.nProcesses = 1
        else:
            if (not self.nProcesses) or (self.nProcesses < 1):
                self.nProcesses = 1
        # x509 proxy
        try:
            self.x509UserProxy
        except AttributeError:
            if os.getenv('X509_USER_PROXY'):
                self.x509UserProxy = os.getenv('X509_USER_PROXY')

        # CPU adjust ratio
        try:
            self.cpuAdjustRatio
        except AttributeError:
            self.cpuAdjustRatio = 100

        # Memory adjust ratio
        try:
            self.memoryAdjustRatio
        except AttributeError:
            self.memoryAdjustRatio = 100
コード例 #2
0
    def __init__(self, **kwarg):
        BaseSweeper.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(self.k8s_namespace,
                                     config_file=self.k8s_config_file)

        self._all_pods_list = []
コード例 #3
0
    def __init__(self, **kwarg):
        self.logBaseURL = None
        PluginBase.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace,
                                     config_file=self.k8s_config_file)

        # number of processes
        try:
            self.nProcesses
        except AttributeError:
            self.nProcesses = 1
        else:
            if (not self.nProcesses) or (self.nProcesses < 1):
                self.nProcesses = 1
        # x509 proxy
        try:
            self.x509UserProxy
        except AttributeError:
            if os.getenv('X509_USER_PROXY'):
                self.x509UserProxy = os.getenv('X509_USER_PROXY')

        # CPU adjust ratio
        try:
            self.cpuAdjustRatio
        except AttributeError:
            self.cpuAdjustRatio = 100

        # Memory adjust ratio
        try:
            self.memoryAdjustRatio
        except AttributeError:
            self.memoryAdjustRatio = 100
コード例 #4
0
 def __init__(self, **kwarg):
     PluginBase.__init__(self, **kwarg)
     # make logger
     mainLog = self.make_logger(_logger, method_name='__init__')
     # attributes
     try:
         self.inFile
     except AttributeError:
         self.inFile = self.inCertFile
     # parse inFile setup conficuration
     try:
         with open(self.inFile) as f:
             self.setupMap = json.load(f)
     except Exception as e:
         mainLog.error('Error with inFile/inCertFile . {0}: {1}'.format(
             e.__class__.__name__, e))
         self.setupMap = {}
         raise
     # validate setupMap
     try:
         self.k8s_namespace = self.setupMap['k8s_namespace']
         self.k8s_config_file = self.setupMap['k8s_config_file']
         self.proxy_file_list = self.setupMap['proxy_files']
         self.secret_name = self.setupMap.get('secret_name', 'proxy-secret')
     except KeyError as e:
         mainLog.error(
             'Missing setup in inFile/inCertFile . {0}: {1}'.format(
                 e.__class__.__name__, e))
         raise
     # k8s client
     self.k8s_client = k8s_Client(namespace=self.k8s_namespace,
                                  config_file=self.k8s_config_file)
コード例 #5
0
 def __init__(self, **kwarg):
     PluginBase.__init__(self, **kwarg)
     # make logger
     mainLog = self.make_logger(_logger, method_name='__init__')
     # attributes
     try:
         self.inFile
     except AttributeError:
         self.inFile = self.inCertFile
     # parse inFile setup conficuration
     try:
         with open(self.inFile) as f:
             self.setupMap = json.load(f)
     except Exception as e:
         mainLog.error('Error with inFile/inCertFile . {0}: {1}'.format(
                             e.__class__.__name__, e))
         self.setupMap = {}
         raise
     # validate setupMap
     try:
         self.k8s_namespace = self.setupMap['k8s_namespace']
         self.k8s_config_file = self.setupMap['k8s_config_file']
         self.proxy_file_list = self.setupMap['proxy_files']
         self.secret_name = self.setupMap.get('secret_name', 'proxy-secret')
     except KeyError as e:
         mainLog.error('Missing setup in inFile/inCertFile . {0}: {1}'.format(
                             e.__class__.__name__, e))
         raise
     # k8s client
     self.k8s_client = k8s_Client(namespace=self.k8s_namespace, config_file=self.k8s_config_file)
コード例 #6
0
    def __init__(self, **kwarg):
        self.logBaseURL = None
        PluginBase.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace,
                                     config_file=self.k8s_config_file)

        # required for parsing jobParams
        self.parser = argparse.ArgumentParser()
        self.parser.add_argument('-p', dest='executable', type=unquote)
        self.parser.add_argument('--containerImage', dest='container_image')

        # number of processes
        try:
            self.nProcesses
        except AttributeError:
            self.nProcesses = 1
        else:
            if (not self.nProcesses) or (self.nProcesses < 1):
                self.nProcesses = 1
        # x509 proxy: obsolete mode
        try:
            self.x509UserProxy
        except AttributeError:
            if os.getenv('X509_USER_PROXY'):
                self.x509UserProxy = os.getenv('X509_USER_PROXY')

        # x509 proxy for analysis jobs in grandly unified queues
        try:
            self.x509UserProxyAnalysis
        except AttributeError:
            self.x509UserProxyAnalysis = os.getenv('X509_USER_PROXY_ANAL')

        # x509 proxy through k8s secrets: preferred way
        try:
            self.proxySecretPath
        except AttributeError:
            if os.getenv('PROXY_SECRET_PATH'):
                self.proxySecretPath = os.getenv('PROXY_SECRET_PATH')

        # analysis x509 proxy through k8s secrets: on GU queues
        try:
            self.proxySecretPathAnalysis
        except AttributeError:
            if os.getenv('PROXY_SECRET_PATH_ANAL'):
                self.proxySecretPath = os.getenv('PROXY_SECRET_PATH_ANAL')

        # CPU adjust ratio
        try:
            self.cpuAdjustRatio
        except AttributeError:
            self.cpuAdjustRatio = 100

        # Memory adjust ratio
        try:
            self.memoryAdjustRatio
        except AttributeError:
            self.memoryAdjustRatio = 100
コード例 #7
0
 def __init__(self, **kwargs):
     BaseMessenger.__init__(self, **kwargs)
     try:
         self.logDir
     except AttributeError:
         print('K8sMessenger: Missing attribute logDir')
         raise
     self.k8s_client = k8s_Client(namespace=self.k8s_namespace,
                                  config_file=self.k8s_config_file)
     self._all_pods_list = self.k8s_client.get_pods_info()
コード例 #8
0
    def __init__(self, **kwarg):
        self.logBaseURL = None
        PluginBase.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace, config_file=self.k8s_config_file)

        # update or create the pilot starter executable
        self.k8s_client.create_or_patch_configmap_starter()

        # required for parsing jobParams
        self.parser = argparse.ArgumentParser()
        self.parser.add_argument('-p', dest='executable', type=unquote)
        self.parser.add_argument('--containerImage', dest='container_image')

        # allowed associated parameters from AGIS
        self._allowed_agis_attrs = (
                'pilot_url',
            )

        # number of processes
        try:
            self.nProcesses
        except AttributeError:
            self.nProcesses = 1
        else:
            if (not self.nProcesses) or (self.nProcesses < 1):
                self.nProcesses = 1

        # x509 proxy through k8s secrets: preferred way
        try:
            self.proxySecretPath
        except AttributeError:
            if os.getenv('PROXY_SECRET_PATH'):
                self.proxySecretPath = os.getenv('PROXY_SECRET_PATH')

        # analysis x509 proxy through k8s secrets: on GU queues
        try:
            self.proxySecretPathAnalysis
        except AttributeError:
            if os.getenv('PROXY_SECRET_PATH_ANAL'):
                self.proxySecretPath = os.getenv('PROXY_SECRET_PATH_ANAL')

        # CPU adjust ratio
        try:
            self.cpuAdjustRatio
        except AttributeError:
            self.cpuAdjustRatio = 100

        # Memory adjust ratio
        try:
            self.memoryAdjustRatio
        except AttributeError:
            self.memoryAdjustRatio = 100
コード例 #9
0
 def __init__(self, **kwarg):
     PluginBase.__init__(self, **kwarg)
     # make logger
     mainLog = self.make_logger(_logger, method_name='__init__')
     # attributes
     if hasattr(self, 'inFile') or hasattr(self, 'inCertFile'):
         # set up with json in inFile
         try:
             self.inFile
         except AttributeError:
             self.inFile = self.inCertFile
         # parse inFile setup configuration
         try:
             with open(self.inFile) as f:
                 self.setupMap = json.load(f)
         except Exception as e:
             mainLog.error('Error with inFile/inCertFile . {0}: {1}'.format(
                 e.__class__.__name__, e))
             self.setupMap = {}
             raise
     else:
         # set up with direct attributes
         self.setupMap = dict(vars(self))
     # validate setupMap
     try:
         self.k8s_namespace = self.setupMap['k8s_namespace']
         self.k8s_config_file = self.setupMap['k8s_config_file']
         self.proxy_files = self.setupMap['proxy_files']
         self.secret_name = self.setupMap.get('secret_name', 'proxy-secret')
     except KeyError as e:
         mainLog.error('Missing attributes in setup . {0}: {1}'.format(
             e.__class__.__name__, e))
         raise
     # k8s client
     try:
         self.k8s_client = k8s_Client(namespace=self.k8s_namespace,
                                      config_file=self.k8s_config_file)
     except Exception as e:
         mainLog.error('Problem instantiating k8s client for {0}'.format(
             self.k8s_config_file))
         raise
コード例 #10
0
    def __init__(self, **kwarg):
        PluginBase.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace, config_file=self.k8s_config_file)

        try:
            self.nProcesses
        except AttributeError:
            self.nProcesses = 4
        try:
            self.cancelUnknown
        except AttributeError:
            self.cancelUnknown = False
        else:
            self.cancelUnknown = bool(self.cancelUnknown)
        try:
            self.podQueueTimeLimit
        except AttributeError:
            self.podQueueTimeLimit = 172800

        self._all_pods_list = []
コード例 #11
0
    def __init__(self, **kwarg):
        BaseSweeper.__init__(self, **kwarg)

        self.k8s_client = k8s_Client(namespace=self.k8s_namespace, config_file=self.k8s_config_file)

        self._all_pods_list = []