-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42650 from kpedro88/cmsArgParse
Improve command-line argument support for Python configs in cmsRun and edm tools
- Loading branch information
Showing
144 changed files
with
1,303 additions
and
656 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef FWCore_Framework_CmsRunParser_h | ||
#define FWCore_Framework_CmsRunParser_h | ||
|
||
#include "boost/program_options.hpp" | ||
|
||
#include <variant> | ||
|
||
namespace edm { | ||
class CmsRunParser { | ||
public: | ||
using MapOrExit = std::variant<boost::program_options::variables_map, int>; | ||
CmsRunParser(const char* name); | ||
MapOrExit parse(int argc, const char* argv[]) const; | ||
//variant helpers | ||
static bool hasVM(const MapOrExit& output) { | ||
return std::holds_alternative<boost::program_options::variables_map>(output); | ||
} | ||
static boost::program_options::variables_map getVM(const MapOrExit& output) { | ||
return std::get<boost::program_options::variables_map>(output); | ||
} | ||
static bool hasExit(const MapOrExit& output) { return std::holds_alternative<int>(output); } | ||
static int getExit(const MapOrExit& output) { return std::get<int>(output); } | ||
|
||
private: | ||
boost::program_options::options_description desc_; | ||
boost::program_options::options_description all_options_; | ||
boost::program_options::positional_options_description pos_options_; | ||
|
||
public: | ||
//Command line parameters | ||
static inline const char* const kParameterSetOpt = "parameter-set"; | ||
static inline const char* const kPythonOpt = "pythonOptions"; | ||
static inline const char* const kPythonOptDefault = "CMSRUN_PYTHONOPT_DEFAULT"; | ||
static inline const char* const kCmdCommandOpt = "command,c"; | ||
static inline const char* const kCmdOpt = "command"; | ||
static inline const char* const kJobreportCommandOpt = "jobreport,j"; | ||
static inline const char* const kJobreportOpt = "jobreport"; | ||
static inline const char* const kEnableJobreportCommandOpt = "enablejobreport,e"; | ||
static inline const char* const kEnableJobreportOpt = "enablejobreport"; | ||
static inline const char* const kJobModeCommandOpt = "mode,m"; | ||
static inline const char* const kJobModeOpt = "mode"; | ||
static inline const char* const kNumberOfThreadsCommandOpt = "numThreads,n"; | ||
static inline const char* const kNumberOfThreadsOpt = "numThreads"; | ||
static inline const char* const kSizeOfStackForThreadCommandOpt = "sizeOfStackForThreadsInKB,s"; | ||
static inline const char* const kSizeOfStackForThreadOpt = "sizeOfStackForThreadsInKB"; | ||
static inline const char* const kHelpOpt = "help"; | ||
static inline const char* const kHelpCommandOpt = "help,h"; | ||
static inline const char* const kStrictOpt = "strict"; | ||
}; | ||
} // namespace edm | ||
|
||
#endif |
Oops, something went wrong.