Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable/disable scheduling topology hints through an env. variable #188

Merged
merged 3 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/faabric/util/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class SystemConfig
// Scheduling
int noScheduler;
int overrideCpuCount;
std::string useTopologyHints;

// Worker-related timeouts
int globalMessageTimeout;
Expand Down
5 changes: 5 additions & 0 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,11 @@ faabric::util::SchedulingDecision Scheduler::makeSchedulingDecision(
faabric::Message& firstMsg = req->mutable_messages()->at(0);
std::string funcStr = faabric::util::funcToString(firstMsg, false);

// If topology hints are disabled, unset the provided topology hint
if (conf.useTopologyHints == "off") {
topologyHint = faabric::util::SchedulingTopologyHint::NORMAL;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change this to check if they're requesting anything other than NORMAL, then print a warning if so. We don't want to have this on accidentally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Now we:

  1. Check if env var set
  2. If set and hint different than NORMAL, print a warning and unset.


std::vector<std::string> hosts;
if (topologyHint == faabric::util::SchedulingTopologyHint::FORCE_LOCAL) {
// We're forced to execute locally here so we do all the messages
Expand Down
2 changes: 2 additions & 0 deletions src/util/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void SystemConfig::initialise()
// Scheduling
noScheduler = this->getSystemConfIntParam("NO_SCHEDULER", "0");
overrideCpuCount = this->getSystemConfIntParam("OVERRIDE_CPU_COUNT", "0");
useTopologyHints = getEnvVar("USE_TOPOLOGY_HINTS", "on");

// Worker-related timeouts (all in seconds)
globalMessageTimeout =
Expand Down Expand Up @@ -100,6 +101,7 @@ void SystemConfig::print()
SPDLOG_INFO("--- Scheduling ---");
SPDLOG_INFO("NO_SCHEDULER {}", noScheduler);
SPDLOG_INFO("OVERRIDE_CPU_COUNT {}", overrideCpuCount);
SPDLOG_INFO("USE_TOPOLOGY_HINTS {}", useTopologyHints);
csegarragonz marked this conversation as resolved.
Show resolved Hide resolved

SPDLOG_INFO("--- Timeouts ---");
SPDLOG_INFO("GLOBAL_MESSAGE_TIMEOUT {}", globalMessageTimeout);
Expand Down
4 changes: 4 additions & 0 deletions tests/test/util/test_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ TEST_CASE("Test default system config initialisation", "[util]")

csegarragonz marked this conversation as resolved.
Show resolved Hide resolved
REQUIRE(conf.noScheduler == 0);
REQUIRE(conf.overrideCpuCount == 0);
REQUIRE(conf.useTopologyHints == "on");

REQUIRE(conf.globalMessageTimeout == 60000);
REQUIRE(conf.boundTimeout == 30000);
Expand All @@ -44,6 +45,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

std::string noScheduler = setEnvVar("NO_SCHEDULER", "1");
std::string overrideCpuCount = setEnvVar("OVERRIDE_CPU_COUNT", "4");
std::string useTopologyHints = setEnvVar("USE_TOPOLOGY_HINTS", "off");

std::string globalTimeout = setEnvVar("GLOBAL_MESSAGE_TIMEOUT", "9876");
std::string boundTimeout = setEnvVar("BOUND_TIMEOUT", "6666");
Expand All @@ -70,6 +72,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

REQUIRE(conf.noScheduler == 1);
REQUIRE(conf.overrideCpuCount == 4);
REQUIRE(conf.useTopologyHints == "off");

REQUIRE(conf.globalMessageTimeout == 9876);
REQUIRE(conf.boundTimeout == 6666);
Expand All @@ -95,6 +98,7 @@ TEST_CASE("Test overriding system config initialisation", "[util]")

setEnvVar("NO_SCHEDULER", noScheduler);
setEnvVar("OVERRIDE_CPU_COUNT", overrideCpuCount);
setEnvVar("USE_TOPOLOGY_HINTS", useTopologyHints);

setEnvVar("GLOBAL_MESSAGE_TIMEOUT", globalTimeout);
setEnvVar("BOUND_TIMEOUT", boundTimeout);
Expand Down