From 158a746e94a717b579921db18994253e85daa3f2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 8 Oct 2009 11:19:39 +0000 Subject: [PATCH] * Don't bother with the Jobs.active column anymore. --- doc/dev-notes.txt | 4 ++++ src/script/hydra_scheduler.pl | 11 +++-------- src/sql/hydra.sql | 5 +---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/doc/dev-notes.txt b/doc/dev-notes.txt index 42ef2d49..cdba0c48 100644 --- a/doc/dev-notes.txt +++ b/doc/dev-notes.txt @@ -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 diff --git a/src/script/hydra_scheduler.pl b/src/script/hydra_scheduler.pl index 787979a2..c1b44cc6 100755 --- a/src/script/hydra_scheduler.pl +++ b/src/script/hydra_scheduler.pl @@ -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 { diff --git a/src/sql/hydra.sql b/src/sql/hydra.sql index 24a90334..146a2fe1 100644 --- a/src/sql/hydra.sql +++ b/src/sql/hydra.sql @@ -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