hydra: store logfile/output path/closure size

This commit is contained in:
Rob Vermaas 2010-11-11 11:03:50 +00:00
parent c9ca8d6c63
commit dcdbb1d814
4 changed files with 62 additions and 29 deletions

View file

@ -29,21 +29,21 @@ __PACKAGE__->table("BuildMachines");
=head2 username =head2 username
data_type: text data_type: text
default_value: undef default_value: ''
is_nullable: 0 is_nullable: 0
size: undef size: undef
=head2 ssh_key =head2 ssh_key
data_type: text data_type: text
default_value: undef default_value: ''
is_nullable: 0 is_nullable: 0
size: undef size: undef
=head2 options =head2 options
data_type: text data_type: text
default_value: undef default_value: ''
is_nullable: 0 is_nullable: 0
size: undef size: undef
@ -64,7 +64,7 @@ __PACKAGE__->table("BuildMachines");
=head2 enabled =head2 enabled
data_type: integer data_type: integer
default_value: 1 default_value: 0
is_nullable: 0 is_nullable: 0
size: undef size: undef
@ -79,32 +79,17 @@ __PACKAGE__->add_columns(
size => undef, size => undef,
}, },
"username", "username",
{ { data_type => "text", default_value => "''", is_nullable => 0, size => undef },
data_type => "text",
default_value => undef,
is_nullable => 0,
size => undef,
},
"ssh_key", "ssh_key",
{ { data_type => "text", default_value => "''", is_nullable => 0, size => undef },
data_type => "text",
default_value => undef,
is_nullable => 0,
size => undef,
},
"options", "options",
{ { data_type => "text", default_value => "''", is_nullable => 0, size => undef },
data_type => "text",
default_value => undef,
is_nullable => 0,
size => undef,
},
"maxconcurrent", "maxconcurrent",
{ data_type => "integer", default_value => 2, is_nullable => 0, size => undef }, { data_type => "integer", default_value => 2, is_nullable => 0, size => undef },
"speedfactor", "speedfactor",
{ data_type => "integer", default_value => 1, is_nullable => 0, size => undef }, { data_type => "integer", default_value => 1, is_nullable => 0, size => undef },
"enabled", "enabled",
{ data_type => "integer", default_value => 1, is_nullable => 0, size => undef }, { data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
); );
__PACKAGE__->set_primary_key("hostname"); __PACKAGE__->set_primary_key("hostname");
@ -125,8 +110,8 @@ __PACKAGE__->has_many(
); );
# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-10-11 12:58:16 # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-11-11 10:58:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gje+VA73Hghl7JXp+Fl8pw # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:GV0LlwTyjFctix2zArVTGw
# You can replace this text with custom content, and it will be preserved on regeneration # You can replace this text with custom content, and it will be preserved on regeneration

View file

@ -69,6 +69,27 @@ __PACKAGE__->table("BuildResultInfo");
is_nullable: 1 is_nullable: 1
size: undef size: undef
=head2 logsize
data_type: integer
default_value: 0
is_nullable: 0
size: undef
=head2 size
data_type: integer
default_value: 0
is_nullable: 0
size: undef
=head2 closuresize
data_type: integer
default_value: 0
is_nullable: 0
size: undef
=head2 releasename =head2 releasename
data_type: text data_type: text
@ -150,6 +171,12 @@ __PACKAGE__->add_columns(
is_nullable => 1, is_nullable => 1,
size => undef, size => undef,
}, },
"logsize",
{ data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
"size",
{ data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
"closuresize",
{ data_type => "integer", default_value => 0, is_nullable => 0, size => undef },
"releasename", "releasename",
{ {
data_type => "text", data_type => "text",
@ -189,8 +216,8 @@ Related object: L<Hydra::Schema::Builds>
__PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }, {}); __PACKAGE__->belongs_to("id", "Hydra::Schema::Builds", { id => "id" }, {});
# Created by DBIx::Class::Schema::Loader v0.05003 @ 2010-02-25 10:29:41 # Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-11-11 10:58:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vg+v2gK8l7iqBqQGtZJ1cA # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7RntgXzDYpnfVLfja5RXKg
__PACKAGE__->belongs_to( __PACKAGE__->belongs_to(
"failedDep", "failedDep",

View file

@ -199,6 +199,10 @@ sub sendEmailNotification {
sendmail($email); sendmail($email);
} }
sub getSize {
my $size = `du -bcs @_ 2> /dev/null | tail -1 | cut -f 1 `;
return int($size);
}
sub doBuild { sub doBuild {
my ($build) = @_; my ($build) = @_;
@ -365,6 +369,16 @@ sub doBuild {
} }
done: done:
my $logfile = getBuildLog($drvPath);
my $logsize = defined $logfile ? getSize($logfile) : 0;
my $size = isValidPath($outPath) ? getSize($outPath) : 0;
my $closuresize = 0;
if (isValidPath($outPath)) {
(my $hash, my $deriver, my $refs) = queryPathInfo($outPath) ;
$closuresize = getSize(@{$refs});
}
txn_do($db, sub { txn_do($db, sub {
$build->update({finished => 1, timestamp => time}); $build->update({finished => 1, timestamp => time});
@ -377,7 +391,10 @@ sub doBuild {
, buildstatus => $buildStatus , buildstatus => $buildStatus
, starttime => $startTime , starttime => $startTime
, stoptime => $stopTime , stoptime => $stopTime
, logfile => getBuildLog($drvPath) , logfile => $logfile
, logsize => $logsize
, size => $size
, closuresize => $closuresize
, errormsg => $errormsg , errormsg => $errormsg
, releasename => $releaseName , releasename => $releaseName
}); });

View file

@ -114,7 +114,7 @@ create table Jobs (
); );
-- This table contains all builds, either scheduled or finished. For -- This table contains all wbuilds, either scheduled or finished. For
-- scheduled builds, additional info (such as the priority) can be -- scheduled builds, additional info (such as the priority) can be
-- found in the BuildSchedulingInfo table. For finished builds, -- found in the BuildSchedulingInfo table. For finished builds,
-- additional info (such as the logs, build products, etc.) can be -- additional info (such as the logs, build products, etc.) can be
@ -204,6 +204,10 @@ create table BuildResultInfo (
logfile text, -- the path of the logfile logfile text, -- the path of the logfile
logsize integer not null default 0,
size integer not null default 0,
closuresize integer not null default 0,
releaseName text, -- e.g. "patchelf-0.5pre1234" releaseName text, -- e.g. "patchelf-0.5pre1234"
keep integer not null default 0, -- true means never garbage-collect the build output keep integer not null default 0, -- true means never garbage-collect the build output