Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/hydra
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6bb876cb356e
Choose a base ref
...
head repository: NixOS/hydra
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 53c2fc2216c7
Choose a head ref
  • 7 commits
  • 8 files changed
  • 2 contributors

Commits on Jan 21, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    d9989b7 View commit details
  2. gitignore: artifacts

    grahamc committed Jan 21, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    fb6b10a View commit details
  3. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    086eed5 View commit details
  4. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    805dd6e View commit details
  5. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    c64c4aa View commit details
  6. tests: create database with the utf-8 locale

    Otherwise tests may fail with wide character errors.
    grahamc committed Jan 21, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    grahamc Graham Christensen
    Copy the full SHA
    bd99052 View commit details

Commits on Jan 22, 2021

  1. Merge pull request #847 from grahamc/jobsetevals-evaluation-errors

    JobsetEvals: record evaluation errors
    edolstra authored Jan 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    53c2fc2 View commit details
Showing with 100 additions and 19 deletions.
  1. +4 −0 .gitignore
  2. +16 −2 src/lib/Hydra/Schema/JobsetEvals.pm
  3. +3 −0 src/root/common.tt
  4. +18 −0 src/root/jobset-eval.tt
  5. +19 −14 src/script/hydra-eval-jobset
  6. +3 −0 src/sql/hydra.sql
  7. +34 −0 src/sql/upgrade-70.sql
  8. +3 −3 tests/set-up.pl
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -35,3 +35,7 @@ hydra-config.h.in
result
tests/jobs/config.nix
outputs
config
stamp-h1
src/hydra-evaluator/hydra-evaluator
src/hydra-queue-runner/hydra-queue-runner
18 changes: 16 additions & 2 deletions src/lib/Hydra/Schema/JobsetEvals.pm
Original file line number Diff line number Diff line change
@@ -54,6 +54,16 @@ __PACKAGE__->table("jobsetevals");
is_foreign_key: 1
is_nullable: 0
=head2 errormsg
data_type: 'text'
is_nullable: 1
=head2 errortime
data_type: 'integer'
is_nullable: 1
=head2 timestamp
data_type: 'integer'
@@ -108,6 +118,10 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
"jobset",
{ data_type => "text", is_foreign_key => 1, is_nullable => 0 },
"errormsg",
{ data_type => "text", is_nullable => 1 },
"errortime",
{ data_type => "integer", is_nullable => 1 },
"timestamp",
{ data_type => "integer", is_nullable => 0 },
"checkouttime",
@@ -201,8 +215,8 @@ __PACKAGE__->belongs_to(
);


# Created by DBIx::Class::Schema::Loader v0.07049 @ 2020-05-27 17:40:41
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:M61ikfnjORU7jDAH8P/j7w
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2021-01-21 11:13:38
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zDBtAFc4HiFUcL/TpkuCcg

