コード例 #1
0
ファイル: __init__.py プロジェクト: glimchb/infrasim-compute
def chassis_main(name, data_file):
    """
        Usage: chassis <chassis_name> <data_file_name>
    """
    global flag_quit
    flag_quit = False
    try:
        #register the atexit call back function
        atexit.register(atexit_cb)
        signal.signal(signal.SIGINT, atexit_cb)
        signal.signal(signal.SIGTERM, atexit_cb)
        logger = infrasim_log.get_chassis_logger(name)
        logger.info('start chassis {}'.format(name))
        memory = CShareMemory()
        key_name = "/share_mem_{}".format(name)
        with open(data_file, 'r') as fp:
            buf = fp.read()
        memory.create(key_name, len(buf))
        memory.write(0, buf)
        while not flag_quit:
            sleep(3)
        memory.close()
        logger.info('chassis {} closed'.format(name))
    except Exception as e:
        traceback.print_exc()
        logger.info('Chassis failed {}'.format(sys.exc_info()))
        sys.exit(e)
コード例 #2
0
ファイル: __init__.py プロジェクト: InfraSIM/infrasim-compute
def chassis_main(name, data_file):
    """
        Usage: chassis <chassis_name> <data_file_name>
    """
    global flag_quit
    flag_quit = False
    try:
        # register the atexit call back function
        atexit.register(atexit_cb)
        signal.signal(signal.SIGINT, atexit_cb)
        signal.signal(signal.SIGTERM, atexit_cb)
        logger = infrasim_log.get_chassis_logger(name)
        logger.info('start chassis {}'.format(name))
        memory = CShareMemory()
        key_name = "/share_mem_{}".format(name)
        with open(data_file, 'r') as fp:
            buf = fp.read()
        memory.create(key_name, len(buf))
        memory.write(0, buf)
        while not flag_quit:
            sleep(3)
            update_power_status(name)
        memory.close()
        logger.info('chassis {} closed'.format(name))
    except Exception as e:
        traceback.print_exc()
        logger.info('Chassis failed {}'.format(sys.exc_info()))
        sys.exit(e)
コード例 #3
0
 def __init__(self, chassis_name, chassis_info):
     self.__chassis = chassis_info
     self.__chassis_model = None
     self.__node_list = {}
     self.__chassis_name = chassis_name
     self.__numactl_obj = NumaCtl()
     self.__dataset = DataSet()
     self.__file_name = None
     self.__daemon = None
     self.logger = infrasim_log.get_chassis_logger(chassis_name)
     self.workspace = None
コード例 #4
0
ファイル: chassis.py プロジェクト: InfraSIM/infrasim-compute
 def __init__(self, chassis_name, chassis_info):
     self.__chassis = chassis_info
     self.__chassis_model = None
     self.__node_list = {}
     self.__chassis_name = chassis_name
     self.__numactl_obj = NumaCtl()
     self.__dataset = DataSet()
     self.__file_name = None
     self.__daemon = None
     self.logger = infrasim_log.get_chassis_logger(chassis_name)
     self.workspace = None
コード例 #5
0
 def __init__(self, chassis_name, file_name):
     super(CChassisDaemon, self).__init__()
     self.__bin = "infrasim-chassis"
     self.__chassis_name = chassis_name
     self.logger = infrasim_log.get_chassis_logger(chassis_name)
     self.__file_name = file_name