From 5710d8aab46d73ffe0045198686a7aca0d059c83 Mon Sep 17 00:00:00 2001 From: Ed Savage Date: Fri, 16 Oct 2020 13:07:53 +0100 Subject: [PATCH] [ML] Add argument for config file to autodetect (#1540) 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 --- bin/autodetect/CCmdLineParser.cc | 6 ++++++ bin/autodetect/CCmdLineParser.h | 1 + bin/autodetect/Main.cc | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/autodetect/CCmdLineParser.cc b/bin/autodetect/CCmdLineParser.cc index 57f93aabe3..e5fe8e69ff 100644 --- a/bin/autodetect/CCmdLineParser.cc +++ b/bin/autodetect/CCmdLineParser.cc @@ -22,6 +22,7 @@ const std::string CCmdLineParser::DESCRIPTION = "Usage: autodetect [options] [(), + "The job configuration file") ("limitconfig", boost::program_options::value(), "Optional limit config file") ("modelconfig", boost::program_options::value(), @@ -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(); + } if (vm.count("limitconfig") > 0) { limitConfigFile = vm["limitconfig"].as(); } diff --git a/bin/autodetect/CCmdLineParser.h b/bin/autodetect/CCmdLineParser.h index d9b35eb701..ce5516ffee 100644 --- a/bin/autodetect/CCmdLineParser.h +++ b/bin/autodetect/CCmdLineParser.h @@ -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, diff --git a/bin/autodetect/Main.cc b/bin/autodetect/Main.cc index b5d142210f..402691019e 100644 --- a/bin/autodetect/Main.cc +++ b/bin/autodetect/Main.cc @@ -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; @@ -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,