-/* Copyright (c) 2018-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2018-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* this_actor namespace */
m.def_submodule("this_actor", "Bindings of the s4u::this_actor namespace. See the C++ documentation for details.")
+ .def(
+ "debug", [](const char* s) { XBT_DEBUG("%s", s); }, "Display a logging message of 'debug' priority.")
.def(
"info", [](const char* s) { XBT_INFO("%s", s); }, "Display a logging message of 'info' priority.")
.def(
}
});
},
- py::call_guard<py::gil_scoped_release>(), "");
+ py::call_guard<py::gil_scoped_release>(), "")
+ .def("get_pid", &simgrid::s4u::this_actor::get_pid, "Retrieves PID of the current actor")
+ .def("get_ppid", &simgrid::s4u::this_actor::get_ppid,
+ "Retrieves PPID of the current actor (i.e., the PID of its parent).");
/* Class Engine */
py::class_<Engine>(m, "Engine", "Simulation Engine")
.def(py::init([](std::vector<std::string> args) {
- auto argc = static_cast<int>(args.size());
- std::vector<char*> argv(args.size() + 1); // argv[argc] is nullptr
- std::transform(begin(args), end(args), begin(argv), [](std::string& s) { return &s.front(); });
- // Currently this can be dangling, we should wrap this somehow.
- return new simgrid::s4u::Engine(&argc, argv.data());
- }))
+ auto argc = static_cast<int>(args.size());
+ std::vector<char*> argv(args.size() + 1); // argv[argc] is nullptr
+ std::transform(begin(args), end(args), begin(argv), [](std::string& s) { return &s.front(); });
+ // Currently this can be dangling, we should wrap this somehow.
+ return new simgrid::s4u::Engine(&argc, argv.data());
+ }),
+ "The constructor should take the parameters from the command line, as is ")
.def_static("get_clock", &Engine::get_clock,
"The simulation time, ie the amount of simulated seconds since the simulation start.")
+ .def_static(
+ "instance", []() { return Engine::get_instance(); }, "Retrieve the simulation engine")
.def("get_all_hosts", &Engine::get_all_hosts, "Returns the list of all hosts found in the platform")
.def("load_platform", &Engine::load_platform, "Load a platform file describing the environment")
.def("load_deployment", &Engine::load_deployment, "Load a deployment file and launch the actors that it contains")
py::call_guard<py::gil_scoped_release>(), "Set concurrency limit for this link")
.def("set_host_wifi_rate", &simgrid::s4u::Link::set_host_wifi_rate, py::call_guard<py::gil_scoped_release>(),
"Set level of communication speed of given host on this Wi-Fi link")
+ .def("by_name", &simgrid::s4u::Link::by_name, "Retrieves a Link from its name, or dies")
.def("seal", &simgrid::s4u::Link::seal, py::call_guard<py::gil_scoped_release>(), "Seal this link")
.def_property_readonly(
"name",
}
});
},
- py::call_guard<py::gil_scoped_release>(), "Create an actor from a function or an object.")
+ py::call_guard<py::gil_scoped_release>(), "Create an actor from a function or an object. See the :ref:`example <s4u_ex_actors_create>`.")
.def_property(
"host", &Actor::get_host,
[](Actor* a, Host* h) {