Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 0436bb8c authored by Millian Poquet's avatar Millian Poquet
Browse files

Merge branch '98-expose-simgrid-log-options-to-batsim-CLI' into 'master'

Resolve "Expose SimGrid log options to Batsim CLI"

Closes #98

See merge request !16
!16
parents d250bb13 8911ef3c
...@@ -42,6 +42,7 @@ Batsim's public API includes: ...@@ -42,6 +42,7 @@ Batsim's public API includes:
### Added (new command-line options) ### Added (new command-line options)
- New ``--sg-cfg`` option, that allows to set SimGrid configuration options. - New ``--sg-cfg`` option, that allows to set SimGrid configuration options.
- New ``--sg-log`` option, that allows to set SimGrid logging options.
- New ``--dump-execution-context`` option, that dumps the command execution - New ``--dump-execution-context`` option, that dumps the command execution
context on the standard output. This allows external tools to understand context on the standard output. This allows external tools to understand
the execution context of a batsim command without actually parsing it. the execution context of a batsim command without actually parsing it.
......
...@@ -56,6 +56,7 @@ Added (new command-line options) ...@@ -56,6 +56,7 @@ Added (new command-line options)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- New ``--sg-cfg`` option, that allows to set SimGrid configuration options. - New ``--sg-cfg`` option, that allows to set SimGrid configuration options.
- New ``--sg-log`` option, that allows to set SimGrid logging options.
- New ``--dump-execution-context`` option, - New ``--dump-execution-context`` option,
that dumps the command execution context on the standard output. that dumps the command execution context on the standard output.
This allows external tools to understand the execution context of a batsim command without actually parsing it. This allows external tools to understand the execution context of a batsim command without actually parsing it.
......
...@@ -176,6 +176,7 @@ Usage: ...@@ -176,6 +176,7 @@ Usage:
[-W <workflow_file>...] [-W <workflow_file>...]
[--WS (<cut_workflow_file> <start_time>)...] [--WS (<cut_workflow_file> <start_time>)...]
[--sg-cfg <opt_name:opt_value>...] [--sg-cfg <opt_name:opt_value>...]
[--sg-log <log_option>...]
[-r <hosts_roles_map>...] [-r <hosts_roles_map>...]
[options] [options]
batsim --help batsim --help
...@@ -266,8 +267,10 @@ Other options: ...@@ -266,8 +267,10 @@ Other options:
--no-sched If set, the jobs in the workloads are --no-sched If set, the jobs in the workloads are
computed one by one, one after the other, computed one by one, one after the other,
without scheduler nor Redis. without scheduler nor Redis.
--sg-cfg <opt_name:opt_value>... Forward a given option_name:option_value to SimGrid. --sg-cfg <opt_name:opt_value>... Forwards a given option_name:option_value to SimGrid.
Refer to SimGrid documentation for more information. Refer to SimGrid configuring documentation for more information.
--sg-log <log_option>... Forwards a given logging option to SimGrid.
Refer to SimGrid simulation logging documentation for more information.
-h, --help Shows this help. -h, --help Shows this help.
)"; )";
...@@ -533,16 +536,8 @@ Other options: ...@@ -533,16 +536,8 @@ Other options:
main_args.program_type = ProgramType::BATSIM; main_args.program_type = ProgramType::BATSIM;
} }
vector<string> sg_cfg_list = args["--sg-cfg"].asStringList(); main_args.simgrid_config = args["--sg-cfg"].asStringList();
for (string cfg_string : sg_cfg_list) main_args.simgrid_config = args["--sg-log"].asStringList();
{
vector<string> parsed;
boost::split(parsed, cfg_string, boost::is_any_of(":"));
xbt_assert(parsed.size() == 2, "A SimGrid configuration option should only contain one ':' character");
pair<string,string> cfg_pair(parsed[0], parsed[1]);
main_args.simgrid_config.push_back(cfg_pair);
}
run_simulation = !error; run_simulation = !error;
} }
...@@ -755,12 +750,15 @@ int main(int argc, char * argv[]) ...@@ -755,12 +750,15 @@ int main(int argc, char * argv[])
simgrid::s4u::Engine engine(&argc, argv); simgrid::s4u::Engine engine(&argc, argv);
// Setting SimGrid configuration options, if any // Setting SimGrid configuration options, if any
if (main_args.simgrid_config.size() > 0) for (const string & cfg_string : main_args.simgrid_config)
{ {
for (pair<string,string> cfg_pair : main_args.simgrid_config) engine.set_config(cfg_string);
{ }
engine.set_config(cfg_pair.first + ":" + cfg_pair.second);
} // Setting SimGrid logging options, if any
for (const string & log_string : main_args.simgrid_logging)
{
xbt_log_control_set(log_string.c_str());
} }
// Let's create the BatsimContext, which stores information about the current instance // Let's create the BatsimContext, which stores information about the current instance
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <string> #include <string>
#include <list> #include <list>
#include <map> #include <map>
#include <vector>
#include <rapidjson/document.h> #include <rapidjson/document.h>
...@@ -99,7 +100,8 @@ struct MainArguments ...@@ -99,7 +100,8 @@ struct MainArguments
bool terminate_with_last_workflow = false; //!< If true, allows to ignore the jobs submitted after the last workflow termination bool terminate_with_last_workflow = false; //!< If true, allows to ignore the jobs submitted after the last workflow termination
// Other // Other
std::list<std::pair<std::string, std::string>> simgrid_config; //!< The list of configuration options to pass to SimGrid. std::vector<std::string> simgrid_config; //!< The list of configuration options to pass to SimGrid.
std::vector<std::string> simgrid_logging; //!< The list of simulation logging options to pass to SimGrid.
bool dump_execution_context = false; //!< Instead of running the simulation, print the execution context as JSON on the standard output. bool dump_execution_context = false; //!< Instead of running the simulation, print the execution context as JSON on the standard output.
bool allow_time_sharing_on_compute = false; //!< Allows/forbids time sharing on compute machines. Two jobs can run on the same machine if and only if time sharing is allowed. bool allow_time_sharing_on_compute = false; //!< Allows/forbids time sharing on compute machines. Two jobs can run on the same machine if and only if time sharing is allowed.
bool allow_time_sharing_on_storage = false; //!< Allows/forbids time sharing on storage machines. Two jobs can run on the same machine if and only if time sharing is allowed. bool allow_time_sharing_on_storage = false; //!< Allows/forbids time sharing on storage machines. Two jobs can run on the same machine if and only if time sharing is allowed.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment