Commit be9a9faf13439bbf1d6ee578250b8cecea7b54af

Authored by Elena.Budnik
1 parent 476ff458

different job info for IHM and WS

src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
... ... @@ -28,7 +28,7 @@ class IHMJobsManagerClass {
28 28 /*
29 29 * @brief Load jobs file and create it if needed
30 30 */
31   - private function init()
  31 + protected function init()
32 32 {
33 33 $this->jobXmlName = IHMConfigClass::getUserJobsFile();
34 34 $this->jobXml = new DomDocument("1.0");
... ...
src/InputOutput/WSImpl/Tools/WSJobsManagerClass.php
... ... @@ -26,7 +26,7 @@ class WSJobsManagerClass extends IHMJobsManagerClass {
26 26 /*
27 27 * @brief Load jobs file and create it if needed
28 28 */
29   - private function init()
  29 + protected function init()
30 30 {
31 31 $this->jobXmlName = WSConfigClass::getWsJobsFile();
32 32 $this->jobXml = new DomDocument("1.0");
... ... @@ -61,10 +61,10 @@ class WSJobsManagerClass extends IHMJobsManagerClass {
61 61 $compression = 'unknown';
62 62 if($job)
63 63 {
64   - $name = $job->getAttribute('name');
  64 + // $name = $job->getAttribute('name');
65 65 $status = $job->getAttribute('status');
66 66 $jobType = $job->getAttribute('jobType');
67   - $info = $job->getAttribute('info');
  67 + // $info = $job->getAttribute('info');
68 68 $start = $job->getAttribute('start');
69 69 $stop = $job->getAttribute('stop');
70 70 $result = $job->getAttribute('result');
... ... @@ -88,10 +88,10 @@ class WSJobsManagerClass extends IHMJobsManagerClass {
88 88 return array(
89 89 'success' => true,
90 90 'id' => $id,
91   - 'name' => $name,
  91 + // 'name' => $name,
92 92 'status' => $status,
93 93 'jobType' => $jobType,
94   - 'info' => $info,
  94 + // 'info' => $info,
95 95 'start' => $start,
96 96 'stop' => $stop,
97 97 'folder' => $folder,
... ... @@ -117,40 +117,41 @@ class WSJobsManagerClass extends IHMJobsManagerClass {
117 117 $newJob = $this->jobXml->createElement('job');
118 118  
119 119 $newJob->setAttribute('xml:id', $id);
120   - $newJob->setAttribute('jobType', $key);
  120 + $newJob->setAttribute('jobType', $key);
121 121  
122   - switch ($key)
123   - {
124   - case 'download' :
125   - $name = "download_".time();
126   - $info = '';
127   - foreach ($obj->list as $param)
128   - {
129   - $info .= ' '.$param->paramid; //data
130   - }
131   - break;
132   - case 'plot' :
133   - $name = "request_".time();
134   - $info = '';
135   - for ($i=0; $i < count($obj->children); $i++) {
136   - for ($j=0; $j < count($obj->children[$i]->children); $j++) {
137   - $info = $info.' '.$obj->children[$i]->children[$j]->paramid;
138   - }
139   - }
140   - break;
141   - default:
142   - $name = "unknown_".time();
143   - $info = '';
144   - }
  122 +// switch ($key)
  123 +// {
  124 +// case 'download' :
  125 +// $name = "download_".time();
  126 +// $info = '';
  127 +// foreach ($obj->list as $param)
  128 +// {
  129 +// $info .= ' '.$param->paramid; //data
  130 +// }
  131 +// break;
  132 +// case 'plot' :
  133 +// $name = "request_".time();
  134 +// $info = '';
  135 +// for ($i=0; $i < count($obj->children); $i++) {
  136 +// for ($j=0; $j < count($obj->children[$i]->children); $j++) {
  137 +// $info = $info.' '.$obj->children[$i]->children[$j]->paramid;
  138 +// }
  139 +// }
  140 +// break;
  141 +// default:
  142 +// $name = "unknown_".time();
  143 +// $info = '';
  144 +// }
145 145  
146   - $newJob->setAttribute('name', $name);
147   - $newJob->setAttribute('info', $info);
  146 +// $newJob->setAttribute('name', $name);
  147 +// $newJob->setAttribute('info', $info);
148 148 $newJob->setAttribute('result', $result);
149 149 $newJob->setAttribute('folder', $folder);
150 150 $newJob->setAttribute('start', date('d-m-Y H:i:s', $start));
151   -
  151 + $newJob->setAttribute('user', IHMConfigClass::getUserName());
  152 + $newJob->setAttribute('host', IHMConfigClass::getUserHost());
152 153 //to know if know if it's an immediate job or not
153   - $newJob->setAttribute('immediate', !$running);
  154 +// $newJob->setAttribute('immediate', !$running);
154 155  
155 156 if ($running)
156 157 {
... ... @@ -188,37 +189,37 @@ class WSJobsManagerClass extends IHMJobsManagerClass {
188 189 /*
189 190 * @brief Update the status of a job
190 191 */
191   - public function updateJobStatus($id, $running, $exitcode)
192   - {
193   - $res = $this->init();
194   - if (!$res['success'])
195   - return $res;
196   -
197   - $job = $this->jobXml->getElementById($id);
198   -
199   - if (!isset($job))
200   - return array("success" => false, "message" => "Cannot found job");
201   -
202   - $jobstatus = $this->getJobStatus($running,$exitcode);
203   - $job->setAttribute('status', $jobstatus);
204   -
205   - if ($running)
206   - $job->setAttribute('stop', 'unknown');
207   - else if ($job->getAttribute('stop') == '' || $job->getAttribute('stop') == 'unknown')
208   - {
209   - $job->setAttribute('stop', date('d-m-Y H:i:s', time()));
210   - $this->jobXml->getElementById($this->resRootNode[$job->getAttribute('jobType')])->appendChild($job);
211   - }
212   -
213   - $res = $this->jobXml->save($this->jobXmlName);
214   -
215   - if (!$res)
216   - return array(
217   - 'success' => false,
218   - 'message' => "Cannot save jobs status file");
219   -
220   - return $this->getJobInfo($id);
221   - }
  192 +// public function updateJobStatus($id, $running, $exitcode)
  193 +// {
  194 +// $res = $this->init();
  195 +// if (!$res['success'])
  196 +// return $res;
  197 +//
  198 +// $job = $this->jobXml->getElementById($id);
  199 +//
  200 +// if (!isset($job))
  201 +// return array("success" => false, "message" => "Cannot found job");
  202 +//
  203 +// $jobstatus = $this->getJobStatus($running,$exitcode);
  204 +// $job->setAttribute('status', $jobstatus);
  205 +//
  206 +// if ($running)
  207 +// $job->setAttribute('stop', 'unknown');
  208 +// else if ($job->getAttribute('stop') == '' || $job->getAttribute('stop') == 'unknown')
  209 +// {
  210 +// $job->setAttribute('stop', date('d-m-Y H:i:s', time()));
  211 +// $this->jobXml->getElementById($this->resRootNode[$job->getAttribute('jobType')])->appendChild($job);
  212 +// }
  213 +//
  214 +// $res = $this->jobXml->save($this->jobXmlName);
  215 +//
  216 +// if (!$res)
  217 +// return array(
  218 +// 'success' => false,
  219 +// 'message' => "Cannot save jobs status file");
  220 +//
  221 +// return $this->getJobInfo($id);
  222 +// }
222 223  
223 224 /*
224 225 * @brief delete a job
... ...