Skip to content

Commit

Permalink
[ML] Add argument for config file to autodetect (#1540)
Browse files Browse the repository at this point in the history
Add an argument to autodetect to enable specifying a config file.
Eventually this will be used to read an autodetect job config in JSON
format but in this initial step it is unused.

Relates to #1253
  • Loading branch information
edsavage authored Oct 16, 2020
1 parent 42b6be1 commit 5710d8a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bin/autodetect/CCmdLineParser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const std::string CCmdLineParser::DESCRIPTION = "Usage: autodetect [options] [<f

bool CCmdLineParser::parse(int argc,
const char* const* argv,
std::string& configFile,
std::string& limitConfigFile,
std::string& modelConfigFile,
std::string& fieldConfigFile,
Expand Down Expand Up @@ -62,6 +63,8 @@ bool CCmdLineParser::parse(int argc,
desc.add_options()
("help", "Display this information and exit")
("version", "Display version information and exit")
("config", boost::program_options::value<std::string>(),
"The job configuration file")
("limitconfig", boost::program_options::value<std::string>(),
"Optional limit config file")
("modelconfig", boost::program_options::value<std::string>(),
Expand Down Expand Up @@ -154,6 +157,9 @@ bool CCmdLineParser::parse(int argc,
<< ver::CBuildInfo::fullInfo() << std::endl;
return false;
}
if (vm.count("config") > 0) {
configFile = vm["config"].as<std::string>();
}
if (vm.count("limitconfig") > 0) {
limitConfigFile = vm["limitconfig"].as<std::string>();
}
Expand Down
1 change: 1 addition & 0 deletions bin/autodetect/CCmdLineParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CCmdLineParser {
//! later on by the api::CFieldConfig class.
static bool parse(int argc,
const char* const* argv,
std::string& config,
std::string& limitConfigFile,
std::string& modelConfigFile,
std::string& fieldConfigFile,
Expand Down
3 changes: 2 additions & 1 deletion bin/autodetect/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ int main(int argc, char** argv) {
using TStrVec = ml::autodetect::CCmdLineParser::TStrVec;

// Read command line options
std::string configFile;
std::string limitConfigFile;
std::string modelConfigFile;
std::string fieldConfigFile;
Expand Down Expand Up @@ -118,7 +119,7 @@ int main(int argc, char** argv) {
bool stopCategorizationOnWarnStatus{false};
TStrVec clauseTokens;
if (ml::autodetect::CCmdLineParser::parse(
argc, argv, limitConfigFile, modelConfigFile, fieldConfigFile,
argc, argv, configFile, limitConfigFile, modelConfigFile, fieldConfigFile,
modelPlotConfigFile, jobId, logProperties, logPipe, bucketSpan, latency,
summaryCountFieldName, delimiter, lengthEncodedInput, timeField,
timeFormat, quantilesStateFile, deleteStateFiles, persistInterval,
Expand Down

0 comments on commit 5710d8a

Please sign in to comment.