Commit e658d6742ce8258c004965b265d35e46a866e45d
Exists in
master
and in
66 other branches
Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_Integration
Showing
7 changed files
with
243 additions
and
17 deletions
Show diff stats
src/InputOutput/IHMImpl/IHMInputOutputClass.php
@@ -50,6 +50,10 @@ class IHMInputOutputClass implements InputOutputInterface | @@ -50,6 +50,10 @@ class IHMInputOutputClass implements InputOutputInterface | ||
50 | } | 50 | } |
51 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); | 51 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); |
52 | break; | 52 | break; |
53 | + case 'statistics' : | ||
54 | + //catalog generation | ||
55 | + $this->inputOutput = new IHMInputOutputParamsStatisticsClass(); | ||
56 | + break; | ||
53 | default : | 57 | default : |
54 | throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.'); | 58 | throw new Exception('Params request type '.$input_request->nodeType.' not implemented for this client.'); |
55 | } | 59 | } |
@@ -60,7 +64,7 @@ class IHMInputOutputClass implements InputOutputInterface | @@ -60,7 +64,7 @@ class IHMInputOutputClass implements InputOutputInterface | ||
60 | break; | 64 | break; |
61 | case FunctionTypeEnumClass::ACTION : | 65 | case FunctionTypeEnumClass::ACTION : |
62 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); | 66 | $this->inputOutput = new IHMInputOutputParamsPlotClass(); |
63 | - $requestId = str_replace("_","",$input->folderId); | 67 | + $requestId = str_replace("_","",$input->folderId); |
64 | break; | 68 | break; |
65 | case FunctionTypeEnumClass::PROCESSDELETE : | 69 | case FunctionTypeEnumClass::PROCESSDELETE : |
66 | $this->inputOutput = new IHMInputOutputDeleteProcessClass(); | 70 | $this->inputOutput = new IHMInputOutputDeleteProcessClass(); |
@@ -71,8 +75,8 @@ class IHMInputOutputClass implements InputOutputInterface | @@ -71,8 +75,8 @@ class IHMInputOutputClass implements InputOutputInterface | ||
71 | case FunctionTypeEnumClass::PROCESSGETINFO : | 75 | case FunctionTypeEnumClass::PROCESSGETINFO : |
72 | $this->inputOutput = new IHMInputOutputGetInfoProcessClass(); | 76 | $this->inputOutput = new IHMInputOutputGetInfoProcessClass(); |
73 | break; | 77 | break; |
74 | - case FunctionTypeEnumClass::PROCESSCLEAN : | ||
75 | - $this->inputOutput = new IHMInputOutputCleanProcessClass(); | 78 | + case FunctionTypeEnumClass::PROCESSCLEAN : |
79 | + $this->inputOutput = new IHMInputOutputCleanProcessClass(); | ||
76 | break; | 80 | break; |
77 | /*case FunctionTypeEnumClass::TTMERGE : | 81 | /*case FunctionTypeEnumClass::TTMERGE : |
78 | $this->inputOutput = new IHMInputOutputMergeTTClass(); | 82 | $this->inputOutput = new IHMInputOutputMergeTTClass(); |
@@ -99,4 +103,4 @@ class IHMInputOutputClass implements InputOutputInterface | @@ -99,4 +103,4 @@ class IHMInputOutputClass implements InputOutputInterface | ||
99 | } | 103 | } |
100 | } | 104 | } |
101 | 105 | ||
102 | -?> | 106 | +?> |
src/InputOutput/IHMImpl/Params/StatisticsImpl/IHMInputOutputParamsStatisticsClass.php
0 โ 100644
@@ -0,0 +1,62 @@ | @@ -0,0 +1,62 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +define ("STATISTICS_RESULT_FILE_KEY", "statistic"); | ||
4 | + | ||
5 | +/** | ||
6 | + * @class IHMInputOutputParamsStatisticsClass | ||
7 | + * @brief Implementation of IHMInputOutputParamsAbstractClass to treat catalog generation request | ||
8 | + * @details | ||
9 | +*/ | ||
10 | +class IHMInputOutputParamsStatisticsClass extends IHMInputOutputParamsAbstractClass | ||
11 | +{ | ||
12 | + /* | ||
13 | + * @brief method to unmarshall a catalog generation request | ||
14 | + */ | ||
15 | + protected function unmarshallRequest($input) | ||
16 | + { | ||
17 | + /* | ||
18 | + {"id":"","timesrc":"TimeTable","name":"test","created":null,"description":"first","objName":"","objFormat":"","folderId":"","nbIntervals":0,"cacheToken":"","parameter":[{"param":"imf_gsm","function":"min"},{"param":"imf_mag","function":"max"}],"timeTables":[{"id":"sharedtt_26"},{"id":"sharedtt_27"}],"leaf":true,"nodeType":"catalog"}]' | ||
19 | + */ | ||
20 | + $paramsNode = $this->paramsData->getRequestNode()->getParamsNode(); | ||
21 | + | ||
22 | + //unmarshall time definition | ||
23 | + $this->unmarshallTimeDefinition($input); | ||
24 | + | ||
25 | + //unmarshall statistic output definition | ||
26 | + $outputsNode = $this->paramsData->getRequestNode()->getOutputsNode(); | ||
27 | + $catalogNode = $outputsNode->addNewOutput(RequestOutputTypeEnum::STATISTIC); | ||
28 | + $catalogNode->setTimeFormat(RequestOutputStatisticTimeFormatEnum::ISO); | ||
29 | + $catalogNode->setFileFormat(RequestOutputStatisticFileFormatEnum::XML); | ||
30 | + | ||
31 | + // parse parameters / functions array | ||
32 | + foreach ($input->parameter as $obj) { | ||
33 | + $paramFunctionAssociation[$obj->param][] = $obj->function; | ||
34 | + } | ||
35 | + | ||
36 | + foreach ($paramFunctionAssociation as $param => $functions) { | ||
37 | + $paramsNode->addParam($param); | ||
38 | + $outputParamNode = $catalogNode->addParam($param); | ||
39 | + foreach ($functions as $function) $outputParamNode->addFunction($function); | ||
40 | + $paramInfo = $this->paramManager->addExistingParam($param,$this->paramsData); | ||
41 | + } | ||
42 | + | ||
43 | + $resultFile = "result_".$this->requestID; | ||
44 | + $this->paramsData->addWaitingResult(STATISTICS_RESULT_FILE_KEY, $resultFile); | ||
45 | +// | ||
46 | + $postProcessCmd = "mv statistic-*"; | ||
47 | + $postProcessCmd .= " ".$resultFile.".xml"; | ||
48 | + | ||
49 | +// | ||
50 | + $this->paramsData->setPostCmd($postProcessCmd); | ||
51 | + return $this->paramsData; | ||
52 | + } | ||
53 | + | ||
54 | + /* | ||
55 | + * @brief method to marshall the result of a catalog generation request | ||
56 | + */ | ||
57 | + protected function marshallResult($data) | ||
58 | + { | ||
59 | + return $this->commonMarshallResult($data,STATISTICS_RESULT_FILE_KEY); | ||
60 | + } | ||
61 | +} | ||
62 | +?> | ||
0 | \ No newline at end of file | 63 | \ No newline at end of file |
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
@@ -10,11 +10,13 @@ class IHMJobsManagerClass { | @@ -10,11 +10,13 @@ class IHMJobsManagerClass { | ||
10 | 10 | ||
11 | protected $bkgRootNode = array('condition' => 'bkgSearch-treeRootNode', | 11 | protected $bkgRootNode = array('condition' => 'bkgSearch-treeRootNode', |
12 | 'request' => 'bkgPlot-treeRootNode', | 12 | 'request' => 'bkgPlot-treeRootNode', |
13 | - 'download' => 'bkgDown-treeRootNode'); | 13 | + 'download' => 'bkgDown-treeRootNode', |
14 | + 'statistics' => 'bkgStatistics-treeRootNode'); | ||
14 | 15 | ||
15 | protected $resRootNode = array('condition' => 'resSearch-treeRootNode', | 16 | protected $resRootNode = array('condition' => 'resSearch-treeRootNode', |
16 | 'request' => 'resPlot-treeRootNode', | 17 | 'request' => 'resPlot-treeRootNode', |
17 | - 'download' => 'resDown-treeRootNode'); | 18 | + 'download' => 'resDown-treeRootNode', |
19 | + 'statistics' => 'resStatistics-treeRootNode'); | ||
18 | 20 | ||
19 | /* | 21 | /* |
20 | * @brief Constructor | 22 | * @brief Constructor |
@@ -259,6 +261,10 @@ class IHMJobsManagerClass { | @@ -259,6 +261,10 @@ class IHMJobsManagerClass { | ||
259 | $name = 'datamining_'.time(); | 261 | $name = 'datamining_'.time(); |
260 | $info = $obj->expression; | 262 | $info = $obj->expression; |
261 | break; | 263 | break; |
264 | + case 'statistics' : | ||
265 | + $name = 'statistics_'.time(); | ||
266 | + $info = $obj->expression; | ||
267 | + break; | ||
262 | case 'download' : | 268 | case 'download' : |
263 | if ($obj->downloadSrc == '2') //fits image | 269 | if ($obj->downloadSrc == '2') //fits image |
264 | $name = "download_fits_".time(); | 270 | $name = "download_fits_".time(); |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
@@ -80,7 +80,6 @@ class IHMParamManagerClass | @@ -80,7 +80,6 @@ class IHMParamManagerClass | ||
80 | $paramId = $param; | 80 | $paramId = $param; |
81 | 81 | ||
82 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; | 82 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; |
83 | - | ||
84 | if (!file_exists($paramPath)) | 83 | if (!file_exists($paramPath)) |
85 | throw new Exception('Cannot find parameter local file '.$paramId); | 84 | throw new Exception('Cannot find parameter local file '.$paramId); |
86 | 85 | ||
@@ -96,8 +95,8 @@ class IHMParamManagerClass | @@ -96,8 +95,8 @@ class IHMParamManagerClass | ||
96 | */ | 95 | */ |
97 | private function addLinkedLocalParams($paramId,$paramsData) | 96 | private function addLinkedLocalParams($paramId,$paramsData) |
98 | { | 97 | { |
99 | - $doc = new DOMDocument("1.0", "UTF-8"); | ||
100 | - $doc->preserveWhiteSpace = false; | 98 | + $doc = new DOMDocument("1.0", "UTF-8"); |
99 | + $doc->preserveWhiteSpace = false; | ||
101 | $doc->formatOutput = true; | 100 | $doc->formatOutput = true; |
102 | 101 | ||
103 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; | 102 | $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; |
@@ -143,14 +142,14 @@ class IHMParamManagerClass | @@ -143,14 +142,14 @@ class IHMParamManagerClass | ||
143 | 142 | ||
144 | //parse expression | 143 | //parse expression |
145 | if (!isset($this->expressionParser)) | 144 | if (!isset($this->expressionParser)) |
146 | - $this->expressionParser = new IHMExpressionParserClass(); | 145 | + $this->expressionParser = new IHMExpressionParserClass(); |
147 | $expressionInfo = $this->expressionParser->parse($res["param"]["expression"]); | 146 | $expressionInfo = $this->expressionParser->parse($res["param"]["expression"]); |
148 | 147 | ||
149 | - $paramId = $param; | ||
150 | - | ||
151 | - //create a process param for the derived parameter | ||
152 | - $this->addProcessParam($paramId, $expressionInfo["expression"], | ||
153 | - $expressionInfo['params'], $res["param"]["timestep"], | 148 | + $paramId = $param; |
149 | + | ||
150 | + //create a process param for the derived parameter | ||
151 | + $this->addProcessParam($paramId, $expressionInfo["expression"], | ||
152 | + $expressionInfo['params'], $res["param"]["timestep"], | ||
154 | 0,$res["param"]["dateModif"],$paramsData); | 153 | 0,$res["param"]["dateModif"],$paramsData); |
155 | 154 | ||
156 | return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); | 155 | return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputStatisticNodeClass.php
0 โ 100644
@@ -0,0 +1,150 @@ | @@ -0,0 +1,150 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +define ("REQUESTOUTPUTSTATISTIC_NAME", "statistic"); | ||
4 | +define ("REQUESTOUTPUTSTATISTIC_TIMEFORMAT", "timeFormat"); | ||
5 | +define ("REQUESTOUTPUTSTATISTIC_FILEFORMAT", "fileFormat"); | ||
6 | +define ("REQUESTOUTPUTSTATISTIC_STRUCTURE", "outputStructure"); | ||
7 | +define ("REQUESTOUTPUTSTATISTIC_FILENAME", "fileName"); | ||
8 | + | ||
9 | +define ("REQUESTOUTPUTSTATISTICPARAM_NAME", "param"); | ||
10 | +define ("REQUESTOUTPUTSTATISTICFUNCTION_NAME", "function"); | ||
11 | +define ("REQUESTOUTPUTSTATISTICPARAM_ID", "id"); | ||
12 | +define ("REQUESTOUTPUTSTATISTICFUNCTION_ID", "name"); | ||
13 | + | ||
14 | +abstract class RequestOutputStatisticTimeFormatEnum | ||
15 | +{ | ||
16 | + const UNKNOWN = ""; | ||
17 | + const ISO = "ISO"; | ||
18 | +} | ||
19 | + | ||
20 | +abstract class RequestOutputStatisticFileFormatEnum | ||
21 | +{ | ||
22 | + const UNKNOWN = ""; | ||
23 | + const ASCII = "ASCII"; | ||
24 | + const XML = "XML"; | ||
25 | + const VOT = "VOT"; | ||
26 | +} | ||
27 | + | ||
28 | +abstract class RequestOutputStatisticStructureEnum | ||
29 | +{ | ||
30 | + const UNKNOWN = ""; | ||
31 | + const ONE_FILE = "one-file"; | ||
32 | + const ONE_FILE_PER_INTERVAL = "one-file-per-interval"; | ||
33 | +} | ||
34 | + | ||
35 | +class RequestOutputStatisticFunctionNodeClass extends NodeClass | ||
36 | +{ | ||
37 | + public function __construct() | ||
38 | + { | ||
39 | + parent::__construct(REQUESTOUTPUTSTATISTICFUNCTION_NAME); | ||
40 | + } | ||
41 | + | ||
42 | + public function setFunctionName($name) | ||
43 | + { | ||
44 | + $this->setAttribute(REQUESTOUTPUTSTATISTICFUNCTION_ID, $name); | ||
45 | + } | ||
46 | +} | ||
47 | + | ||
48 | +class RequestOutputStatisticParamNodeClass extends NodeClass | ||
49 | +{ | ||
50 | + public function __construct() | ||
51 | + { | ||
52 | + parent::__construct(REQUESTOUTPUTSTATISTICPARAM_NAME); | ||
53 | + } | ||
54 | + | ||
55 | + public function setId($id) | ||
56 | + { | ||
57 | + $this->setAttribute(REQUESTOUTPUTSTATISTICPARAM_ID, $id); | ||
58 | + } | ||
59 | + | ||
60 | + public function getId() | ||
61 | + { | ||
62 | + return $this->getAttribute(REQUESTOUTPUTSTATISTICPARAM_ID); | ||
63 | + } | ||
64 | + | ||
65 | + public function addFunction($name) | ||
66 | + { | ||
67 | + $node = new RequestOutputStatisticFunctionNodeClass(); | ||
68 | + $this->addChild($node); | ||
69 | + $node->setFunctionName($name); | ||
70 | + } | ||
71 | +} | ||
72 | + | ||
73 | +/** | ||
74 | + * @class RequestOutputStatisticNodeClass | ||
75 | + * @brief Definition of a request data mining output node for AMDA_Kernel | ||
76 | + * @details | ||
77 | + */ | ||
78 | +class RequestOutputStatisticNodeClass extends NodeClass | ||
79 | + { | ||
80 | + public function __construct() | ||
81 | + { | ||
82 | + parent::__construct(REQUESTOUTPUTSTATISTIC_NAME); | ||
83 | + } | ||
84 | + | ||
85 | + public function setTimeFormat($timeFormat) | ||
86 | + { | ||
87 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_TIMEFORMAT, true); | ||
88 | + $node->setValue($timeFormat); | ||
89 | + } | ||
90 | + | ||
91 | + public function setFileFormat($fileFormat) | ||
92 | + { | ||
93 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_FILEFORMAT, true); | ||
94 | + $node->setValue($fileFormat); | ||
95 | + } | ||
96 | + | ||
97 | + public function setStructure($structure) | ||
98 | + { | ||
99 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_STRUCTURE, true); | ||
100 | + $node->setValue($structure); | ||
101 | + } | ||
102 | + | ||
103 | + public function setFileName($fileName) | ||
104 | + { | ||
105 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTSTATISTIC_FILENAME, true); | ||
106 | + $node->setValue($fileName); | ||
107 | + } | ||
108 | + | ||
109 | + public function addParam($id) | ||
110 | + { | ||
111 | + $paramsNode = $this->getFirstChildByName(REQUESTPARAMS_NAME); | ||
112 | + | ||
113 | + if (!$paramsNode) | ||
114 | + { | ||
115 | + $paramsNode = new RequestParamsNodeClass(); | ||
116 | + $this->addChild($paramsNode); | ||
117 | + } | ||
118 | + | ||
119 | + $node = new RequestOutputStatisticParamNodeClass(); | ||
120 | + $paramsNode->addChild($node); | ||
121 | + | ||
122 | + $node->setId($id); | ||
123 | + | ||
124 | + return $node; | ||
125 | + } | ||
126 | + | ||
127 | + public function addPostProcessing($process) | ||
128 | + { | ||
129 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME); | ||
130 | + if ($node == NULL) | ||
131 | + { | ||
132 | + $node = new RequestOutputPostProcessingNodeClass(); | ||
133 | + $this->addChild($node); | ||
134 | + } | ||
135 | + | ||
136 | + $node->addPostProcessing($process); | ||
137 | + } | ||
138 | + | ||
139 | + public function isPostProcessing($process) | ||
140 | + { | ||
141 | + $node = $this->getChildInstanceByName(REQUESTOUTPUTPOSTPROCESSING_NAME); | ||
142 | + | ||
143 | + if ($node == NULL) | ||
144 | + return false; | ||
145 | + | ||
146 | + return $node->isPostProcessing($process); | ||
147 | + } | ||
148 | +} | ||
149 | + | ||
150 | +?> | ||
0 | \ No newline at end of file | 151 | \ No newline at end of file |
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputsNodeClass.php
@@ -6,6 +6,7 @@ abstract class RequestOutputTypeEnum | @@ -6,6 +6,7 @@ abstract class RequestOutputTypeEnum | ||
6 | const DOWNLOAD = "Download"; | 6 | const DOWNLOAD = "Download"; |
7 | const DATAMINING = "DataMining"; | 7 | const DATAMINING = "DataMining"; |
8 | const PLOT = "Plot"; | 8 | const PLOT = "Plot"; |
9 | + const STATISTIC = "Statistic"; | ||
9 | } | 10 | } |
10 | 11 | ||
11 | /** | 12 | /** |
@@ -33,6 +34,9 @@ class RequestOutputsNodeClass extends NodeClass | @@ -33,6 +34,9 @@ class RequestOutputsNodeClass extends NodeClass | ||
33 | case RequestOutputTypeEnum::PLOT : | 34 | case RequestOutputTypeEnum::PLOT : |
34 | $output = new RequestOutputPlotNodeClass(); | 35 | $output = new RequestOutputPlotNodeClass(); |
35 | break; | 36 | break; |
37 | + case RequestOutputTypeEnum::STATISTIC : | ||
38 | + $output = new RequestOutputStatisticNodeClass(); | ||
39 | + break; | ||
36 | default : | 40 | default : |
37 | throw new Exception('Output node not implemented'); | 41 | throw new Exception('Output node not implemented'); |
38 | } | 42 | } |
src/RequestManager.php
@@ -9,6 +9,7 @@ function amdaintegration_autoload($class_name) | @@ -9,6 +9,7 @@ function amdaintegration_autoload($class_name) | ||
9 | 'InputOutput/IHMImpl/Config', | 9 | 'InputOutput/IHMImpl/Config', |
10 | 'InputOutput/IHMImpl/Params', | 10 | 'InputOutput/IHMImpl/Params', |
11 | 'InputOutput/IHMImpl/Params/DataMiningImpl', | 11 | 'InputOutput/IHMImpl/Params/DataMiningImpl', |
12 | + 'InputOutput/IHMImpl/Params/StatisticsImpl', | ||
12 | 'InputOutput/IHMImpl/Params/DownloadImpl', | 13 | 'InputOutput/IHMImpl/Params/DownloadImpl', |
13 | 'InputOutput/IHMImpl/Params/PlotImpl', | 14 | 'InputOutput/IHMImpl/Params/PlotImpl', |
14 | 'InputOutput/IHMImpl/Params/GeneratorImpl', | 15 | 'InputOutput/IHMImpl/Params/GeneratorImpl', |
@@ -151,10 +152,10 @@ Class RequestManagerClass | @@ -151,10 +152,10 @@ Class RequestManagerClass | ||
151 | 152 | ||
152 | //get the input data from the request input data by using the InputOutput interface | 153 | //get the input data from the request input data by using the InputOutput interface |
153 | $inputdata = $inputOutput->getInputData($input,$function); | 154 | $inputdata = $inputOutput->getInputData($input,$function); |
154 | - | 155 | + |
155 | //create an instance of the RequestClass to run the request | 156 | //create an instance of the RequestClass to run the request |
156 | $request = $this->createRequest($userHost, $function); | 157 | $request = $this->createRequest($userHost, $function); |
157 | - | 158 | + |
158 | if (is_array($inputdata)) | 159 | if (is_array($inputdata)) |
159 | { | 160 | { |
160 | $outputdata = array(); | 161 | $outputdata = array(); |