PHRAS-3995: Admin - worker - job queue - average duration (#4448)

* add average duration

* fix

* fix duration
This commit is contained in:
Aina Sitraka
2023-12-21 17:08:44 +03:00
committed by GitHub
parent e2fb405924
commit 774c3408cf
11 changed files with 682 additions and 638 deletions

View File

@@ -141,9 +141,12 @@ class AdminConfigurationController extends Controller
$helpers = new PhraseanetExtension($this->app);
$workerRunningJob = $repoWorker->findByFilter($filterStatus, $jobType, $databoxId, $recordId, $fieldTimeFilter, $dateTimeFilter);
$workerRunningJobTotalCount = $repoWorker->getJobCount($filterStatus, $jobType, $databoxId, $recordId);
$workerRunningJobTotalCount = $repoWorker->getJobCount($filterStatus, $jobType, $databoxId, $recordId, $fieldTimeFilter, $dateTimeFilter);
$workerRunningJobTotalCount = number_format($workerRunningJobTotalCount, 0, '.', ' ');
$totalDuration = array_sum(array_column($workerRunningJob, 'duration'));
$averageDuration = (count($workerRunningJob) == 0) ? 0 : $totalDuration/(float)count($workerRunningJob);
// format duration
$totalDuration = $helpers->getDuration($totalDuration);
@@ -159,7 +162,7 @@ class AdminConfigurationController extends Controller
$realEntryDuration = $helpers->getDuration($realEntryDuration);
// get all row count in the table WorkerRunningJob
$totalCount = $repoWorker->getJobCount([], null, null , null);
$totalCount = $repoWorker->getJobCount([], null, null , null, null, null);
$totalCount = number_format($totalCount, 0, '.', ' ');
$databoxIds = array_map(function (\databox $databox) {
@@ -186,6 +189,7 @@ class AdminConfigurationController extends Controller
'resultTotal' => $workerRunningJobTotalCount,
'totalCount' => $totalCount,
'totalDuration' => $totalDuration,
'averageDuration' => number_format($averageDuration, 2, '.', ' ') . ' s',
'realEntryDuration'=> $realEntryDuration
]);
} else {
@@ -198,6 +202,7 @@ class AdminConfigurationController extends Controller
'resultTotal' => $workerRunningJobTotalCount,
'totalCount' => $totalCount,
'totalDuration' => $totalDuration,
'averageDuration' => number_format($averageDuration, 2, '.', ' ') . ' s',
'realEntryDuration'=> $realEntryDuration
]);
}