Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cbmroot
Manage
Activity
Members
Labels
Plan
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computing
cbmroot
Commits
867f02f9
Commit
867f02f9
authored
1 year ago
by
Pierre-Alain Loizeau
Committed by
Volker Friese
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Improve handling of required options in histserv_nofairmq + cleanup
parent
91a7345e
No related branches found
No related tags found
1 merge request
!1212
Add services main folder + histogram server binary w/o FairMQ + tester binary example
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
services/histserv/app/ProgramOptions.cxx
+13
-18
13 additions, 18 deletions
services/histserv/app/ProgramOptions.cxx
with
13 additions
and
18 deletions
services/histserv/app/ProgramOptions.cxx
+
13
−
18
View file @
867f02f9
...
...
@@ -22,38 +22,34 @@ namespace cbm::services::histserv
{
// --- Define generic options
po
::
options_description
generic
(
"Generic options"
);
po
::
options_description
generic
(
"
Generic options"
);
auto
generic_add
=
generic
.
add_options
();
generic_add
(
"help,h"
,
"display this help and exit"
);
// --- Build default config file path
//string defconfig = std::getenv("VMCWORKDIR");
//defconfig.append("/");
//defconfig.append(DEFAULT_CONFIG);
// --- Define configuration options: Mandatory
po
::
options_description
config_req
(
" Configuration (required)"
);
auto
config_req_add
=
config_req
.
add_options
();
config_req_add
(
"input,i"
,
po
::
value
<
string
>
(
&
fsChanHistosIn
)
->
required
()
->
value_name
(
"<protocol://xxxxxx>"
),
"name or host:port or whatever is needed for input channel (histos/canvases config and data), "
"cf http://api.zeromq.org/2-1:zmq-bind"
);
// --- Define configuration options
po
::
options_description
config
(
"Configuration"
);
// --- Define configuration options
: Optional
po
::
options_description
config
(
"
Configuration
(optional or with default)
"
);
auto
config_add
=
config
.
add_options
();
config_add
(
"input,i"
,
po
::
value
<
string
>
(
&
fsChanHistosIn
)
->
value_name
(
"<protocol://xxxxxx>"
),
"name or host:port or whatever is needed for input channel (histos/canvases config and data), "
" cf http://api.zeromq.org/2-1:zmq-bind"
);
config_add
(
"port,p"
,
po
::
value
<
uint32_t
>
(
&
fuHttpServerPort
)
->
default_value
(
8080
),
"port on which the http ROOT server (JSroot) will be available"
);
"port on which the http ROOT server (JSroot) will be available
(mind default value!)
"
);
config_add
(
"output,o"
,
po
::
value
<
string
>
(
&
fsHistoFileName
)
->
value_name
(
"<file name>"
),
"name of the output ROOT file with histograms backup"
);
// config_add("config,c", po::value<string>(&fConfig)->value_name("<file name>")->default_value(defconfig),
// "name of a YAML file describing the configuration of reconstruction");
config_add
(
"overwrite,w"
,
po
::
bool_switch
(
&
fOverwrite
)
->
default_value
(
false
),
"allow to overwite an existing output file"
);
// --- Allowed options
po
::
options_description
cmdline_options
(
"Allowed options"
);
cmdline_options
.
add
(
generic
).
add
(
config
);
cmdline_options
.
add
(
generic
).
add
(
config
_req
).
add
(
config
);
// --- Parse command line
po
::
variables_map
vars
;
po
::
store
(
po
::
parse_command_line
(
argc
,
argv
,
cmdline_options
),
vars
);
po
::
notify
(
vars
);
// --- Help: print help information and exit program
if
(
vars
.
count
(
"help"
)
!=
0u
)
{
...
...
@@ -61,9 +57,8 @@ namespace cbm::services::histserv
exit
(
EXIT_SUCCESS
);
}
// --- Catch mandatory parameters not being specified
if
(
vars
.
count
(
"input"
)
==
0u
)
{
throw
std
::
runtime_error
(
"no input channel specified"
);
}
if
(
vars
.
count
(
"port"
)
==
0u
)
{
throw
std
::
runtime_error
(
"no http port specified"
);
}
// --- Run notify after processing the help to avoid it being blocked by missing arguments
po
::
notify
(
vars
);
}
// --------------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment