Skip to content
Snippets Groups Projects
Commit 1e5393c7 authored by Tigran Mkrtchyan's avatar Tigran Mkrtchyan :coffee:
Browse files

frontend-gprc: initialize scheduler

parent 5b7ac24a
No related branches found
No related tags found
No related merge requests found
...@@ -124,18 +124,22 @@ void CtaRpcImpl::run(const std::string server_address) { ...@@ -124,18 +124,22 @@ void CtaRpcImpl::run(const std::string server_address) {
server->Wait(); server->Wait();
} }
CtaRpcImpl::CtaRpcImpl(cta::log::LogContext *lc, std::unique_ptr<cta::catalogue::Catalogue> &catalogue): CtaRpcImpl::CtaRpcImpl(cta::log::LogContext *lc, std::unique_ptr<cta::catalogue::Catalogue> &catalogue, std::unique_ptr <cta::Scheduler> &scheduler):
m_catalogue(std::move(catalogue)) { m_catalogue(std::move(catalogue)), m_scheduler(std::move(scheduler)) {
m_log = lc; m_log = lc;
} }
using namespace cta; using namespace cta;
using namespace cta::common;
int main(const int argc, char *const *const argv) { int main(const int argc, char *const *const argv) {
std::unique_ptr <cta::log::Logger> logger = std::unique_ptr<cta::log::Logger>(new log::StdoutLogger("cta-dev", "cta-grpc-frontend", true)); std::unique_ptr <cta::log::Logger> logger = std::unique_ptr<cta::log::Logger>(new log::StdoutLogger("cta-dev", "cta-grpc-frontend", true));
log::LogContext lc(*logger); log::LogContext lc(*logger);
// use castor config to avoid dependency on xroot-ssi
Configuration config("/etc/cta/cta.conf");
std::string server_address("0.0.0.0:17017"); std::string server_address("0.0.0.0:17017");
// Initialise the Catalogue // Initialise the Catalogue
...@@ -155,6 +159,16 @@ int main(const int argc, char *const *const argv) { ...@@ -155,6 +159,16 @@ int main(const int argc, char *const *const argv) {
exit(1); exit(1);
} }
CtaRpcImpl svc(&lc, catalogue);
// Initialise the Scheduler
auto backed = config.getConfEntString("ObjectStore", "BackendPath");
lc.log(log::INFO, "Using scheduler backend: " + backed);
auto sInit = cta::make_unique<SchedulerDBInit_t>("Frontend", backed, *logger);
auto scheddb = sInit->getSchedDB(*catalogue, *logger);
scheddb->setBottomHalfQueueSize(25000);
auto scheduler = cta::make_unique<cta::Scheduler>(*catalogue, *scheddb, 5, 2*1000*1000);
CtaRpcImpl svc(&lc, catalogue, scheduler);
svc.run(server_address); svc.run(server_address);
} }
\ No newline at end of file
...@@ -40,7 +40,7 @@ private: ...@@ -40,7 +40,7 @@ private:
cta::log::LogContext *m_log; cta::log::LogContext *m_log;
public: public:
CtaRpcImpl(cta::log::LogContext *lc, std::unique_ptr<cta::catalogue::Catalogue> &catalogue); CtaRpcImpl(cta::log::LogContext *lc, std::unique_ptr<cta::catalogue::Catalogue> &catalogue, std::unique_ptr<cta::Scheduler> &scheduler);
void run(const std::string server_address); void run(const std::string server_address);
Status Version(::grpc::ServerContext *context, const ::google::protobuf::Empty *request, ::cta::admin::Version *response); Status Version(::grpc::ServerContext *context, const ::google::protobuf::Empty *request, ::cta::admin::Version *response);
Status GetTapes(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::grpc::ServerWriter<::cta::admin::TapeLsItem>* writer); Status GetTapes(::grpc::ServerContext* context, const ::google::protobuf::Empty* request, ::grpc::ServerWriter<::cta::admin::TapeLsItem>* writer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment