def launch_data(self): ser = PeerConfigSerializerCmd() args = [self.peer_id] peer_parser = peer.peer_config_parser.parser("ini") base_config = PeerConfig(self.peer_id) conf_path = launcher_tools.default_config_path(self.path) if conf_path: with codecs.open(conf_path, "r", "utf8") as f: self.logger.info("parsing default config for peer %s, %s ", self.peer_id, conf_path) peer_parser.parse(f, base_config) ser.serialize_diff(base_config, self.config, args) return dict(peer_id=self.peer_id, experiment_id=self.experiment_id, path=self.path, machine=self.machine, args=args, peer_type=self.peer_type())
def parse_peer_default_config(peer_id, peer_program_path, logger=None, apply_globals=False): # print "Trying to find default config for {0}, path: {1}".format( # peer_id, peer_program_path) peer_parser = peer_config_parser.parser("ini") peer_cfg = peer_config.PeerConfig(peer_id) conf_path = default_config_path(peer_program_path) if apply_globals: for param, value in CONFIG_DEFAULTS.items(): peer_cfg.add_local_param(param, value) if conf_path: with codecs.open(conf_path, "r", "utf8") as f: if logger: logger.info("parsing default config " "for peer %s, %s ", peer_id, conf_path) peer_parser.parse(f, peer_cfg) return peer_cfg, peer_parser
def launch_data(self): ser = PeerConfigSerializerCmd() args = [self.peer_id] peer_parser = peer.peer_config_parser.parser("ini") base_config = PeerConfig(self.peer_id) conf_path = launcher_tools.default_config_path(self.path) if conf_path: with codecs.open(conf_path, "r", "utf8") as f: self.logger.info("parsing default config for peer %s, %s ", self.peer_id, conf_path) peer_parser.parse(f, base_config) ser.serialize_diff(base_config, self.config, args) return dict(peer_id=self.peer_id, experiment_id=self.experiment_id, path=self.path, machine=self.machine, args=args, peer_type=self.peer_type())
def parse_peer_default_config(peer_id, peer_program_path, logger=None, apply_globals=False): # print "Trying to find default config for {0}, path: {1}".format( # peer_id, peer_program_path) peer_parser = peer_config_parser.parser("ini") peer_cfg = peer_config.PeerConfig(peer_id) conf_path = default_config_path(peer_program_path) if apply_globals: for param, value in CONFIG_DEFAULTS.iteritems(): peer_cfg.add_local_param(param, value) if conf_path: with codecs.open(conf_path, "r", "utf8") as f: if logger: logger.info("parsing default config " "for peer %s, %s ", peer_id, conf_path) peer_parser.parse(f, peer_cfg) return peer_cfg, peer_parser