Commit efe25e99229b0bf987d3182206ae3e998922da81

Authored by Nathanaël Jourdane
1 parent 2b83ab1a

update job info on AMDAIntegration, fix toolip update bug

Showing 1 changed file with 27 additions and 1 deletions   Show diff stats
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
... ... @@ -453,14 +453,40 @@ class IHMJobsManagerClass {
453 453 $jobstatus = $this->getJobStatus($running,$exitcode);
454 454 $job->setAttribute('status', $jobstatus);
455 455  
  456 + $infos = [];
  457 +
456 458 if ($running)
457 459 $job->setAttribute('stop', 'unknown');
458 460 else if ($job->getAttribute('stop') == '' || $job->getAttribute('stop') == 'unknown')
459 461 {
460 462 $job->setAttribute('stop', date('d-m-Y H:i:s', time()));
  463 +
  464 + $res_dir = USERWORKINGDIR . $job->getAttribute('folder') . '/';
  465 + $fileSize = filesize ( glob($res_dir.'/' . $job->getAttribute('result') . '.*')[0]);
  466 + if ($fileSize < 1024) {
  467 + $strSize = number_format($fileSize, 2, '.', ' ') . 'b';
  468 + } else if($fileSize < 1024*1024) {
  469 + $strSize = number_format($fileSize/1024, 2, '.', ' ') . 'kb';
  470 + } else if($fileSize < 1024*1024*1024) {
  471 + $strSize = number_format($fileSize/(1024*1024), 2, '.', ' ') . 'mb';
  472 + } else {
  473 + $strSize = number_format($fileSize/(1024*1024*1024), 2, '.', ' ') . 'gb';
  474 + }
  475 + $infos['File size'] = $strSize;
  476 +
  477 + $start = new DateTime($job->getAttribute('start'));
  478 + $interval = (new DateTime('now'))->diff($start);
  479 + $infos['Job duration'] = $interval->format('%Hh %Im %Ss');
  480 +
461 481 $this->jobXml->getElementById($this->resRootNode[$job->getAttribute('jobType')])->appendChild($job);
462 482 }
463   -
  483 +
  484 + $strInfo = $job->getAttribute('info');
  485 + foreach ($infos as $key => $info) {
  486 + $strInfo .= '<b>' . $key . '</b>: ' . $info . '<br/>';
  487 + }
  488 + $job->setAttribute('info', $strInfo);
  489 +
464 490 $res = $this->jobXml->save($this->jobXmlName);
465 491  
466 492 if (!$res)
... ...