Skip to content

Commit

Permalink
Merge branch 'exec-app' into omp-elastic
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed May 6, 2024
2 parents c0fff8d + c228c0f commit d11003e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ int Scheduler::reapStaleExecutors()
long Scheduler::getFunctionExecutorCount(const faabric::Message& msg)
{
faabric::util::SharedLock lock(mx);
const std::string funcStr = faabric::util::funcToString(msg, false);
const std::string funcStr = faabric::util::funcToString(msg, true);
return executors[funcStr].size();
}

Expand All @@ -252,7 +252,8 @@ void Scheduler::executeBatch(std::shared_ptr<faabric::BatchExecuteRequest> req)
faabric::util::FullLock lock(mx);

bool isThreads = req->type() == faabric::BatchExecuteRequest::THREADS;
auto funcStr = faabric::util::funcToString(req);
auto funcStr = faabric::util::funcToString(req->messages(0), true);

int nMessages = req->messages_size();

// Records for tests - copy messages before execution to avoid races
Expand All @@ -265,8 +266,8 @@ void Scheduler::executeBatch(std::shared_ptr<faabric::BatchExecuteRequest> req)
// For threads we only need one executor, for anything else we want
// one Executor per function in flight.
if (isThreads) {
// Threads use the existing executor. We assume there's only
// one running at a time.
// Threads use the existing executor. There must only be one at a time,
// thus we use a function string that includes the app id
std::vector<std::shared_ptr<faabric::executor::Executor>>&
thisExecutors = executors[funcStr];

Expand Down Expand Up @@ -335,7 +336,7 @@ std::shared_ptr<faabric::executor::Executor> Scheduler::claimExecutor(
faabric::Message& msg,
faabric::util::FullLock& schedulerLock)
{
std::string funcStr = faabric::util::funcToString(msg, false);
std::string funcStr = faabric::util::funcToString(msg, true);

std::vector<std::shared_ptr<faabric::executor::Executor>>& thisExecutors =
executors[funcStr];
Expand Down
2 changes: 1 addition & 1 deletion src/util/func.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ std::string funcToString(const faabric::Message& msg, bool includeId)
std::string str = msg.user() + "/" + msg.function();

if (includeId) {
str += ":" + std::to_string(msg.id());
str += ":" + std::to_string(msg.appid());
}

return str;
Expand Down

0 comments on commit d11003e

Please sign in to comment.