38 const NAME =
"ajax_all_job_status";
48 function __construct()
50 parent::__construct(self::NAME,
53 self::REQUIRES_LOGIN =>
false 57 $this->showJobDao = $this->
getObject(
'dao.show_jobs');
64 protected function handle(Request $request)
66 $results = $this->showJobDao->getJobsForAll();
67 $uniqueTypes = array_unique(array_column($results,
'job'));
70 foreach ($uniqueTypes as $type) {
72 $data[$type][
'running'] = 0;
73 $data[$type][
'pending'] = 0;
74 $data[$type][
'eta'] = 0;
75 foreach ($results as $row) {
76 if ($row[
'job'] != $type || empty($row[
'status'])) {
79 $data[$type][$row[
'status']] ++;
80 $newEta = $this->showJobDao->getEstimatedTime($row[
'jq_job_fk'],
81 $row[
'job'], 0, $row[
'upload_fk'], 1);
82 if (! empty($newEta)) {
83 $data[$type][
'eta'] = ($newEta > $data[$type][
'eta']) ? $newEta:$data[$type][
'eta'];
88 $returnData = array();
89 foreach ($data as $agent => $row) {
92 "running" => $row[
"running"],
93 "pending" => $row[
"pending"]
95 if ($row[
'eta'] == 0) {
96 $dataRow[
'eta'] =
"N/A";
98 $dataRow[
'eta'] = intval($row[
"eta"] / 3600) .
99 gmdate(
":i:s", $row[
"eta"]);
101 $returnData[] = $dataRow;
105 $schedStatus =
"Running";
107 && strstr($error_msg,
"Connection refused") !==
false) {
108 $schedStatus =
"Stopped";
110 return new JsonResponse([
"data" => $returnData,
"scheduler" => $schedStatus]);
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
fo_dbManager * dbManager
fo_dbManager object