Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix container and image issues #26

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neuland/application/R3BNeulandAnalysisApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
void print_json_options() override;
void dump_json_options(const std::string& filename) override;
void setup_application_options(CLI::App& program_options) override;
void ParseApplicationOption(const std::string& filename) override
void ParseApplicationOption(const std::vector<std::string>& filename) override

Check warning on line 115 in neuland/application/R3BNeulandAnalysisApp.h

View workflow job for this annotation

GitHub Actions / clang-lint (default, ubuntu-latest)

neuland/application/R3BNeulandAnalysisApp.h:115:48 [misc-include-cleaner]

no header providing "std::vector" is directly included
{
ParseApplicationOptionImp(filename, options_);
}
Expand Down
15 changes: 9 additions & 6 deletions neuland/application/R3BNeulandApp.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "R3BFileSource2.h"
#include "R3BNeulandApp.h"
#include "R3BFileSource2.h"
#include <CLI/CLI.hpp>

Check warning on line 3 in neuland/application/R3BNeulandApp.cxx

View workflow job for this annotation

GitHub Actions / clang-lint (default, ubuntu-latest)

neuland/application/R3BNeulandApp.cxx:3:1 [misc-include-cleaner]

included header CLI.hpp is not used directly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostics

Please remove the line(s)

  • 3

#include <FairParRootFileIo.h>
#include <FairRootFileSink.h>
#include <FairRun.h>
Expand Down Expand Up @@ -96,7 +96,7 @@
dump_json_filename_ = filename;
};

auto use_config_callback = [this](const std::string& filename)
auto use_config_callback = [this](const std::vector<std::string>& filename)

Check warning on line 99 in neuland/application/R3BNeulandApp.cxx

View workflow job for this annotation

GitHub Actions / clang-lint (default, ubuntu-latest)

neuland/application/R3BNeulandApp.cxx:99:54 [misc-include-cleaner]

no header providing "std::vector" is directly included

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy diagnostic

neuland/application/R3BNeulandApp.cxx:99:54: warning: [misc-include-cleaner]

no header providing "std::vector" is directly included

   99 |         auto use_config_callback = [this](const std::vector<std::string>& filename)
      |                                                      ^

{
if (not is_already_parsed_)
{
Expand All @@ -107,10 +107,10 @@

auto& options = option_.get();
program_options
.add_option_function<std::string>("-c, --config-file", use_config_callback, "Set the json config file")
.add_option_function<std::vector<std::string>>(
"-c, --config-file", use_config_callback, "Set the json config file")
->default_val(fmt::format("{}_{}", app_name_, DEFAULT_JSON_FILENAME))
->run_callback_for_default()
->expected(0, 1)
->trigger_on_parse();
program_options.add_flag("--print-config", has_print_default_options_, "Print default option value");
program_options
Expand Down Expand Up @@ -150,7 +150,6 @@
void Application::add_inout_files()
{
const auto& option = option_.get();
// output files:
const auto output_name =
option.enable_mpi ? fmt::format("{}.{}", option.output.data, rank_num_) : option.output.data;
if (not option_.get().output.data.empty())
Expand All @@ -164,6 +163,7 @@
if (option_.get().run_id >= 0)
{
file_source->SetInitRunID(option_.get().run_id);
run_->SetRunId(option_.get().run_id);
R3BLOG(info, fmt::format("Filesource2: Set to run id {}", option_.get().run_id));
}
add_input_filename(file_source.get());
Expand Down Expand Up @@ -191,8 +191,11 @@

if (not option_.get().output.par.empty())
{
const auto& option = option_.get();
const auto output_name =
option.enable_mpi ? fmt::format("{}.{}", option.output.par, rank_num_) : option.output.par;
auto fileio = std::make_unique<FairParRootFileIo>(true);
fileio->open(option_.get().output.par.c_str(), "RECREATE");
fileio->open(output_name.c_str(), "RECREATE");
auto* rtdb = run_->GetRuntimeDb();
rtdb->setOutput(fileio.release());
}
Expand Down
18 changes: 12 additions & 6 deletions neuland/application/R3BNeulandApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace R3B::Neuland

protected:
template <typename OptionType>
void ParseApplicationOptionImp(const std::string& filename, OptionType& option);
void ParseApplicationOptionImp(const std::vector<std::string>& filename, OptionType& option);

private:
bool is_failed_ = false;
Expand All @@ -127,7 +127,7 @@ namespace R3B::Neuland

// private virtual methods:
virtual void pre_init(FairRun* run) = 0;
virtual void ParseApplicationOption(const std::string& filename) = 0;
virtual void ParseApplicationOption(const std::vector<std::string>& filename) = 0;
virtual void post_init(FairRun* run) {}
void add_input_filename(R3BFileSource2* filesource);
virtual void print_json_options() {}
Expand Down Expand Up @@ -175,11 +175,17 @@ namespace R3B::Neuland
}

template <typename OptionType>
void Application::ParseApplicationOptionImp(const std::string& filename, OptionType& option)
void Application::ParseApplicationOptionImp(const std::vector<std::string>& filenames, OptionType& option)
{
auto file = std::ifstream{ filename };
auto json_obj = nlohmann::json{};
file >> json_obj;
auto json_obj = nlohmann::ordered_json{ option };
for (const auto& filename : filenames)
{
auto json_file_obj = nlohmann::ordered_json{};
auto file = std::ifstream{ filename };
file >> json_file_obj;
R3BLOG(info, fmt::format("Reading the configuration from the json file {:?}", filename));
json_obj.merge_patch(json_file_obj);
}
json_obj.get_to(option);
}
} // namespace R3B::Neuland
2 changes: 1 addition & 1 deletion neuland/application/R3BNeulandSimApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
void print_json_options() override;
void dump_json_options(const std::string& filename) override;
void run_action(FairRun* run, int num_of_events) override;
void ParseApplicationOption(const std::string& filename) override
void ParseApplicationOption(const std::vector<std::string>& filename) override

Check warning on line 71 in neuland/application/R3BNeulandSimApp.h

View workflow job for this annotation

GitHub Actions / clang-lint (default, ubuntu-latest)

neuland/application/R3BNeulandSimApp.h:71:48 [misc-include-cleaner]

no header providing "std::vector" is directly included
{
ParseApplicationOptionImp(filename, options_);
}
Expand Down
2 changes: 2 additions & 0 deletions neuland/executables/neuland_cli.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ auto main(int argc, char** argv) -> int
return EXIT_SUCCESS;
}

app->set_rank_num(num_rank);
app->set_num_of_procs(num_proc);
app->init();
app->run();
}
Expand Down
Loading