* Store build duration, handle cached builds.

[?]
Oct 28, 2008, 5:08 PM
WYN733STK5DUQSWHSS6EYZK32KPZII64HLX4NS7TYUSFZ6AAFLGAC

Dependencies

  • [2] N22GPKYT * Put info about logs / build products in the DB.
  • [3] UVMFS73T * Some jQuery / CSS hackery.
  • [4] ELCI5T2A * Show the latest build for each job.
  • [5] J5UVLXOK * Start of a basic Catalyst web interface.

Change contents

  • replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 34
    [4.109][4.109:397]()
    # select * from builds as x where timestamp == (select max(timestamp) from builds where name == x.name);
    $c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "name", where => "timestamp == (select max(timestamp) from builds where name == me.name)"})];
    [4.109]
    [3.0]
    # select * from builds as x where timestamp == (select max(timestamp) from builds where jobName == x.jobName);
    $c->stash->{latestBuilds} = [$c->model('DB::Builds')->search(undef, {order_by => "jobName", where => "timestamp == (select max(timestamp) from builds where jobName == me.jobName)"})];
  • replacement in src/HydraFrontend/lib/HydraFrontend/Controller/Root.pm at line 43
    [3.133][3.133:246]()
    $c->stash->{builds} = [$c->model('DB::Builds')->search({name => $jobName}, {order_by => "timestamp DESC"})];
    [3.133]
    [4.1507]
    $c->stash->{builds} = [$c->model('DB::Builds')->search({jobName => $jobName}, {order_by => "timestamp DESC"})];
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Buildlogs.pm at line 28
    [4.3992][4.3992:4134]()
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:01Br5qFsV84USpzqnjk7cw
    [4.3992]
    [4.4134]
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xXiHLBKW5fHl7ukdYeIsTw
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Buildproducts.pm at line 28
    [4.4922][4.4922:5064]()
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:jYe9p4xG2Ujnf6TsfeE7tA
    [4.4922]
    [4.5064]
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5SPq4at2/NRvbax49TwfDw
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 15
    [4.5538][4.5538:5548]()
    "name",
    [4.5538]
    [4.5548]
    "jobname",
  • edit in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 23
    [4.5831]
    [4.5831]
    "iscachedbuild",
    { data_type => "integer", is_nullable => 0, size => undef },
  • edit in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 27
    [4.5911]
    [4.5911]
    "errormsg",
    { data_type => "text", is_nullable => 0, size => undef },
    "starttime",
    { data_type => "integer", is_nullable => 0, size => undef },
    "stoptime",
    { data_type => "integer", is_nullable => 0, size => undef },
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 36
    [4.5973][4.5973:6026]()
    "buildlogs",
    "HydraFrontend::Schema::Buildlogs",
    [4.5973]
    [4.6026]
    "buildproducts",
    "HydraFrontend::Schema::Buildproducts",
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 41
    [4.6090][4.6090:6151]()
    "buildproducts",
    "HydraFrontend::Schema::Buildproducts",
    [4.6090]
    [4.6151]
    "buildlogs",
    "HydraFrontend::Schema::Buildlogs",
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema/Builds.pm at line 47
    [4.6194][4.6194:6336]()
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gxVH+2KWcgU41JOl9BbHFA
    [4.6194]
    [4.6336]
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gp6ZZpDA2VzgnNE9NX99dA
  • replacement in src/HydraFrontend/lib/HydraFrontend/Schema.pm at line 11
    [4.6498][4.6498:6640]()
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-25 22:23:27
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iW1lrJQVyiDiAYhJBy9/iQ
    [4.6498]
    [4.6640]
    # Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-10-28 17:59:29
    # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Fayli8dtSdcAYhfKSZnJwg
  • replacement in src/HydraFrontend/root/build.tt at line 15
    [4.7565][4.7565:7595]()
    <td>[% build.name %]</td>
    [4.7565]
    [4.7595]
    <td>[% build.jobname %]</td>
  • edit in src/HydraFrontend/root/build.tt at line 24
    [4.7782]
    [4.7782]
    </tr>
    <tr>
    <th>Duration (seconds):</th>
    <td>
    [% IF build.iscachedbuild %]
    <em>(cached build)</em>
    [% ELSE %]
    [% build.stoptime - build.starttime %]
    [% END %]
    </td>
  • edit in src/HydraFrontend/root/index.tt at line 4
    [4.421]
    [4.421]
    <p>Below are the latest builds for each job.</p>
  • replacement in src/HydraFrontend/root/short-build-info.tt at line 12
    [3.2345][3.2345:2431]()
    <td><a href="[% c.uri_for('/job' build.name) %]"><tt>[% build.name %]</tt></a></td>
    [3.2345]
    [3.2431]
    <td><a href="[% c.uri_for('/job' build.jobname) %]"><tt>[% build.jobname %]</tt></a></td>
  • replacement in src/hydra.schema at line 4
    [2.176][2.176:209]()
    name text not null,
    [2.176]
    [2.209]
    jobName text not null,
  • replacement in src/hydra.schema at line 8
    [2.299][2.299:360]()
    buildStatus integer -- 0 = succeeded, 1 = failure, ...
    [2.299]
    [2.360]
    isCachedBuild integer not null, -- boolean
    buildStatus integer, -- 0 = succeeded, 1 = Nix build failure, 2 = positive build failure
    errorMsg text, -- error message in case of a Nix failure
    startTime integer, -- in Unix time, 0 = used cached build result
    stopTime integer
  • replacement in src/scheduler.pl at line 33
    [2.2133][2.2133:2263]()
    if (scalar(@{$dbh->selectall_arrayref("select * from builds where name = ? and outPath = ?", {}, $jobName, $outPath)}) > 0) {
    [2.2133]
    [2.2263]
    if (scalar(@{$dbh->selectall_arrayref("select * from builds where jobName = ? and outPath = ?", {}, $jobName, $outPath)}) > 0) {
  • edit in src/scheduler.pl at line 37
    [2.2317]
    [2.2317]
    my $isCachedBuild = 1;
    my $buildStatus = 0;
    my $startTime = 0;
    my $stopTime = 0;
    if (system("nix-store --check-validity $outPath 2> /dev/null") != 0) {
    $isCachedBuild = 0;
  • replacement in src/scheduler.pl at line 46
    [2.2318][2.2318:2379]()
    my $res = system("nix-build $jobsFile --attr $jobName");
    [2.2318]
    [2.2379]
    $startTime = time();
    my $res = system("nix-build $jobsFile --attr $jobName");
    $stopTime = time();
  • replacement in src/scheduler.pl at line 52
    [2.2380][2.2380:2421]()
    my $buildStatus = $res == 0 ? 0 : 1;
    [2.2380]
    [2.2421]
    $buildStatus = $res == 0 ? 0 : 1;
    }
  • replacement in src/scheduler.pl at line 57
    [2.2445][2.2445:2656]()
    $dbh->prepare("insert into builds(timestamp, name, description, drvPath, outPath, buildStatus) values(?, ?, ?, ?, ?, ?)")
    ->execute(time(), $jobName, $description, $drvPath, $outPath, $buildStatus);
    [2.2445]
    [2.2656]
    $dbh->prepare("insert into builds(timestamp, jobName, description, drvPath, outPath, isCachedBuild, buildStatus, errorMsg, startTime, stopTime) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
    ->execute(time(), $jobName, $description, $drvPath, $outPath, $isCachedBuild, $buildStatus, "", $startTime, $stopTime);
  • edit in src/scheduler.pl at line 62
    [2.2763]
    [2.2763]
    my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
    if (-e $logPath) {
    print " LOG $logPath\n";
    $dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)")
    ->execute($buildId, "full", $logPath, "raw");
    }
  • edit in src/scheduler.pl at line 75
    [2.2963][2.2963:3270]()
    my $logPath = "/nix/var/log/nix/drvs/" . basename $drvPath;
    if (-e $logPath) {
    print " LOG $logPath\n";
    $dbh->prepare("insert into buildLogs(buildId, logPhase, path, type) values(?, ?, ?, ?)")
    ->execute($buildId, "full", $logPath, "raw");
    }