hydra-queue-runner: Make build notification more reliable

[?]
Jul 26, 2017, 1:17 PM
B7ENVLRS2KLKEG66TY5G4EW6M274JZOBDUCRB7BFBXLTBG455STQC

Dependencies

  • [2] TM6C352U Ensure that stoptime and starttime are set for finished builds
  • [3] CHJANKMM IndexJobsetEvalsOnJobsetId: Only index jobsets with new builds
  • [4] 7LWB2J2Z Periodically clear orphaned build steps
  • [5] YTAYNN7V Queue monitor: Bail out earlier if a step has failed previously
  • [6] JPHDKOMJ hydra-queue-runner: Keep some notification statistics
  • [7] PHX2HIVG * Store info about the build inputs in the build record.
  • [8] TPNHTE5V Remove obsolete Builds columns and provide accurate "Running builds"
  • [9] UNVMKJV5 Unify build and step status codes
  • [10] SMUWBAD5 Send BuildFinished notifications on cached build results.
  • [11] HPEG2RHV Merge the BuildResultInfo table into the Builds table
  • [12] 5AIYUMTB Basic remote building
  • [13] MHVIT4JY Split hydra-queue-runner.cc more
  • [14] 62MQPRXC Pass null values to libpqxx properly
  • [15] 5DSF5KWY * Perl sucks. "getBuildLog $drvPath" doesn't mean the same as
  • [16] LVQXQIYA Kill active build steps when builds are cancelled
  • [17] OBOTGFG6 Prevent orphaned build steps
  • [18] VZCNKQSB Remove superfluous check
  • [19] 37R34XJO * Negative caching: don't perform a build if a dependency already
  • [20] 3ZCEPLNO
  • [21] 24BMQDZA Start of single-process hydra-queue-runner
  • [22] HPJKBFZ4 Handle concurrent finishing of the same build
  • [23] FQQRJUO4 Mark builds as busy
  • [24] BG6PEOB2 Make the output size limit configurable
  • [25] FITVNQ2S Keep track of the time we spend copying to/from build machines
  • [*] IE2PRAQU hydra-queue-runner: Send build notifications
  • [*] N22GPKYT * Put info about logs / build products in the DB.
  • [*] D5QIOJGP * Move everything up one directory.

Change contents

  • replacement in src/hydra-queue-runner/builder.cc at line 421
    [7.12527][7.25:184]()
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $4, isCachedBuild = $5 where id = $1 and finished = 0")
    [7.12527]
    [7.12696]
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $4, isCachedBuild = $5, notificationPendingSince = $4 where id = $1 and finished = 0")
  • replacement in src/hydra-queue-runner/hydra-queue-runner.cc at line 417
    [7.600][7.185:358]()
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $4, size = $5, closureSize = $6, releaseName = $7, isCachedBuild = $8 where id = $1")
    [7.600]
    [7.18032]
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $4, size = $5, closureSize = $6, releaseName = $7, isCachedBuild = $8, notificationPendingSince = $4 where id = $1")
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 522
    [6.178]
    [6.178]
    if (item.type == NotificationItem::Type::BuildFinished) {
    auto conn(dbPool.get());
    pqxx::work txn(*conn);
    txn.parameterized
    ("update Builds set notificationPendingSince = null where id = $1")
    (item.id)
    .exec();
    txn.commit();
    }
  • edit in src/hydra-queue-runner/hydra-queue-runner.cc at line 850
    [27.2824]
    [4.387]
    /* Enqueue notification items for builds that were finished
    previously, but for which we didn't manage to send
    notifications. */
    {
    auto conn(dbPool.get());
    pqxx::work txn(*conn);
    auto res = txn.parameterized("select id from Builds where notificationPendingSince > 0").exec();
    for (auto const & row : res) {
    auto id = row["id"].as<BuildID>();
    enqueueNotificationItem({NotificationItem::Type::BuildFinished, id});
    }
    }
  • replacement in src/hydra-queue-runner/queue-monitor.cc at line 191
    [5.1990][5.1990:2144]()
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $3, isCachedBuild = 1 where id = $1 and finished = 0")
    [5.1990]
    [5.2144]
    ("update Builds set finished = 1, buildStatus = $2, startTime = $3, stopTime = $3, isCachedBuild = 1, notificationPendingSince = $3 "
    "where id = $1 and finished = 0")
  • edit in src/sql/hydra.sql at line 224
    [7.2508]
    [7.5210]
    notificationPendingSince integer,
  • replacement in src/sql/hydra.sql at line 230
    [2.143][7.11270:11530](),[7.5211][7.11270:11530]()
    foreign key (project) references Projects(name) on update cascade,
    foreign key (project, jobset) references Jobsets(project, name) on update cascade,
    foreign key (project, jobset, job) references Jobs(project, jobset, name) on update cascade
    [2.143]
    [7.2526]
    foreign key (project) references Projects(name) on update cascade,
    foreign key (project, jobset) references Jobsets(project, name) on update cascade,
    foreign key (project, jobset, job) references Jobs(project, jobset, name) on update cascade
  • edit in src/sql/hydra.sql at line 682
    [3.105]
    create index IndexBuildsOnNotificationPendingSince on Builds(notificationPendingSince) where notificationPendingSince is not null;
  • file addition: upgrade-55.sql (----------)
    [29.3004]
    alter table Builds add column notificationPendingSince integer;
    create index IndexBuildsOnNotificationPendingSince on Builds(notificationPendingSince) where notificationPendingSince is not null;