diff --git a/src/hydra-queue-runner/hydra-queue-runner.cc b/src/hydra-queue-runner/hydra-queue-runner.cc index d95f9e94..d64ffd0c 100644 --- a/src/hydra-queue-runner/hydra-queue-runner.cc +++ b/src/hydra-queue-runner/hydra-queue-runner.cc @@ -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()); diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index dab82b62..48319479 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -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;