18 #include "scanner/engine/metadata.h" 19 #include "scanner/engine/rpc.grpc.pb.h" 20 #include "scanner/engine/runtime.h" 22 #include <grpc/grpc_posix.h> 23 #include <grpc/support/log.h> 33 std::string worker_port);
37 grpc::Status NewJob(grpc::ServerContext* context,
38 const proto::BulkJobParameters* job_params,
39 proto::Result* job_result);
41 grpc::Status Shutdown(grpc::ServerContext* context,
const proto::Empty* empty,
44 grpc::Status Ping(grpc::ServerContext* context,
const proto::Empty* empty,
45 proto::PingReply* reply);
47 void start_watchdog(grpc::Server* server,
bool enable_timeout,
48 i32 timeout_ms = 300000);
50 Result register_with_master();
53 void try_unregister();
55 void load_op(
const proto::OpPath* op_path);
57 void register_op(
const proto::OpRegistration* op_registration);
59 void register_python_kernel(
const proto::PythonKernelRegistration* python_kernel);
61 void start_job_processor();
63 void stop_job_processor();
65 bool process_job(
const proto::BulkJobParameters* job_params,
66 proto::Result* job_result);
76 std::atomic_flag unregistered_ = ATOMIC_FLAG_INIT;
77 std::set<std::string> so_paths_;
79 std::thread watchdog_thread_;
80 std::atomic<bool> watchdog_awake_;
81 std::unique_ptr<proto::Master::Stub> master_;
82 storehouse::StorageConfig* storage_config_;
84 Flag trigger_shutdown_;
85 std::string master_address_;
86 std::string worker_port_;
88 storehouse::StorageBackend* storage_;
89 bool memory_pool_initialized_ =
false;
90 MemoryPoolConfig cached_memory_pool_config_;
93 std::mutex active_mutex_;
94 std::condition_variable active_cv_;
95 bool active_bulk_job_ =
false;
96 i32 active_bulk_job_id_ = -1;
97 proto::BulkJobParameters job_params_;
100 std::mutex finished_mutex_;
101 std::condition_variable finished_cv_;
102 std::atomic<bool> finished_{
true};
106 std::thread job_processor_thread_;
108 std::mutex work_mutex_;
Definition: database.cpp:36