Provide a config generator

Open
#255 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
cli

Research direction

Start from the issue's proposed config template and the hermes::Config values returned by InitDefaultConfig(). Determine how command-line options should override those values and how the output filename should be selected, including the default ./hermes.conf. Done means a generated configuration file contains the populated template and can be written to the requested path.

Written by the indexing model from the issue text.

Description

enhancement

An outline

#include <regex>
#include <string>

// Create a config template with capitalized VARIABLE_NAMES as placeholders for
// config parameter values
std::string conf_template = R"(
num_devices = NUM_DEVICES;
num_targets = NUM_TARGETS;
capacities_mb = CAPACITIES;
block_sizes_kb = BLOCK_SIZES;
num_slabs = NUM_SLABS;
slab_unit_sizes = {
  SLAB_UNIT_SIZES
};
desired_slab_percentages = {
  SLAB_PERCENTAGES
};

etc ...

)";

int main() {

  // Create a default Config
  hermes::Config conf = hermes::InitDefaultConfig();

  // Parse command line options and overwrite default Config values with the
  // user-supplied values.

  // Replace variables in the config template with the values in conf
  conf_template = std::regex_replace(conf_template, std::regex("NUM_DEVICES"),
                                     std::to_string(conf.num_devices));
  conf_template = std::regex_replace(conf_template, std::regex("NUM_TARGETS"),
                                     std::to_string(conf.num_targets));
  // etc.

  // Finally, write the final conf_template string to a file. The filename
  // should be passed via command line option, with ./hermes.conf as the default

  return 0;
}
Dominant language
C++
Stars
34
Forks
19
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HDFGroup/hermes

All issues in HDFGroup/hermes

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.