forked from lix-project/hydra
Make queue runner internal status available under /queue-runner-status
This commit is contained in:
parent
8c9fc677c1
commit
00a7be13a2
|
@ -705,10 +705,10 @@ void State::run(BuildID buildOne)
|
|||
while (true) {
|
||||
try {
|
||||
auto conn(dbPool.get());
|
||||
receiver dumpStatus(*conn, "dump_status");
|
||||
receiver dumpStatus_(*conn, "dump_status");
|
||||
while (true) {
|
||||
bool timeout = conn->await_notification(300, 0) == 0;
|
||||
State::dumpStatus(*conn, timeout);
|
||||
dumpStatus(*conn, timeout);
|
||||
}
|
||||
} catch (std::exception & e) {
|
||||
printMsg(lvlError, format("main thread: %1%") % e.what());
|
||||
|
|
|
@ -118,6 +118,22 @@ sub status_GET {
|
|||
}
|
||||
|
||||
|
||||
sub queue_runner_status :Local :Path('queue-runner-status') :Args(0) :ActionClass('REST') { }
|
||||
|
||||
sub queue_runner_status_GET {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
#my $status = from_json($c->model('DB::SystemStatus')->find('queue-runner')->status);
|
||||
my $status = from_json(`hydra-queue-runner --status`);
|
||||
if ($?) { $status->{status} = "unknown"; }
|
||||
my $json = JSON->new->pretty()->canonical();
|
||||
|
||||
$c->stash->{template} = 'queue-runner-status.tt';
|
||||
$c->stash->{status} = $json->encode($status);
|
||||
$self->status_ok($c, entity => $status);
|
||||
}
|
||||
|
||||
|
||||
sub machines :Local Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
my $machines = getMachines;
|
||||
|
|
Loading…
Reference in a new issue