From 7d14181a4c3cbfd1696f93fd3640a700bbc64dcc Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 23 Nov 2020 14:12:34 +0100 Subject: [PATCH] Fix multi-request (for multi-plot #8314) --- src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php | 2 +- src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php | 2 +- src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php | 5 ++--- src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php | 2 +- src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php | 4 +++- src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php | 2 +- src/Request/ParamsRequestImpl/ParamsRequestClass.php | 12 ++++++------ src/Request/ParamsRequestImpl/ParamsRequestDataClass.php | 15 ++------------- 8 files changed, 17 insertions(+), 27 deletions(-) diff --git a/src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php b/src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php index 83d48a9..99fe275 100644 --- a/src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php +++ b/src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php @@ -17,7 +17,7 @@ class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractCl /* '{"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"}' */ - $requestNode = $this->paramsData->addRequestNode(); + $requestNode = $this->paramsData->addRequestNode(0); $paramsNode = $requestNode->getParamsNode(); //unmarshall time definition diff --git a/src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php b/src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php index 09e791d..8a7a24b 100644 --- a/src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php +++ b/src/InputOutput/IHMImpl/Params/DownloadImpl/IHMInputOutputParamsDownloadClass.php @@ -19,7 +19,7 @@ class IHMInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClas // "header":"0","timesrc":"TimeTable","timeTables":[{"timeTableName":"rzerzer","id":"tt_1"},{"timeTableName":"sqsdq","id":"tt_0"}], //"list":["dst"],"milli":false,"fileformat":"ASCII","timeformat":"YYYY-MM-DDThh:mm:ss","compression":"tar+gzip","leaf":true} - $requestNode = $this->paramsData->addRequestNode(); + $requestNode = $this->paramsData->addRequestNode(0); $paramsNode = $requestNode->getParamsNode(); diff --git a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php index 630f1d9..aa912c6 100644 --- a/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php +++ b/src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php @@ -44,13 +44,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Request $this->isInteractiveRequest = ($input->{'file-output'} == 'INTERACTIVE'); $this->isFromWS = ($input->{'file-output'} == 'WS'); - $this->paramsData->setRequestIndex($input->{'tab-index'}); $postProcessCmd = ""; if ($resetZoom || $forceTimeZoomReset) $this->resetZoomList(PLOT_RESULT_FILE_KEY."_".$input->{'tab-index'}, $forceTimeZoomReset); - $requestNode = $this->paramsData->addRequestNode(); + $requestNode = $this->paramsData->addRequestNode($input->{'tab-index'}); $outputsNode = $requestNode->getOutputsNode(); $paramsNode = $requestNode->getParamsNode(); @@ -63,7 +62,7 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass $ttFileIndex = !isset($input->{'ttFileIndex'}) ? 0 : $input->{'ttFileIndex'}; $ttIntIndex = !isset($input->{'intIndex'}) ? 0 : $input->{'intIndex'}; } - $this->unmarshallTimeDefinition($input, 0, $ttFileIndex, $ttIntIndex); + $this->unmarshallTimeDefinition($input, $input->{'tab-index'}, $ttFileIndex, $ttIntIndex); $this->interactiveCrtTTFileIndex = $ttFileIndex; diff --git a/src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php b/src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php index 9c1223b..fdddb29 100644 --- a/src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php +++ b/src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php @@ -21,7 +21,7 @@ class IHMInputOutputParamsStatisticsClass extends IHMInputOutputParamsAbstractCl "parameter":[{"param":"imf_gsm","function":"min","template_args":"{}"},{"param":"imf_mag","function":"max","template_args":"{}"}], "timeTables":[{"id":"sharedtt_26"},{"id":"sharedtt_27"}],"leaf":true,"nodeType":"catalog"}]' */ - $requestNode = $this->paramsData->addRequestNode(); + $requestNode = $this->paramsData->addRequestNode(0); $paramsNode = $requestNode->getParamsNode(); diff --git a/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php b/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php index 6313f4d..7c361a9 100644 --- a/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php +++ b/src/InputOutput/WSImpl/Params/DownloadImpl/WSInputOutputParamsDownloadClass.php @@ -29,7 +29,9 @@ class WSInputOutputParamsDownloadClass extends IHMInputOutputParamsAbstractClass */ protected function unmarshallRequest($input) { - $requestNode = $this->paramsData->addRequestNode(); + //$this->jobsManager->cleanupResultDir(); + + $requestNode = $this->paramsData->addRequestNode(0); $paramsNode = $requestNode->getParamsNode(); diff --git a/src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php b/src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php index dc94392..218776f 100644 --- a/src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php +++ b/src/InputOutput/WSImpl/Params/PlotImpl/WSInputOutputParamsPlotClass.php @@ -31,7 +31,7 @@ class WSInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass //Request $postProcessCmd = ""; - $requestNode = $this->paramsData->addRequestNode(); + $requestNode = $this->paramsData->addRequestNode(0); $outputsNode = $requestNode->getOutputsNode(); $paramsNode = $requestNode->getParamsNode(); diff --git a/src/Request/ParamsRequestImpl/ParamsRequestClass.php b/src/Request/ParamsRequestImpl/ParamsRequestClass.php index 7d2b574..aa14967 100644 --- a/src/Request/ParamsRequestImpl/ParamsRequestClass.php +++ b/src/Request/ParamsRequestImpl/ParamsRequestClass.php @@ -23,11 +23,11 @@ class ParamsRequestClass extends ProcessRequestClass { case ParamsRequestTypeEnumClass::XMLREQUEST : $cmd = ""; - foreach ($this->requestData->getRequestNodes() as $requestNode) + foreach ($this->requestData->getRequestNodes() as $request_index => $requestNode) { if ($cmd != "") $cmd .= " && "; - $cmd .= KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath(); + $cmd .= KernelConfigClass::getKernelBinPath()."amdaXMLRequestorTool ".$this->getRequestFilePath($request_index); } $this->requestData->setCmd($cmd); break; @@ -63,7 +63,7 @@ class ParamsRequestClass extends ProcessRequestClass if ($this->requestData->getRequestType() == ParamsRequestTypeEnumClass::XMLREQUEST) { - foreach ($this->requestData->getRequestNodes() as $requestNode) + foreach ($this->requestData->getRequestNodes() as $request_index => $requestNode) { //inject time restriction if (!empty($this->requestData->getParamsTimeRestrictions())) { @@ -87,7 +87,7 @@ class ParamsRequestClass extends ProcessRequestClass $doc->appendChild($xmlNode); - if (!$doc->save($this->getRequestFilePath())) + if (!$doc->save($this->getRequestFilePath($request_index))) { $this->requestData->setLastErrorMessage('Cannot save params request XML file for request'); return false; @@ -252,9 +252,9 @@ class ParamsRequestClass extends ProcessRequestClass /* * @brief Get the request file path for AMDA_Kernel */ - private function getRequestFilePath() + private function getRequestFilePath($request_index) { - return $this->requestData->getWorkingPath()."request_".$this->requestData->getRequestIndex().".xml"; + return $this->requestData->getWorkingPath()."request_".$request_index.".xml"; } } ?> diff --git a/src/Request/ParamsRequestImpl/ParamsRequestDataClass.php b/src/Request/ParamsRequestImpl/ParamsRequestDataClass.php index 3242896..06a4116 100644 --- a/src/Request/ParamsRequestImpl/ParamsRequestDataClass.php +++ b/src/Request/ParamsRequestImpl/ParamsRequestDataClass.php @@ -33,7 +33,6 @@ class ParamsRequestDataClass extends ProcessRequestDataClass private $paramId = ""; private $datasetId = array(); private $task = ""; - private $requestIndex = 0; function __construct() { @@ -80,20 +79,10 @@ class ParamsRequestDataClass extends ProcessRequestDataClass $this->task = $task; } - public function getRequestIndex() - { - return $this->requestIndex; - } - - public function setRequestIndex($requestIndex) - { - $this->requestIndex = $requestIndex; - } - - public function addRequestNode() + public function addRequestNode($request_index) { $newRequestNode = new RequestNodeClass(); - $this->requestNodes[] = $newRequestNode; + $this->requestNodes[$request_index] = $newRequestNode; return $newRequestNode; } -- libgit2 0.21.2