Skip to content

Commit

Permalink
config: Introduce dry_run option
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Aug 26, 2022
1 parent 55403b4 commit f2e34e7
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"/tmp/path/to/payload/data1"
],
"use_cache": true,
"dry_run": false,
"verbosity": 2,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions config/devxpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"/path/to/payload/data"
],
"use_cache": true,
"dry_run": false,
"verbosity": 2,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions config/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"/cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/calibrations/DBTest/"
],
"use_cache": true,
"dry_run": false,
"verbosity": 0,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions config/prodxpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"/cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/calibrations/DBTest/"
],
"use_cache": true,
"dry_run": false,
"verbosity": 0,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions config/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"/cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/calibrations/DBTest/"
],
"use_cache": true,
"dry_run": false,
"verbosity": 1,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions config/testxpl.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"/cvmfs/sphenix.sdcc.bnl.gov/gcc-8.3/opt/sphenix/core/calibrations/DBTest/"
],
"use_cache": true,
"dry_run": false,
"verbosity": 1,
"retry_times": 5,
"retry_max_delay": 60
Expand Down
1 change: 1 addition & 0 deletions include/xpload/configurator.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct DbConfig
std::string apiver{""};
std::vector<std::filesystem::path> path{"/path/to/payload/data"};
bool use_cache{false};
bool dry_run{false};
int verbosity{0};
int retry_times{5};
int retry_max_delay{60};
Expand Down
1 change: 1 addition & 0 deletions src/configurator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void Configurator::ReadConfig(std::string filepath)
json["apiroot"], json["apiver"],
json["path"],
json["use_cache"],
json["dry_run"],
json["verbosity"],
json["retry_times"],
json["retry_max_delay"]
Expand Down
2 changes: 1 addition & 1 deletion src/fetch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void parse_response(const std::string& http_data, Result& result)
for (const auto& prefix : reqpars.cfg.db.path)
{
std::filesystem::path fullpath = prefix/obj["payload_type"]/obj["payload_iov"][0]["payload_url"].get<std::string>();
if (std::filesystem::exists(fullpath))
if (std::filesystem::exists(fullpath) || reqpars.cfg.db.dry_run)
{
result.paths.push_back(fullpath);
break;
Expand Down

0 comments on commit f2e34e7

Please sign in to comment.