From: Martin Quinson Date: Fri, 21 Jul 2023 19:37:13 +0000 (+0200) Subject: cosmetics X-Git-Tag: v3.35~131 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0f900e71408bea4d6bbcceb9fcd01a409ae30287 cosmetics --- diff --git a/examples/python/activityset-waitany/activityset-waitany.py b/examples/python/activityset-waitany/activityset-waitany.py index c2139a8cb8..4f16d7da20 100644 --- a/examples/python/activityset-waitany/activityset-waitany.py +++ b/examples/python/activityset-waitany/activityset-waitany.py @@ -50,71 +50,3 @@ if __name__ == '__main__': Actor.create("alice", Host.by_name("alice"), alice) e.run() - -""" - -/* Copyright (c) 2010-2023. 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. */ - -#include "simgrid/s4u.hpp" -#include -#include -#include -namespace sg4 = simgrid::s4u; - -XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_activity_waittany, "Messages specific for this s4u example"); - -static void bob() -{ - sg4::Mailbox* mbox = sg4::Mailbox::by_name("mbox"); - const sg4::Disk* disk = sg4::Host::current()->get_disks().front(); - std::string* payload; - - XBT_INFO("Create my asynchronous activities"); - auto exec = sg4::this_actor::exec_async(5e9); - auto comm = mbox->get_async(&payload); - auto io = disk->read_async(3e8); - - sg4::ActivitySet pending_activities({boost::dynamic_pointer_cast(exec), - boost::dynamic_pointer_cast(comm), - boost::dynamic_pointer_cast(io)}); - - XBT_INFO("Wait for asynchronous activities to complete"); - while (not pending_activities.empty()) { - auto completed_one = pending_activities.wait_any(); - if (completed_one != nullptr) { - if (boost::dynamic_pointer_cast(completed_one)) - XBT_INFO("Completed a Comm"); - if (boost::dynamic_pointer_cast(completed_one)) - XBT_INFO("Completed an Exec"); - if (boost::dynamic_pointer_cast(completed_one)) - XBT_INFO("Completed an I/O"); - } - } - XBT_INFO("Last activity is complete"); - delete payload; -} - -static void alice() -{ - auto* payload = new std::string("Message"); - XBT_INFO("Send '%s'", payload->c_str()); - sg4::Mailbox::by_name("mbox")->put(payload, 6e8); -} - -int main(int argc, char* argv[]) -{ - sg4::Engine e(&argc, argv); - - e.load_platform(argv[1]); - - sg4::Actor::create("bob", e.host_by_name("bob"), bob); - sg4::Actor::create("alice", e.host_by_name("alice"), alice); - - e.run(); - - return 0; -} -""" \ No newline at end of file diff --git a/examples/python/task-switch-host/task-switch-host.py b/examples/python/task-switch-host/task-switch-host.py index b2904c3f56..5be8922534 100644 --- a/examples/python/task-switch-host/task-switch-host.py +++ b/examples/python/task-switch-host/task-switch-host.py @@ -4,12 +4,12 @@ # under the terms of the license (GNU LGPL) which comes with this package. """ -/* This example demonstrates how to dynamically modify a graph of tasks. - * - * Assuming we have two instances of a service placed on different hosts, - * we want to send data alternatively to thoses instances. - * - * We consider the following graph: +This example demonstrates how to dynamically modify a graph of tasks. + +Assuming we have two instances of a service placed on different hosts, +we want to send data alternatively to thoses instances. + +We consider the following graph: comm1 ┌────────────────────────┐ @@ -26,8 +26,8 @@ │ │ └────────────────────────┘ comm2 - */ - """ + +""" from argparse import ArgumentParser import sys