exec->wait();
XBT_INFO("Done!");
+
+ XBT_INFO("And now, even harder. Start a remote activity on Ginette and turn off the host after 0.5 sec");
+ exec = simgrid::s4u::this_actor::exec_init(48.492e6)->set_host(ginette);
+ exec->start();
+
+ simgrid::s4u::this_actor::sleep_for(0.5);
+ ginette->turn_off();
+ try {
+ exec->wait();
+ } catch (const simgrid::HostFailureException& e) {
+ XBT_INFO("Execution failed on %s", ginette->get_cname());
+ }
+ XBT_INFO("Done!");
}
int main(int argc, char* argv[])
> [ 1.500000] (1:test@Fafard) Loads before the move: Boivin=0; Fafard=0; Ginette=48492000
> [ 1.600000] (1:test@Fafard) Loads after the move: Boivin=98095000; Fafard=0; Ginette=0
> [ 2.000000] (1:test@Fafard) Done!
+> [ 2.000000] (1:test@Fafard) And now, even harder. Start a remote activity on Ginette and turn off the host after 0.5 sec
+> [ 2.500000] (1:test@Fafard) Execution failed on Ginette
+> [ 2.500000] (1:test@Fafard) Done!
#include "simgrid/exec.h"
#include "simgrid/s4u/Actor.hpp"
#include "simgrid/s4u/Exec.hpp"
+#include "simgrid/s4u/Host.hpp"
#include "src/kernel/activity/ExecImpl.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include "src/kernel/actor/SimcallObserver.hpp"
ExecPtr Exec::init()
{
auto pimpl = kernel::activity::ExecImplPtr(new kernel::activity::ExecImpl());
+ Host::on_state_change.connect([pimpl](s4u::Host const& h) {
+ if (not h.is_on() && pimpl->state_ == kernel::activity::State::RUNNING &&
+ std::find(pimpl->get_hosts().begin(), pimpl->get_hosts().end(), &h) != pimpl->get_hosts().end()) {
+ pimpl->state_ = kernel::activity::State::FAILED;
+ pimpl->post();
+ }
+ });
return ExecPtr(pimpl->get_iface());
}