Skip to content

Commit

Permalink
Update load balance policies to return vector of strings instead of a…
Browse files Browse the repository at this point in the history
… single string
  • Loading branch information
DonaldJennings committed Feb 14, 2024
1 parent 0376aa4 commit a268b3e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/loadbalance/LeastLoadAveragePolicy.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <faabric/loadbalance/LoadBalancePolicy.h>
#include <stdexcept>

std::string LeastLoadAveragePolicy::dispatch(const std::set<std::string>& warm_faaslets, int number_of_messages, faabric::scheduler::Scheduler& scheduler)
std::vector<std::string> LeastLoadAveragePolicy::dispatch(const std::set<std::string>& warm_faaslets, int number_of_messages, faabric::scheduler::Scheduler& scheduler)
{
throw std::runtime_error("LeastLoadAveragePolicy::dispatch not implemented");
}
2 changes: 1 addition & 1 deletion src/loadbalance/MostSlotsPolicy.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <faabric/loadbalance/LoadBalancePolicy.h>
#include <stdexcept>

std::string MostSlotsPolicy::dispatch(const std::set<std::string>& warm_faaslets, int number_of_messages, faabric::scheduler::Scheduler& scheduler)
std::vector<std::string> MostSlotsPolicy::dispatch(const std::set<std::string>& warm_faaslets, int number_of_messages, faabric::scheduler::Scheduler& scheduler)
{
throw std::runtime_error("MostSlotsPolicy::dispatch not implemented");
}
2 changes: 1 addition & 1 deletion src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ faabric::util::SchedulingDecision Scheduler::doSchedulingDecision(

FaasmDefaultPolicy policy;
const std::set<std::string>& thisRegisteredHosts = getFunctionRegisteredHosts(firstMsg.user(), firstMsg.function(), false);
std::vector<std::string> balanced_order = policy.dispatch(thisRegisteredHosts, remainder);
std::vector<std::string> balanced_order = policy.dispatch(thisRegisteredHosts, remainder, this); // Messy DI to get access to methods

remainder -= balanced_order.size();
for (const auto& h : balanced_order) {
Expand Down

0 comments on commit a268b3e

Please sign in to comment.