Skip to content

Commit

Permalink
Clear Point-to-Point broker (faasm#263)
Browse files Browse the repository at this point in the history
* ptp: clear broker in executor and scheduler

* executor: reset thread local cache every time

* executor: remove unnecessary TLS cleanup

* tests: add specific test for executor cleanup
  • Loading branch information
csegarragonz authored May 9, 2022
1 parent cc33bd6 commit 53896e4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ void Scheduler::reset()
}
executors.clear();

// Clear the point to point broker
broker.clear();

faabric::util::FullLock lock(mx);

// Ensure host is set correctly
Expand Down
7 changes: 7 additions & 0 deletions tests/test/transport/test_point_to_point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ TEST_CASE_METHOD(PointToPointClientServerFixture,
REQUIRE(receivedDataB == sentDataB);
REQUIRE(receivedDataC == sentDataC);

// Clear local records
broker.resetThreadLocalCache();

// Clear broker
broker.clear();
REQUIRE(broker.getIdxsRegisteredForGroup(groupId).empty());

conf.reset();
}

Expand Down
22 changes: 22 additions & 0 deletions tests/test/transport/test_point_to_point_groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ class PointToPointGroupFixture
std::shared_ptr<faabric::BatchExecuteRequest> req = nullptr;
};

TEST_CASE_METHOD(PointToPointGroupFixture,
"Test removing mappings from point-to-point broker",
"[transport][ptp]")
{
int appId = 123;
int groupId = 456;
int groupSize = 3;

auto group = setUpGroup(appId, groupId, groupSize);

REQUIRE(broker.getIdxsRegisteredForGroup(groupId).size() == groupSize);

SECTION("Clear through broker") { broker.clear(); }

SECTION("Clear through scheduler reset")
{
faabric::scheduler::getScheduler().reset();
}

REQUIRE(broker.getIdxsRegisteredForGroup(groupId).empty());
}

TEST_CASE_METHOD(PointToPointGroupFixture,
"Test lock requests",
"[ptp][transport]")
Expand Down

0 comments on commit 53896e4

Please sign in to comment.