When manually scheduling an eval, force re-instantiation of store derivations
Without this, if (failed or aborted) derivations have been garbage-collected, there is no way to restart them, which is very annoying. Now we set a forceEval flag in the jobset to cause it to be re-evaluated even if none of the inputs have changed.
This commit is contained in:
@ -202,10 +202,11 @@ sub scmdiff : Chained('api') PathPart('scmdiff') Args(0) {
|
||||
|
||||
|
||||
sub triggerJobset {
|
||||
my ($self, $c, $jobset) = @_;
|
||||
my ($self, $c, $jobset, $force) = @_;
|
||||
print STDERR "triggering jobset ", $jobset->project->name . ":" . $jobset->name, "\n";
|
||||
txn_do($c->model('DB')->schema, sub {
|
||||
$jobset->update({ triggertime => time });
|
||||
$jobset->update({ forceeval => 1 }) if $force;
|
||||
});
|
||||
push @{$c->{stash}->{json}->{jobsetsTriggered}}, $jobset->project->name . ":" . $jobset->name;
|
||||
}
|
||||
@ -222,12 +223,12 @@ sub push : Chained('api') PathPart('push') Args(0) {
|
||||
my ($p, $j) = parseJobsetName($s);
|
||||
my $jobset = $c->model('DB::Jobsets')->find($p, $j);
|
||||
next unless defined $jobset && ($force || ($jobset->project->enabled && $jobset->enabled));
|
||||
triggerJobset($self, $c, $jobset);
|
||||
triggerJobset($self, $c, $jobset, $force);
|
||||
}
|
||||
|
||||
my @repos = split /,/, ($c->request->query_params->{repos} // "");
|
||||
foreach my $r (@repos) {
|
||||
triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search(
|
||||
triggerJobset($self, $c, $_, $force) foreach $c->model('DB::Jobsets')->search(
|
||||
{ 'project.enabled' => 1, 'me.enabled' => 1 },
|
||||
{ join => 'project'
|
||||
, where => \ [ 'exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value = ?)', [ 'value', $r ] ]
|
||||
@ -251,7 +252,7 @@ sub push_github : Chained('api') PathPart('push-github') Args(0) {
|
||||
my $repo = $in->{repository}->{name} or die;
|
||||
print STDERR "got push from GitHub repository $owner/$repo\n";
|
||||
|
||||
triggerJobset($self, $c, $_) foreach $c->model('DB::Jobsets')->search(
|
||||
triggerJobset($self, $c, $_, 0) foreach $c->model('DB::Jobsets')->search(
|
||||
{ 'project.enabled' => 1, 'me.enabled' => 1 },
|
||||
{ join => 'project'
|
||||
, where => \ [ 'exists (select 1 from JobsetInputAlts where project = me.project and jobset = me.name and value like ?)', [ 'value', "%github.com%$owner/$repo%" ] ]
|
||||
|
@ -129,6 +129,11 @@ __PACKAGE__->table("Jobsets");
|
||||
data_type: 'text'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 forceeval
|
||||
|
||||
data_type: 'boolean'
|
||||
is_nullable: 1
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
@ -166,6 +171,8 @@ __PACKAGE__->add_columns(
|
||||
{ data_type => "integer", default_value => 100, is_nullable => 0 },
|
||||
"fetcherrormsg",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"forceeval",
|
||||
{ data_type => "boolean", is_nullable => 1 },
|
||||
);
|
||||
|
||||
=head1 PRIMARY KEY
|
||||
@ -338,8 +345,8 @@ __PACKAGE__->has_many(
|
||||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07043 @ 2015-07-30 16:52:20
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Coci9FdBAvUO9T3st2NEqA
|
||||
# Created by DBIx::Class::Schema::Loader v0.07045 @ 2016-10-24 20:12:51
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:PSR66NnVRNTMFhDEm10erA
|
||||
|
||||
my %hint = (
|
||||
columns => [
|
||||
|
Reference in New Issue
Block a user