File Scheduler.h

Defines

DEFAULT_THREAD_RESULT_TIMEOUT_MS
namespace faabric
namespace scheduler
class Scheduler

Public Functions

Scheduler()
~Scheduler()
void executeBatch(std::shared_ptr<faabric::BatchExecuteRequest> req)
void reset()
void resetThreadLocalCache()
void shutdown()
inline bool isShutdown()
void broadcastSnapshotDelete(const faabric::Message &msg, const std::string &snapshotKey)
int reapStaleExecutors()
long getFunctionExecutorCount(const faabric::Message &msg)
void setThreadResultLocally(uint32_t appId, uint32_t msgId, int32_t returnValue, faabric::transport::Message &message)

Caches a message along with the thread result, to allow the thread result to refer to data held in that message (i.e. snapshot diffs). The message will be destroyed once the thread result is consumed.

std::vector<std::pair<uint32_t, int32_t>> awaitThreadResults(std::shared_ptr<faabric::BatchExecuteRequest> req, int timeoutMs = DEFAULT_THREAD_RESULT_TIMEOUT_MS)
size_t getCachedMessageCount()
std::string getThisHost()
void addHostToGlobalSet()
void addHostToGlobalSet(const std::string &host, std::shared_ptr<faabric::HostResources> overwriteResources = nullptr)
void removeHostFromGlobalSet(const std::string &host)
void setThisHostResources(faabric::HostResources &res)
std::vector<faabric::Message> getRecordedMessages()
void clearRecordedMessages()
std::shared_ptr<faabric::PendingMigration> checkForMigrationOpportunities(faabric::Message &msg, int overwriteNewGroupId = 0)

Private Functions

std::shared_ptr<faabric::executor::Executor> claimExecutor(faabric::Message &msg, faabric::util::FullLock &schedulerLock)

Private Members

std::string thisHost
faabric::util::SystemConfig &conf
std::shared_mutex mx
std::atomic<bool> _isShutdown = false
std::unordered_map<std::string, std::vector<std::shared_ptr<faabric::executor::Executor>>> executors
faabric::snapshot::SnapshotRegistry &reg
std::unordered_map<uint32_t, faabric::transport::Message> threadResultMessages
faabric::planner::KeepAliveThread keepAliveThread
SchedulerReaperThread reaperThread
std::vector<faabric::Message> recordedMessages
faabric::transport::PointToPointBroker &broker
class SchedulerReaperThread : public faabric::util::PeriodicBackgroundThread
#include <Scheduler.h>

Background thread that periodically checks to see if any executors have become stale (i.e. not handled any requests in a given timeout). If any are found, they are removed.

Public Functions

virtual void doWork() override