Ejemplo n.º 1
0
    def load_configuration(self):
        """Loads configuration specified by a user on a command line.

        At this moment, DLBS has already loaded standard configuration (if `discard_default_config` flag is not
        present). DLBS will try to load user configuration from `config` file (if not None) overwriting default
        parameters. Then, it will try to load user provided parameters (`params`, `vars` and `extensions`) that will
        overwrite existing configuration.

        If `plan` file is present, it will be loaded if `action` is `run`.
        """
        if self.config_file is not None:
            logging.debug('Loading configuration from: %s', self.config_file)
            with open(self.config_file) as file_obj:
                user_config = json.load(file_obj)
                # Update parameter information from user configuration.
                ConfigurationLoader.update_param_info(self.param_info,
                                                      user_config,
                                                      is_user_config=True)
                # Update existing benchmark configuration.
                ConfigurationLoader.update(
                    self.config, ConfigurationLoader.remove_info(user_config))
        if self.plan_file is not None and self.action == 'run':
            logging.debug('Loading plan from: %s', self.plan_file)
            with open(self.plan_file) as plan_file:
                self.plan = json.load(plan_file)
 def load_configuration(self):
     """Loads configuration specified by a user on a command line."""
     if self.config_file is not None:
         logging.debug('Loading configuration from: %s', self.config_file)
         with open(self.config_file) as file_obj:
             user_config = json.load(file_obj)
             # Update parameter information from user configuration.
             ConfigurationLoader.update_param_info(self.param_info,
                                                   user_config,
                                                   is_user_config=True)
             # Update existing benchmark configuration.
             ConfigurationLoader.update(
                 self.config, ConfigurationLoader.remove_info(user_config))
     if self.plan_file is not None and self.action == 'run':
         logging.debug('Loading plan from: %s', self.plan_file)
         with open(self.plan_file) as plan_file:
             self.plan = json.load(plan_file)