"Evaluate" command: push the jobset to the front of the eval queue

Don't let hydra-server call hydra-evaluate.  That will probably just
timeout, get killed, etc.
This commit is contained in:
Eelco Dolstra 2013-02-26 16:56:19 +01:00
parent eea3846754
commit d596b58991
4 changed files with 24 additions and 19 deletions

View file

@ -392,21 +392,4 @@ sub news_delete : Chained('admin') Path('news/delete') Args(1) {
}
sub force_eval : Chained('admin') Path('eval') Args(2) {
my ($self, $c, $projectName, $jobsetName) = @_;
my $project = $c->model('DB::Projects')->find($projectName)
or notFound($c, "Project $projectName doesn't exist.");
$c->stash->{project} = $project;
$c->stash->{jobset_} = $project->jobsets->search({name => $jobsetName});
$c->stash->{jobset} = $c->stash->{jobset_}->single
or notFound($c, "Jobset $jobsetName doesn't exist.");
captureStdoutStderr(60, "hydra-evaluator", $projectName, $jobsetName);
$c->res->redirect("/project/$projectName");
}
1;

View file

@ -1,5 +1,6 @@
package Hydra::Helper::CatalystUtils;
use utf8;
use strict;
use Exporter;
use Readonly;

View file

@ -79,6 +79,8 @@
window.location = link.attr("href");
});
bootbox.animate(false);
});
</script>

View file

@ -95,8 +95,27 @@
[% INCLUDE menuItem title="Delete" uri = "javascript:confirmDeleteJobset()" %]
[% INCLUDE menuItem uri = c.uri_for('/jobset' project.name jobset.name 'clone') title="Clone" %]
[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('force_eval'), project.name, jobset.name)
content = "Evaluate" confirmmsg = ("Are you sure you want to force evaluation of jobset " _ project.name _ ":" _ jobset.name _ "?") class = "" %]
<script>
function confirmEvaluateJobset() {
bootbox.confirm(
'Are you sure you want to force evaluation of this jobset?',
function(c) {
if (!c) return;
$.post("[% c.uri_for('/api/push', { jobsets = project.name _ ':' _ jobset.name }) %]")
.done(function(data) {
if (data.error)
bootbox.alert("Unable to schedule the jobset for evaluation: " + data.error);
else
bootbox.alert("The jobset has been scheduled for evaluation.");
})
.fail(function() { bootbox.alert("Server request failed!"); });
});
return;
};
</script>
[% INCLUDE menuItem title="Evaluate" uri = "javascript:confirmEvaluateJobset()" %]
[% END %]
[% END %]
[% END %]