* The main entrance for InteractiveServer. */
| 118 | * The main entrance for InteractiveServer. |
| 119 | */ |
| 120 | int main(int argc, char** argv) { |
| 121 | // block sigint and sigterm in main thread, let seastar handle it |
| 122 | gs::blockSignal(SIGINT); |
| 123 | gs::blockSignal(SIGTERM); |
| 124 | |
| 125 | bpo::options_description desc("Usage:"); |
| 126 | desc.add_options()("help,h", "Display help messages")( |
| 127 | "enable-admin-service,e", bpo::value<bool>()->default_value(false), |
| 128 | "whether or not to start admin service")("server-config,c", |
| 129 | bpo::value<std::string>(), |
| 130 | "path to server config yaml")( |
| 131 | "codegen-dir,d", |
| 132 | bpo::value<std::string>()->default_value("/tmp/codegen/"), |
| 133 | "codegen working directory")( |
| 134 | "workspace,w", |
| 135 | bpo::value<std::string>()->default_value("/tmp/workspace/"), |
| 136 | "directory to interactive workspace")( |
| 137 | "graph-config,g", bpo::value<std::string>(), "graph schema config file")( |
| 138 | "data-path,a", bpo::value<std::string>(), "data directory path")( |
| 139 | "open-thread-resource-pool", bpo::value<bool>()->default_value(true), |
| 140 | "open thread resource pool")("worker-thread-number", |
| 141 | bpo::value<unsigned>()->default_value(2), |
| 142 | "worker thread number")( |
| 143 | "enable-trace", bpo::value<bool>()->default_value(false), |
| 144 | "whether to enable opentelemetry tracing")( |
| 145 | "start-compiler", bpo::value<bool>()->default_value(false), |
| 146 | "whether or not to start compiler")( |
| 147 | "memory-level,m", bpo::value<unsigned>()->default_value(1), |
| 148 | "memory allocation strategy")("enable-adhoc-handler", |
| 149 | bpo::value<bool>()->default_value(false), |
| 150 | "whether to enable adhoc handler"); |
| 151 | |
| 152 | setenv("TZ", "Asia/Shanghai", 1); |
| 153 | tzset(); |
| 154 | |
| 155 | bpo::variables_map vm; |
| 156 | bpo::store(bpo::command_line_parser(argc, argv).options(desc).run(), vm); |
| 157 | bpo::notify(vm); |
| 158 | |
| 159 | if (vm.count("help")) { |
| 160 | std::cout << desc << std::endl; |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | //// declare vars |
| 165 | std::string workspace, engine_config_file; |
| 166 | if (vm.count("workspace")) { |
| 167 | workspace = vm["workspace"].as<std::string>(); |
| 168 | } |
| 169 | server::WorkDirManipulator::SetWorkspace(workspace); |
| 170 | |
| 171 | if (!vm.count("server-config")) { |
| 172 | LOG(FATAL) << "server-config is needed"; |
| 173 | } |
| 174 | engine_config_file = vm["server-config"].as<std::string>(); |
| 175 | |
| 176 | YAML::Node node = YAML::LoadFile(engine_config_file); |
| 177 | // Parse service config |
nothing calls this directly
no test coverage detected