MCPcopy Create free account
hub / github.com/ByConity/ByConity / uploadTaskDescription

Method uploadTaskDescription

programs/copier/ClusterCopier.cpp:222–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void 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
245void ClusterCopier::reloadTaskDescription()
246{

Callers 1

mainImplMethod · 0.80

Calls 7

readStringUntilEOFFunction · 0.85
createAncestorsMethod · 0.80
tryCreateMethod · 0.80
createOrUpdateMethod · 0.80
errorMessageFunction · 0.50
emptyMethod · 0.45
getZooKeeperMethod · 0.45

Tested by

no test coverage detected