| 220 | } |
| 221 | |
| 222 | void ClusterCopier::uploadTaskDescription(const std::string & task_path, const std::string & task_file, const bool force) |
| 223 | { |
| 224 | auto local_task_description_path = task_path + "/description"; |
| 225 | |
| 226 | String task_config_str; |
| 227 | { |
| 228 | ReadBufferFromFile in(task_file); |
| 229 | readStringUntilEOF(task_config_str, in); |
| 230 | } |
| 231 | if (task_config_str.empty()) |
| 232 | return; |
| 233 | |
| 234 | auto zookeeper = getContext()->getZooKeeper(); |
| 235 | |
| 236 | zookeeper->createAncestors(local_task_description_path); |
| 237 | auto code = zookeeper->tryCreate(local_task_description_path, task_config_str, zkutil::CreateMode::Persistent); |
| 238 | if (code != Coordination::Error::ZOK && force) |
| 239 | zookeeper->createOrUpdate(local_task_description_path, task_config_str, zkutil::CreateMode::Persistent); |
| 240 | |
| 241 | LOG_INFO(log, "Task description {} uploaded to {} with result {} ({})", |
| 242 | ((code != Coordination::Error::ZOK && !force) ? "not " : ""), local_task_description_path, code, Coordination::errorMessage(code)); |
| 243 | } |
| 244 | |
| 245 | void ClusterCopier::reloadTaskDescription() |
| 246 | { |
no test coverage detected