Skip to content

Commit

Permalink
Warnings handled seperately
Browse files Browse the repository at this point in the history
Jobs with a status 'Warning' or 'Canceled' are handled seperately now.
Following Job Status fall into the category warning.

JS_Warnings - W - Terminated normally with warnings
JS_Canceled - A - Canceled by user
  • Loading branch information
fbergkemper committed Apr 23, 2018
1 parent 59eccff commit 61ee062
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 12 deletions.
Expand Up @@ -105,6 +105,7 @@ public function getDataAction()
$waiting = null;
$running = null;
$successful = null;
$warning = null;
$failed = null;
$result = null;

Expand Down Expand Up @@ -138,20 +139,24 @@ public function getDataAction()

// successful
$jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'T', $days, $hours);
$successful = count($jobs_T);

// warning
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours);
$jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'W', $days, $hours);
$successful = count($jobs_T) + count($jobs_W);
$warning = count($jobs_A) + count($jobs_W);

// failed
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'A', $days, $hours);
$jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'E', $days, $hours);
$jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'e', $days, $hours);
$jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, null, 'f', $days, $hours);
$failed = count($jobs_A) + count($jobs_E) + count($jobs_e) + count($jobs_f);
$failed = count($jobs_E) + count($jobs_e) + count($jobs_f);

// json result
$result['waiting'] = $waiting;
$result['running'] = $running;
$result['successful'] = $successful;
$result['warning'] = $warning;
$result['failed'] = $failed;
}
catch(Exception $e) {
Expand Down
6 changes: 6 additions & 0 deletions module/Dashboard/view/dashboard/dashboard/index.phtml
Expand Up @@ -65,6 +65,8 @@ $this->headTitle($title);
$('.running-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.successful-jobs-field').empty();
$('.successful-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.warning-jobs-field').empty();
$('.warning-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
$('.failed-jobs-field').empty();
$('.failed-jobs-field').append("<img src='<?php echo $this->basePath() ?>/css/throbber.gif'>");
});
Expand All @@ -89,6 +91,10 @@ $this->headTitle($title);
$('.successful-jobs-field').append(
data.successful
);
$('.warning-jobs-field').empty();
$('.warning-jobs-field').append(
data.warning
);
$('.failed-jobs-field').empty();
$('.failed-jobs-field').append(
data.failed
Expand Down
23 changes: 19 additions & 4 deletions module/Dashboard/view/partial/JobsPast24h.phtml
Expand Up @@ -37,9 +37,11 @@

<div class="container-fluid block">

<div class="center-block">

<div class="row">

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-info"><?php echo $this->translate('Running'); ?></span>
</h4>
Expand All @@ -50,7 +52,7 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-default"><?php echo $this->translate('Waiting'); ?></span>
</h4>
Expand All @@ -61,7 +63,7 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-success"><?php echo $this->translate('Successful'); ?></span>
</h4>
Expand All @@ -72,7 +74,18 @@
</h3>
</div>

<div class="col-md-3 text-center">
<div class="col-md-2 text-center">
<h4>
<span class="label label-warning"><?php echo $this->translate('Warning'); ?></span>
</h4>
<h3>
<a href="<?php echo $this->url('job', array('action' => 'index'), array('query' => array('period' => '1', 'status' => 'warning'))); ?>">
<span class="warning-jobs-field"></span>
</a>
</h3>
</div>

<div class="col-md-2 text-center">
<h4>
<span class="label label-danger"><?php echo $this->translate('Failed'); ?></span>
</h4>
Expand All @@ -85,6 +98,8 @@

</div>

</div>

</div>

</div>
Expand Down
14 changes: 11 additions & 3 deletions module/Job/src/Job/Controller/JobController.php
Expand Up @@ -418,20 +418,28 @@ public function getDataAction()
elseif($data == "jobs" && $status == "successful") {
try {
$jobs_T = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'T', $period, null); // Terminated
$result = $jobs_T;
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "warning") {
try {
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Terminated
$jobs_W = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'W', $period, null); // Terminated with warnings
$result = array_merge($jobs_T, $jobs_W);
$result = array_merge($jobs_A, $jobs_W);
}
catch(Exception $e) {
echo $e->getMessage();
}
}
elseif($data == "jobs" && $status == "unsuccessful") {
try {
$jobs_A = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'A', $period, null); // Canceled jobs
$jobs_E = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'E', $period, null); //
$jobs_e = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'e', $period, null); //
$jobs_f = $this->getJobModel()->getJobsByStatus($this->bsock, $jobname, 'f', $period, null); //
$result = array_merge($jobs_A, $jobs_E, $jobs_e, $jobs_f);
$result = array_merge($jobs_E, $jobs_e, $jobs_f);
}
catch(Exception $e) {
echo $e->getMessage();
Expand Down
5 changes: 3 additions & 2 deletions module/Job/src/Job/Form/JobForm.php
Expand Up @@ -98,12 +98,13 @@ public function __construct($jobs=null, $jobname=null, $period=null, $status=nul
'running' => _('running'),
'waiting' => _('waiting'),
'unsuccessful' => _('terminated unsuccessfully'),
'successful' => _('terminated successfully')
'successful' => _('terminated successfully'),
'warning' => _('warning')
)
),
'attributes' => array(
'class' => 'form-control selectpicker show-tick',
'data-size' => '5',
'data-size' => '6',
'id' => 'status',
'value' => $status
)
Expand Down

0 comments on commit 61ee062

Please sign in to comment.