diff --git a/frontend_svc/gRPC/FrontendGRpcSvc.cpp b/frontend_svc/gRPC/FrontendGRpcSvc.cpp index 93ac131d3926a94231a31d3a8cfe7acdcae7f821..5009598de034ab680abe721bad5315077bbc7e6b 100644 --- a/frontend_svc/gRPC/FrontendGRpcSvc.cpp +++ b/frontend_svc/gRPC/FrontendGRpcSvc.cpp @@ -124,18 +124,22 @@ void CtaRpcImpl::run(const std::string server_address) { server->Wait(); } -CtaRpcImpl::CtaRpcImpl(cta::log::LogContext *lc, std::unique_ptr<cta::catalogue::Catalogue> &catalogue): - m_catalogue(std::move(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_scheduler(std::move(scheduler)) { m_log = lc; } using namespace cta; +using namespace cta::common; 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)); 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"); // Initialise the Catalogue @@ -155,6 +159,16 @@ int main(const int argc, char *const *const argv) { 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); -} \ No newline at end of file +} diff --git a/frontend_svc/gRPC/FrontendGRpcSvc.h b/frontend_svc/gRPC/FrontendGRpcSvc.h index dedad2198b67115ab520bcde1d6e2e83814a4f2b..b4048d689987d76e11f1eec5d63f01ec0e07dace 100644 --- a/frontend_svc/gRPC/FrontendGRpcSvc.h +++ b/frontend_svc/gRPC/FrontendGRpcSvc.h @@ -40,7 +40,7 @@ private: cta::log::LogContext *m_log; 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); 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);