def init_ib_config()

in src/worker/exporters/custom_exporter.py [0:0]


def init_ib_config():
    """Initialize InfiniBand configuration"""
    cmd = 'ibv_devinfo -l'
    result = shell_cmd(cmd, 5)
    if 'HCAs found' in result or 'HCA found' in result:
        try:
            result = result.split('\n')[1:]
            for idx, ib in enumerate(result):
                if "ib" not in ib:
                    continue
                if ib:
                    mapping = re.search(r"ib\d", ib.strip()).group()
                    IB_Mapping[mapping] = ib.strip() + ':1'
                    config['ib_port'][str(idx)] = IB_Mapping[mapping]
        except Exception as e:
            logging.error(f"Error parsing IB info: {e}")