Reuse build products / metrics stored in the database
[?]
Apr 13, 2016, 1:38 PM
WDGARQ76X6RLSFPJTW52BZYFKBC7DPSTABI7HHIKNYHBYXSUNTHQCDependencies
- [2]
ACBS7C6Qhydra-queue-runner: Detect changes to the scheduling shares - [3]
BAFICF73Support hydra-build-products on binary cache stores - [4]
H7SZRHUBUse nix::willBuildLocally() - [5]
DKJFD6JNProcess Nix API changes - [6]
73YR46NJhydra-queue-runner: Write directly to a binary cache - [7]
ZK76B5ZZLoad the queue in order of global priority - [8]
VQISTKOPhydra-queue-runner: Use substitutes - [9]
MHVIT4JYSplit hydra-queue-runner.cc more - [*]
HJOEIMLRRefactor
Change contents
- edit in src/hydra-queue-runner/queue-monitor.cc at line 4
- replacement in src/hydra-queue-runner/queue-monitor.cc at line 161
BuildOutput res = getBuildOutput(destStore, destStore->getFSAccessor(), drv);BuildOutput res = getBuildOutputCached(conn, destStore, drv); - edit in src/hydra-queue-runner/queue-monitor.cc at line 531
}}BuildOutput State::getBuildOutputCached(Connection & conn, nix::ref<nix::Store> destStore, const nix::Derivation & drv){{pqxx::work txn(conn);for (auto & output : drv.outputs) {auto r = txn.parameterized("select id, buildStatus, releaseName, closureSize, size from Builds b ""join BuildOutputs o on b.id = o.build ""where finished = 1 and (buildStatus = 0 or buildStatus = 6) and path = $1")(output.second.path).exec();if (r.empty()) continue;BuildID id = r[0][0].as<BuildID>();printMsg(lvlInfo, format("re-using products of build %d") % id);BuildOutput res;res.failed = r[0][1].as<int>() == bsFailedWithOutput;res.releaseName = r[0][2].is_null() ? "" : r[0][2].as<std::string>();res.closureSize = r[0][3].is_null() ? 0 : r[0][3].as<unsigned long long>();res.size = r[0][4].is_null() ? 0 : r[0][4].as<unsigned long long>();auto products = txn.parameterized("select type, subtype, fileSize, sha1hash, sha256hash, path, name, defaultPath from BuildProducts where build = $1 order by productnr")(id).exec();for (auto row : products) {BuildProduct product;product.type = row[0].as<std::string>();product.subtype = row[1].as<std::string>();if (row[2].is_null())product.isRegular = false;else {product.isRegular = true;product.fileSize = row[2].as<off_t>();}if (!row[3].is_null())product.sha1hash = parseHash(htSHA1, row[3].as<std::string>());if (!row[4].is_null())product.sha256hash = parseHash(htSHA256, row[4].as<std::string>());if (!row[5].is_null())product.path = row[5].as<std::string>();product.name = row[6].as<std::string>();if (!row[7].is_null())product.defaultPath = row[7].as<std::string>();res.products.emplace_back(product);}auto metrics = txn.parameterized("select name, unit, value from BuildMetrics where build = $1")(id).exec();for (auto row : metrics) {BuildMetric metric;metric.name = row[0].as<std::string>();metric.unit = row[1].is_null() ? "" : row[1].as<std::string>();metric.value = row[2].as<double>();res.metrics.emplace(metric.name, metric);}return res; - edit in src/hydra-queue-runner/queue-monitor.cc at line 597
}return getBuildOutput(destStore, destStore->getFSAccessor(), drv); - edit in src/hydra-queue-runner/state.hh at line 413[11.7785][4.1160]
BuildOutput getBuildOutputCached(Connection & conn, nix::ref<nix::Store> destStore,const nix::Derivation & drv);