__PACKAGE__->has_many(
"buildIds",
3 changes: 3 additions & 0 deletions src/root/common.tt
Original file line number Diff line number Diff line change
@@ -476,6 +476,9 @@ BLOCK renderEvals %]
ELSE %]
-
[% END %]
[% IF eval.errormsg %]
<span class="label label-warning">Eval Errors</span>
[% END %]
</td>
<td align='right' class="nowrap">
<span class="label label-success">[% e.nrSucceeded %]</span>
18 changes: 18 additions & 0 deletions src/root/jobset-eval.tt
Original file line number Diff line number Diff line change
@@ -88,6 +88,11 @@ c.uri_for(c.controller('JobsetEval').action_for('view'),
<li><a href="#tabs-unfinished" data-toggle="tab">Queued jobs ([% unfinished.size %])</a></li>
[% END %]
<li><a href="#tabs-inputs" data-toggle="tab">Inputs</a></li>

[% IF eval.errormsg %]
<li><a href="#tabs-errors" data-toggle="tab"><span class="text-warning">Evaluation errors</span></a></li>
[% END %]

</ul>

[% BLOCK renderSome %]
@@ -103,6 +108,13 @@ c.uri_for(c.controller('JobsetEval').action_for('view'),

<div class="tab-content">

[% IF eval.errormsg %]
<div id="tabs-errors" class="tab-pane">
<p>Errors occurred at [% INCLUDE renderDateTime timestamp=(eval.errortime || eval.timestamp) %].</p>
<pre class="alert alert-error">[% HTML.escape(eval.errormsg) %]</pre>
</div>
[% END %]

<div id="tabs-aborted" class="tab-pane">
[% INCLUDE renderSome builds=aborted tabname="#tabs-aborted" %]
</div>
@@ -160,6 +172,12 @@ c.uri_for(c.controller('JobsetEval').action_for('view'),
[% END %]
</div>

[% IF eval.errormsg %]
<div id="tabs-errors" class="tab-pane">
<p>Errors occurred at [% INCLUDE renderDateTime timestamp=(eval.errortime || eval.timestamp) %].</p>
<pre class="alert alert-error">[% HTML.escape(eval.errormsg) %]</pre>
</div>
[% END %]
</div>

[% END %]
33 changes: 19 additions & 14 deletions src/script/hydra-eval-jobset
Original file line number Diff line number Diff line change
@@ -493,12 +493,12 @@ sub fetchInputs {


sub setJobsetError {
my ($jobset, $errorMsg) = @_;
my ($jobset, $errorMsg, $errorTime) = @_;
my $prevError = $jobset->errormsg;

eval {
$db->txn_do(sub {
$jobset->update({ errormsg => $errorMsg, errortime => time, fetcherrormsg => undef });
$jobset->update({ errormsg => $errorMsg, errortime => $errorTime, fetcherrormsg => undef });
});
};
if (defined $errorMsg && $errorMsg ne ($prevError // "") || $ENV{'HYDRA_MAIL_TEST'}) {
@@ -680,6 +680,18 @@ sub checkJobsetWrapped {
my $jobsetChanged = 0;
my $dbStart = clock_gettime(CLOCK_MONOTONIC);


# Store the error messages for jobs that failed to evaluate.
my $evaluationErrorTime = time;
my $evaluationErrorMsg = "";
foreach my $job (values %{$jobs}) {
next unless defined $job->{error};
$evaluationErrorMsg .=
($job->{jobName} ne "" ? "in job ‘$job->{jobName}’" : "at top-level") .
":\n" . $job->{error} . "\n\n";
}
setJobsetError($jobset, $evaluationErrorMsg, $evaluationErrorTime);

my %buildMap;
$db->txn_do(sub {

@@ -706,6 +718,8 @@ sub checkJobsetWrapped {
{ hash => $argsHash
, timestamp => time
, checkouttime => abs(int($checkoutStop - $checkoutStart))
, errormsg => $evaluationErrorMsg
, errortime => $evaluationErrorTime
, evaltime => abs(int($evalStop - $evalStart))
, hasnewbuilds => $jobsetChanged ? 1 : 0
, nrbuilds => $jobsetChanged ? scalar(keys %buildMap) : undef
@@ -791,16 +805,6 @@ sub checkJobsetWrapped {
Net::Statsd::timing("hydra.evaluator.db_time", int(($dbStop - $dbStart) * 1000));
Net::Statsd::increment("hydra.evaluator.evals");
Net::Statsd::increment("hydra.evaluator.cached_evals") unless $jobsetChanged;

# Store the error messages for jobs that failed to evaluate.
my $msg = "";
foreach my $job (values %{$jobs}) {
next unless defined $job->{error};
$msg .=
($job->{jobName} ne "" ? "in job ‘$job->{jobName}’" : "at top-level") .
":\n" . $job->{error} . "\n\n";
}
setJobsetError($jobset, $msg);
}


@@ -827,9 +831,10 @@ sub checkJobset {
my $failed = 0;
if ($checkError) {
print STDERR $checkError;
my $eventTime = time;
$db->txn_do(sub {
$jobset->update({lastcheckedtime => time});
setJobsetError($jobset, $checkError);
$jobset->update({lastcheckedtime => $eventTime});
setJobsetError($jobset, $checkError, $eventTime);
$db->storage->dbh->do("notify eval_failed, ?", undef, join('\t', $tmpId));
}) if !$dryRun;
$failed = 1;
3 changes: 3 additions & 0 deletions src/sql/hydra.sql
Original file line number Diff line number Diff line change
@@ -440,6 +440,9 @@ create table JobsetEvals (
project text not null,
jobset text not null,

errorMsg text, -- error output from the evaluator
errorTime integer, -- timestamp associated with errorMsg

timestamp integer not null, -- when this entry was added
checkoutTime integer not null, -- how long obtaining the inputs took (in seconds)
evalTime integer not null, -- how long evaluation took (in seconds)
34 changes: 34 additions & 0 deletions src/sql/upgrade-70.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ALTER TABLE JobsetEvals
ADD COLUMN errorMsg text,
ADD COLUMN errorTime integer NULL;

-- Copy the current error in jobsets to the latest field in jobsetevals
UPDATE jobsetevals
SET errorMsg = j.errorMsg,
errorTime = j.errorTime
FROM (
SELECT
jobsets.errorMsg,
jobsets.errorTime,
jobsets.id AS jobset_id,
latesteval.id AS eval_id
FROM jobsets
LEFT JOIN
(
SELECT
MAX(id) AS id,
project,
jobset
FROM jobsetevals
GROUP BY project, jobset
ORDER BY project, jobset
)
AS latesteval
ON
jobsets.name = latesteval.jobset
AND jobsets.project = latesteval.project
WHERE latesteval.id IS NOT NULL
ORDER BY jobsets.id
)
AS j
WHERE id = j.eval_id;
6 changes: 3 additions & 3 deletions tests/set-up.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use strict;
system("initdb -D postgres") == 0 or die;
system("pg_ctl -D postgres -o \"-F -p 6433 -h '' -k /tmp \" -w start") == 0 or die;
system("createdb -p 6433 hydra-test-suite") == 0 or die;
system("initdb -D postgres --locale C.UTF-8 ") == 0 or die;
system("pg_ctl -D postgres -o \"-F -p 6433 -h '' -k /tmp \" -w start") == 0 or die;
system("createdb -l C.UTF-8 -p 6433 hydra-test-suite") == 0 or die;
system("hydra-init") == 0 or die;