Skip to content

Commit

Permalink
dist-tests: fix server compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
csegarragonz committed Jan 16, 2024
1 parent 67f7820 commit 6e1b29c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
4 changes: 2 additions & 2 deletions examples/server.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/executor/ExecutorFactory.h>
#include <faabric/runner/FaabricMain.h>
#include <faabric/scheduler/ExecutorFactory.h>
#include <faabric/util/logging.h>

using namespace faabric::scheduler;
using namespace faabric::executor;

class ExampleExecutor : public Executor
{
Expand Down
43 changes: 19 additions & 24 deletions tests/dist/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#include "init.h"

#include <faabric/endpoint/FaabricEndpoint.h>
#include <faabric/executor/ExecutorFactory.h>
#include <faabric/runner/FaabricMain.h>
#include <faabric/scheduler/ExecutorFactory.h>
#include <faabric/util/logging.h>

using namespace faabric::scheduler;

int main()
{
faabric::util::initLogging();
Expand All @@ -20,26 +18,23 @@ int main()
res.set_slots(slots);
faabric::scheduler::getScheduler().setThisHostResources(res);

// WARNING: All 0MQ operations must be contained within their own scope so
// that all sockets are destructed before the context is closed.
{
SPDLOG_INFO("Starting distributed test server on worker");
std::shared_ptr<ExecutorFactory> fac =
std::make_shared<tests::DistTestExecutorFactory>();
faabric::runner::FaabricMain m(fac);
m.startBackground();

SPDLOG_INFO("---------------------------------");
SPDLOG_INFO("Distributed test server started");
SPDLOG_INFO("---------------------------------");

// Endpoint will block until killed
SPDLOG_INFO("Starting HTTP endpoint on worker");
faabric::endpoint::FaabricEndpoint endpoint;
endpoint.start(faabric::endpoint::EndpointMode::SIGNAL);

SPDLOG_INFO("Shutting down");
m.shutdown();
}
SPDLOG_INFO("Starting distributed test server on worker");
std::shared_ptr<faabric::executor::ExecutorFactory> fac =
std::make_shared<tests::DistTestExecutorFactory>();
faabric::runner::FaabricMain m(fac);
m.startBackground();

SPDLOG_INFO("---------------------------------");
SPDLOG_INFO("Distributed test server started");
SPDLOG_INFO("---------------------------------");

// Endpoint will block until killed
SPDLOG_INFO("Starting HTTP endpoint on worker");
faabric::endpoint::FaabricEndpoint endpoint;
endpoint.start(faabric::endpoint::EndpointMode::SIGNAL);

SPDLOG_INFO("Shutting down");
m.shutdown();

return EXIT_SUCCESS;
}

0 comments on commit 6e1b29c

Please sign in to comment.