Skip to content

Commit

Permalink
Clear static clients on scheduler reset (#332)
Browse files Browse the repository at this point in the history
* scheduler: clear clients upon scheduler reset

* scheduler: also clear-up this host used slots

* dist-tests: actually use separate planner

* planner: move logging to trace
  • Loading branch information
csegarragonz authored Jul 6, 2023
1 parent 1525b67 commit 9b90d3f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/planner/Planner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool Planner::registerHost(const Host& hostIn, bool overwrite)
it->second->set_slots(hostIn.slots());
it->second->set_usedslots(hostIn.usedslots());
} else if (it != state.hostMap.end()) {
SPDLOG_DEBUG("NOT overwritting host {} with {} slots (used {})",
SPDLOG_TRACE("NOT overwritting host {} with {} slots (used {})",
hostIn.ip(),
hostIn.slots(),
hostIn.usedslots());
Expand Down
6 changes: 6 additions & 0 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ void Scheduler::reset()
// Clear the point to point broker
broker.clear();

// Clear the clients
functionCallClients.clear();
snapshotClients.clear();
plannerClient.clear();

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

// Ensure host is set correctly
Expand All @@ -202,6 +207,7 @@ void Scheduler::reset()
thisHostResources = faabric::HostResources();
thisHostResources.set_slots(faabric::util::getUsableCores());
thisHostResources.set_usedslots(0);
thisHostUsedSlots.store(0, std::memory_order_release);

// Reset scheduler state
availableHostsCache.clear();
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/fixtures.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class PlannerClientServerFixture
{
public:
PlannerClientServerFixture()
: plannerCli(LOCALHOST)
: plannerCli(faabric::util::getSystemConfig().plannerHost)
{
plannerServer.start();
plannerCli.ping();
Expand Down

0 comments on commit 9b90d3f

Please sign in to comment.