Support cancelling builds
[?]
Jun 11, 2015, 4:07 PM
2IQRXLWETU2RLXPYKBSZIUULDHS346BAHE2NLOMOWXC6WDAX2BYQCDependencies
- [2]
ATJ54SPXUse PostgreSQL notifications for queue events - [3]
ENXUSMSVMake concurrency more robust - [4]
5AIYUMTBBasic remote building - [5]
C6HOMHZWDon't try to handle SIGINT - [6]
24BMQDZAStart of single-process hydra-queue-runner - [7]
YZAI5GQUImplement a database connection pool - [8]
NJJ7H64SVery basic multi-threaded queue runner - [9]
T2EIYJNGOn SIGINT, shut down the builder threads - [*]
2GK5DOU7* Downloading closures. - [*]
UOINKJ2JAdd an action to cancel all builds in a jobset eval
Change contents
- edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 212
void getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store, unsigned int & lastBuildId); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 215
void getQueuedBuilds(std::shared_ptr<StoreAPI> store, unsigned int & lastBuildId);void removeCancelledBuilds(Connection & conn); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 394
getQueuedBuilds(store, lastBuildId);getQueuedBuilds(*conn, store, lastBuildId); - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 408
removeCancelledBuilds(*conn); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 416
void State::getQueuedBuilds(std::shared_ptr<StoreAPI> store, unsigned int & lastBuildId)void State::getQueuedBuilds(Connection & conn, std::shared_ptr<StoreAPI> store, unsigned int & lastBuildId) - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 419
auto conn(dbPool.get()); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 425
pqxx::work txn(*conn);pqxx::work txn(conn); - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 427
// FIXME: query only builds with ID higher than the previous// highest. - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 456
pqxx::work txn(*conn);pqxx::work txn(conn); - replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 478
pqxx::work txn(*conn);pqxx::work txn(conn); - edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 513
void State::removeCancelledBuilds(Connection & conn){/* Get the current set of queued builds. */std::set<BuildID> currentIds;{pqxx::work txn(conn);auto res = txn.exec("select id from Builds where finished = 0");for (auto const & row : res)currentIds.insert(row["id"].as<BuildID>());}auto builds_(builds.lock());for (auto i = builds_->begin(); i != builds_->end(); ) {if (currentIds.find(i->first) == currentIds.end()) {printMsg(lvlInfo, format("discarding cancelled build %1%") % i->first);i = builds_->erase(i);// FIXME: ideally we would interrupt active build steps here.} else++i;}} - edit in src/lib/Hydra/Helper/Nix.pm at line 436[12.1589][12.1589]
$db->storage->dbh->do("notify builds_cancelled");