* Don't bother with the Jobs.active column anymore.

This commit is contained in:
Eelco Dolstra 2009-10-08 11:19:39 +00:00
parent f158697796
commit 158a746e94
3 changed files with 8 additions and 12 deletions

View file

@ -143,3 +143,7 @@
natural join buildresultinfo r2
where x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system
and x.id > c.id and r.buildstatus != r2.buildstatus);
* Using PostgreSQL:
$ HYDRA_DBI="dbi:Pg:dbname=hydra;" hydra_server.pl

View file

@ -263,10 +263,9 @@ sub checkJob {
if $job->{schedulingPriority} =~ /^\d+$/;
txn_do($db, sub {
# Mark this job as active in the database.
# Update the last evaluation time in the database.
my $jobInDB = $jobset->jobs->update_or_create(
{ name => $jobName
, active => 1
, lastevaltime => time
});
@ -427,18 +426,14 @@ sub checkJobset {
txn_do($db, sub {
# Mark all existing jobs that we haven't seen as inactive.
my %jobNames;
$jobNames{$_->{jobName}}++ foreach @{$jobs->{job}};
# Update the last checked times and error messages for each
# job.
my %failedJobNames;
push @{$failedJobNames{$_->{location}}}, $_->{msg} foreach @{$jobs->{error}};
$jobset->update({lastcheckedtime => time});
foreach my $jobInDB ($jobset->jobs->all) {
$jobInDB->update({active => $jobNames{$jobInDB->name} || $failedJobNames{$jobInDB->name} ? 1 : 0});
if ($failedJobNames{$jobInDB->name}) {
$jobInDB->update({errormsg => join '\n', @{$failedJobNames{$jobInDB->name}}});
} else {

View file

@ -261,10 +261,7 @@ create table Jobs (
jobset text not null,
name text not null,
-- `active' means the Nix expression for the jobset currently
-- contains this job. Otherwise it's a job that has been removed
-- from the expression.
active integer not null default 1,
active integer not null default 1, -- !!! obsolete, remove
errorMsg text, -- evalution error for this job