Commit 7d14181a4c3cbfd1696f93fd3640a700bbc64dcc

Authored by Benjamin Renard
1 parent 50605298

Fix multi-request (for multi-plot #8314)

src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php
... ... @@ -17,7 +17,7 @@ class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractCl
17 17 /* '{"id":"cond_2","name":"us44_test1","sampling":600,"gap":5,"description":"","expression":"dst>0","timesrc":"Interval","startDate":"2008-01-31T00:00:00","stopDate":"2008-02-01T00:00:00","durationDay":"0001","durationHour":"00","durationMin":"00","durationSec":"00","leaf":true,"nodeType":"condition"}'
18 18 */
19 19  
20   - $requestNode = $this->paramsData->addRequestNode();
  20 + $requestNode = $this->paramsData->addRequestNode(0);
21 21 $paramsNode = $requestNode->getParamsNode();
22 22  
23 23 //unmarshall time definition
... ...
src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php
... ... @@ -19,7 +19,7 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas
19 19 // "header":"0","timesrc":"TimeTable","timeTables":[{"timeTableName":"rzerzer","id":"tt_1"},{"timeTableName":"sqsdq","id":"tt_0"}],
20 20 //"list":["dst"],"milli":false,"fileformat":"ASCII","timeformat":"YYYY-MM-DDThh:mm:ss","compression":"tar+gzip","leaf":true}
21 21  
22   - $requestNode = $this->paramsData->addRequestNode();
  22 + $requestNode = $this->paramsData->addRequestNode(0);
23 23  
24 24 $paramsNode = $requestNode->getParamsNode();
25 25  
... ...
src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -44,13 +44,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
44 44 //Request
45 45 $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE');
46 46 $this->isFromWS = ($input->{'file-output'} == 'WS');
47   - $this->paramsData->setRequestIndex($input->{'tab-index'});
48 47 $postProcessCmd = "";
49 48  
50 49 if ($resetZoom || $forceTimeZoomReset)
51 50 $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset);
52 51  
53   - $requestNode = $this->paramsData->addRequestNode();
  52 + $requestNode = $this->paramsData->addRequestNode($input->{'tab-index'});
54 53 $outputsNode = $requestNode->getOutputsNode();
55 54 $paramsNode = $requestNode->getParamsNode();
56 55  
... ... @@ -63,7 +62,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
63 62 $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'};
64 63 $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'};
65 64 }
66   - $this->unmarshallTimeDefinition($input, 0, $ttFileIndex, $ttIntIndex);
  65 + $this->unmarshallTimeDefinition($input, $input->{'tab-index'}, $ttFileIndex, $ttIntIndex);
67 66  
68 67 $this->interactiveCrtTTFileIndex = $ttFileIndex;
69 68  
... ...
src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php
... ... @@ -21,7 +21,7 @@ class IHMInputOutputParamsStatisticsClass extends IHMInputOutputParamsAbstractCl
21 21 "parameter":[{"param":"imf_gsm","function":"min","template_args":"{}"},{"param":"imf_mag","function":"max","template_args":"{}"}],
22 22 "timeTables":[{"id":"sharedtt_26"},{"id":"sharedtt_27"}],"leaf":true,"nodeType":"catalog"}]'
23 23 */
24   - $requestNode = $this->paramsData->addRequestNode();
  24 + $requestNode = $this->paramsData->addRequestNode(0);
25 25  
26 26 $paramsNode = $requestNode->getParamsNode();
27 27  
... ...
src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php
... ... @@ -29,7 +29,9 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass
29 29 */
30 30 protected function unmarshallRequest($input)
31 31 {
32   - $requestNode = $this->paramsData->addRequestNode();
  32 + //$this->jobsManager->cleanupResultDir();
  33 +
  34 + $requestNode = $this->paramsData->addRequestNode(0);
33 35  
34 36 $paramsNode = $requestNode->getParamsNode();
35 37  
... ...
src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php
... ... @@ -31,7 +31,7 @@ class WSInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
31 31 //Request
32 32 $postProcessCmd = "";
33 33  
34   - $requestNode = $this->paramsData->addRequestNode();
  34 + $requestNode = $this->paramsData->addRequestNode(0);
35 35 $outputsNode = $requestNode->getOutputsNode();
36 36 $paramsNode = $requestNode->getParamsNode();
37 37  
... ...
src/Request/ParamsRequestImpl/ParamsRequestClass.php
... ... @@ -23,11 +23,11 @@ class ParamsRequestClass extends ProcessRequestClass
23 23 {
24 24 case ParamsRequestTypeEnumClass::XMLREQUEST :
25 25 $cmd = "";
26   - foreach ($this->requestData->getRequestNodes() as $requestNode)
  26 + foreach ($this->requestData->getRequestNodes() as $request_index => $requestNode)
27 27 {
28 28 if ($cmd != "")
29 29 $cmd .= " && ";
30   - $cmd .= KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath();
  30 + $cmd .= KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath($request_index);
31 31 }
32 32 $this->requestData->setCmd($cmd);
33 33 break;
... ... @@ -63,7 +63,7 @@ class ParamsRequestClass extends ProcessRequestClass
63 63  
64 64 if ($this->requestData->getRequestType() == ParamsRequestTypeEnumClass::XMLREQUEST)
65 65 {
66   - foreach ($this->requestData->getRequestNodes() as $requestNode)
  66 + foreach ($this->requestData->getRequestNodes() as $request_index => $requestNode)
67 67 {
68 68 //inject time restriction
69 69 if (!empty($this->requestData->getParamsTimeRestrictions())) {
... ... @@ -87,7 +87,7 @@ class ParamsRequestClass extends ProcessRequestClass
87 87  
88 88 $doc->appendChild($xmlNode);
89 89  
90   - if (!$doc->save($this->getRequestFilePath()))
  90 + if (!$doc->save($this->getRequestFilePath($request_index)))
91 91 {
92 92 $this->requestData->setLastErrorMessage('Cannot save params request XML file for request');
93 93 return false;
... ... @@ -252,9 +252,9 @@ class ParamsRequestClass extends ProcessRequestClass
252 252 /*
253 253 * @brief Get the request file path for AMDA_Kernel
254 254 */
255   - private function getRequestFilePath()
  255 + private function getRequestFilePath($request_index)
256 256 {
257   - return $this->requestData->getWorkingPath()."request_".$this->requestData->getRequestIndex().".xml";
  257 + return $this->requestData->getWorkingPath()."request_".$request_index.".xml";
258 258 }
259 259 }
260 260 ?>
... ...
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
... ... @@ -33,7 +33,6 @@ class ParamsRequestDataClass extends ProcessRequestDataClass
33 33 private $paramId = "";
34 34 private $datasetId = array();
35 35 private $task = "";
36   - private $requestIndex = 0;
37 36  
38 37 function __construct()
39 38 {
... ... @@ -80,20 +79,10 @@ class ParamsRequestDataClass extends ProcessRequestDataClass
80 79 $this->task = $task;
81 80 }
82 81  
83   - public function getRequestIndex()
84   - {
85   - return $this->requestIndex;
86   - }
87   -
88   - public function setRequestIndex($requestIndex)
89   - {
90   - $this->requestIndex = $requestIndex;
91   - }
92   -
93   - public function addRequestNode()
  82 + public function addRequestNode($request_index)
94 83 {
95 84 $newRequestNode = new RequestNodeClass();
96   - $this->requestNodes[] = $newRequestNode;
  85 + $this->requestNodes[$request_index] = $newRequestNode;
97 86 return $newRequestNode;
98 87 }
99 88  
... ...