Skip to content

Commit

Permalink
Add array file association for cpp files and handle exceptions in Faa…
Browse files Browse the repository at this point in the history
…bricEndpointHandler::onRequest
  • Loading branch information
DonaldJennings committed Feb 14, 2024
1 parent 3ffd4d6 commit 6dd73dd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.associations": {
"array": "cpp"
}
}
18 changes: 16 additions & 2 deletions src/endpoint/FaabricEndpointHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,22 @@ void FaabricEndpointHandler::onRequest(
response.result(beast::http::status::ok);
response.body() = std::string("Flush sent");
} else {
executeFunction(
std::move(ctx), std::move(response), std::move(msg));
try
{
executeFunction(std::move(ctx), std::move(response), std::move(msg));
}
catch (const std::exception& e)
{
SPDLOG_ERROR("Caught exception in FaabricEndpointHandler::onRequest: {}", e.what());
response.result(beast::http::status::internal_server_error);
response.body() = std::string("Caught exception: ") + e.what();
ctx.sendFunction(std::move(response));
} catch (faabric::util::FaabricException& e) {
SPDLOG_ERROR("Caught FaabricException in FaabricEndpointHandler::onRequest: {}", e.what());
response.result(beast::http::status::internal_server_error);
response.body() = std::string("Caught exception: ") + e.what();
ctx.sendFunction(std::move(response));
}
return;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ faabric::util::SchedulingDecision Scheduler::doSchedulingDecision(
lastHost = h;
// Work out resources on the remote host
SPDLOG_DEBUG("Checkig unregeistered {} for resources", h);
SPDLOG_DEBUG("Remaining: {}", remainder);

faabric::HostResources r = getHostResources(h);
int available = r.slots() - r.usedslots();

Expand Down

0 comments on commit 6dd73dd

Please sign in to comment.