Commit 75e983bc authored by Millian Poquet's avatar Millian Poquet
Browse files

[cli] add --dump-execution-context

parent 39cf5da3
......@@ -257,6 +257,8 @@ Workflow options:
workflows have completed.
Other options:
--dump-execution-context Does not run the actual simulation but dumps the execution
context on stdout (formatted as a JSON object).
--enable-time-sharing-on-compute Enables time sharing on compute machines:
One resource may compute several jobs at the same time.
--disable-time-sharing-on-storage Disables time sharing on storage machines:
......@@ -519,6 +521,7 @@ Other options:
// Other options
// *************
main_args.dump_execution_context = args["--dump-execution-context"].asBool();
main_args.allow_time_sharing_on_compute = args["--enable-time-sharing-on-compute"].asBool();
main_args.allow_time_sharing_on_storage = !(args["--disable-time-sharing-on-storage"].asBool());
if (args["--no-sched"].asBool())
......@@ -700,6 +703,36 @@ int main(int argc, char * argv[])
parse_main_args(argc, argv, main_args, return_code, run_simulation, run_unittests);
if (main_args.dump_execution_context)
{
using namespace rapidjson;
Document object;
auto & alloc = object.GetAllocator();
object.SetObject();
// Generate the content to dump
object.AddMember("socket_endpoint", Value().SetString(main_args.socket_endpoint.c_str(), alloc), alloc);
object.AddMember("redis_enabled", Value().SetBool(main_args.redis_enabled), alloc);
object.AddMember("redis_hostname", Value().SetString(main_args.redis_hostname.c_str(), alloc), alloc);
object.AddMember("redis_port", Value().SetInt(main_args.redis_port), alloc);
object.AddMember("redis_prefix", Value().SetString(main_args.redis_prefix.c_str(), alloc), alloc);
object.AddMember("export_prefix", Value().SetString(main_args.export_prefix.c_str(), alloc), alloc);
object.AddMember("external_scheduler", Value().SetBool(main_args.program_type == ProgramType::BATSIM), alloc);
// Dump the object to a string
StringBuffer buffer;
rapidjson::Writer<StringBuffer> writer(buffer);
object.Accept(writer);
// Print the string then terminate
printf("%s\n", buffer.GetString());
//std::cout << buffer.GetString() << std::endl;
return 0;
}
if (run_unittests)
{
MSG_init(&argc, argv);
......
......@@ -100,6 +100,7 @@ struct MainArguments
// Other
std::list<std::pair<std::string, std::string>> simgrid_config; //!< The list of configuration options to pass to SimGrid.
bool dump_execution_context; //!< Instead of running the simulation, print the execution context as JSON on the standard output.
bool allow_time_sharing_on_compute; //!< 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; //!< Allows/forbids time sharing on storage machines. Two jobs can run on the same machine if and only if time sharing is allowed.
ProgramType program_type; //!< The program type (Batsim or Batexec at the moment)
......
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