Beispiel #1
0
    def __init__(self, db, config, cluster_name):

        JobImporter.__init__(self, db, config, cluster_name)

        self._logpat = re.compile('(.{19});E;(\d+)(?:-(\d+))?\..*;user=(\S+) (?:account=(\S+))?.*group=(\S+).*queue=(\S+) ctime=\d+ qtime=(\d+) etime=(\d+) start=(\d+) .* exec_host=(\S+) .* Exit_status=(\d+) .*\n')
        self._exechostpat = re.compile('/\d+')

        db_section = self._cluster_name + "/torque"
        self._logfolder = config.get(db_section,"logdir")
Beispiel #2
0
    def __init__(self, db, config, cluster_name):

        JobImporter.__init__(self, db, config, cluster_name)

        slurm_section = self._cluster_name + "/slurm"

        self._dbhost = config.get(slurm_section,"host")
        self._dbport = int(config.get(slurm_section,"port"))
        self._dbname = config.get(slurm_section,"name")
        self._dbuser = config.get(slurm_section,"user")
        self._dbpass = config.get(slurm_section,"password")
        try:
            self._conn = MySQLdb.connect( host = self._dbhost,
                                          user = self._dbuser,
                                          passwd = self._dbpass,
                                          db = self._dbname,
                                          port = self._dbport )
        except _mysql_exceptions.OperationalError as e:
            logging.error("connection to Slurm DBD MySQL failed: %s", e)
            raise RuntimeError
        self._cur = self._conn.cursor(MySQLdb.cursors.DictCursor) 

        # get it from archfile
        self._partitions = {}
        archfile_section = self._cluster_name + "/archfile"
        archfile_name = config.get(archfile_section, "file")
        archfile = ConfigParser.ConfigParser()
        archfile.read(archfile_name)
        partitions_list = archfile.get(self._cluster_name,"partitions").split(',')
        for partition_name in partitions_list:
            partition_section_name = self._cluster_name + "/" + partition_name
            nodesets_list = archfile.get(partition_section_name, "nodesets").split(',')
            slurm_partitions_list = archfile.get(partition_section_name, "slurm_partitions").split(',')
            ns_nodeset = NodeSet()
            for nodeset_name in nodesets_list:
                nodeset_section_name = self._cluster_name + "/" + partition_name + "/" + nodeset_name
                str_nodenames = archfile.get(nodeset_section_name, "names")
                ns_nodeset.add(str_nodenames)
            self._partitions[str(ns_nodeset)] = slurm_partitions_list