def main(argv): """ The entry point of daemon_factory process :param argv: parameters given from command line """ if (len(argv) != 3): usage() return EXIT_FAILURE pipe_path = argv[0] log_level = argv[1] container_id = argv[2] # Initialize logger logger = start_logger("daemon-factory", log_level, container_id) logger.debug("Daemon factory started") SBus.start_logger("DEBUG", container_id=container_id) # Impersonate the swift user pw = pwd.getpwnam('swift') os.setresgid(pw.pw_gid, pw.pw_gid, pw.pw_gid) os.setresuid(pw.pw_uid, pw.pw_uid, pw.pw_uid) # create an instance of daemon_factory factory = DaemonFactory(pipe_path, logger, container_id) # Start the main loop return factory.main_loop()
def main(): """ The entry point of daemon_factory process """ parser = argparse.ArgumentParser( description='Factory process to manage storlet daemons') parser.add_argument('sbus_path', help='the path to unix domain socket') parser.add_argument('log_level', help='log level') parser.add_argument('container_id', help='container id') opts = parser.parse_args() # Initialize logger logger = get_logger("daemon-factory", opts.log_level, opts.container_id) logger.debug("Daemon factory started") try: SBus.start_logger("DEBUG", container_id=opts.container_id) # Impersonate the swift user pw = pwd.getpwnam('swift') os.setresgid(pw.pw_gid, pw.pw_gid, pw.pw_gid) os.setresuid(pw.pw_uid, pw.pw_uid, pw.pw_uid) # create an instance of daemon_factory factory = StorletDaemonFactory(opts.sbus_path, logger, opts.container_id) # Start the main loop sys.exit(factory.main_loop()) except Exception: logger.eception('Unhandled exception') sys.exit(EXIT_FAILURE)
def main(argv): """ The entry point of daemon_factory process :param argv: parameters given from command line """ if (len(argv) != 5): usage() return EXIT_FAILURE storlet_name = argv[0] sbus_path = argv[1] log_level = argv[2] pool_size = argv[3] container_id = argv[4] # Initialize logger logger = start_logger("storlets-daemon", log_level, container_id) logger.debug("Storlet Daemon started") SBus.start_logger("DEBUG", container_id=container_id) # Impersonate the swift user pw = pwd.getpwnam('swift') os.setresgid(pw.pw_gid, pw.pw_gid, pw.pw_gid) os.setresuid(pw.pw_uid, pw.pw_uid, pw.pw_uid) # create an instance of storlet daemon try: daemon = Daemon(storlet_name, sbus_path, logger, pool_size) except Exception as e: logger.error(e.message) return EXIT_FAILURE # Start the main loop return daemon.main_loop()
def main(): """ The entry point of daemon_factory process """ parser = argparse.ArgumentParser( description='Daemon process to execute storlet applications') parser.add_argument('storlet_name', help='storlet name') parser.add_argument('sbus_path', help='the path to unix domain socket') parser.add_argument('log_level', help='log level') parser.add_argument('pool_size', type=int, help='the maximun thread numbers used swapns for ' 'one storlet application') parser.add_argument('container_id', help='container id') opts = parser.parse_args() # Initialize logger logger = get_logger("storlets-daemon", opts.log_level, opts.container_id) logger.debug("Storlet Daemon started") try: SBus.start_logger("DEBUG", container_id=opts.container_id) # Impersonate the swift user pw = pwd.getpwnam('swift') os.setresgid(pw.pw_gid, pw.pw_gid, pw.pw_gid) os.setresuid(pw.pw_uid, pw.pw_uid, pw.pw_uid) # create an instance of storlet daemon daemon = StorletDaemon(opts.storlet_name, opts.sbus_path, logger, opts.pool_size) # Start the main loop sys.exit(daemon.main_loop()) except Exception: logger.error('Unhandled exception') sys.exit(EXIT_FAILURE)