Commit 014ee4f4 authored by Leo Gordon's avatar Leo Gordon
Browse files

easier to read

parent 9a567ea8
......@@ -91,27 +91,20 @@ sub fetch_all {
sub fetch_by_needed_workers {
my $self = shift;
my $limit = shift;
my $maximise_concurrency = shift;
my ($self, $limit, $maximise_concurrency) = @_;
my $constraint = "ast.num_required_workers>0 AND ast.status in ('READY','WORKING')";
my $constraint = "ast.num_required_workers>0 AND ast.status in ('READY','WORKING')";
my $order_by;
if ($maximise_concurrency) {
$order_by = 'ORDER BY num_running_workers';
} else {
$order_by = 'ORDER BY num_required_workers DESC';
}
$order_by .= ', hive_capacity DESC, analysis_id';
if($limit) {
$order_by .= " LIMIT $limit";
}
$self->_final_clause($order_by);
my $final_clause = 'ORDER BY num_running_workers'
.($maximise_concurrency ? '' : ' DESC')
.', hive_capacity DESC, analysis_id'
.($limit ? " LIMIT $limit" : '');
my $results = $self->_generic_fetch($constraint);
$self->_final_clause(''); #reset final clause for other fetches
return $results;
$self->_final_clause($final_clause);
my $results = $self->_generic_fetch($constraint);
$self->_final_clause(''); # reset final clause for other fetches
return $results;
}
......
......@@ -67,7 +67,10 @@ sub run {
my $cmd = $self->param('cmd');
system($cmd) == 0 or die "system( $cmd ) failed: $?";
if(my $return_value = system($cmd)) {
$return_value >>= 8;
die "system( $cmd ) failed: $return_value";
}
return 1;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment