Skip to content

Commit

Permalink
Merge remote-tracking branch 'necdet/fix/hinode-xrt-index' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarciabriseno committed Jan 28, 2025
2 parents 3a1d620 + 70b2de2 commit 322c6e0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion install/helioviewer/jp2parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from astropy.time import Time
from sunpy.map import Map, GenericMap
from sunpy.util.xml import xml_to_dict
from sunpy.io._header import FileHeader
from sunpy.io.header import FileHeader
from sunpy.map.mapbase import MapMetaValidationError
from glymur import Jp2k
from sunpy.util.xml import xml_to_dict
Expand Down
34 changes: 30 additions & 4 deletions src/Database/ImgIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* @link https://github.com/Helioviewer-Project/
*/

use Helioviewer\Api\Sentry\Sentry;

class Database_ImgIndex {

private $_dbConnection;
Expand Down Expand Up @@ -139,6 +141,7 @@ public function getMovieInformation($movieId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -183,6 +186,7 @@ public function storeMovieProperties($movieId, $startDate, $endDate,
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -220,6 +224,7 @@ public function finishedBuildingMovieFrames($movieId, $buildTimeStart,
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -252,6 +257,7 @@ public function markMovieAsProcessing($movieId, $format) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -288,6 +294,7 @@ public function markMovieAsFinished($movieId, $format, $procTime) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -317,6 +324,7 @@ public function markMovieAsInvalid($movieId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -344,6 +352,7 @@ public function getScreenshot($screenshotId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand All @@ -370,6 +379,7 @@ public function getImageInformation($dataId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -430,16 +440,14 @@ public function getDataFromDatabase($date, $sourceId) {
FROM data
WHERE ".$this->getDatasourceIDsString($sourceId)."
AND date = (SELECT date
FROM data " . $this->_forceIndex($sourceId) . "
WHERE ".$this->getDatasourceIDsString($sourceId)."
FROM data WHERE ".$this->getDatasourceIDsString($sourceId)."
AND date < '%s' ORDER BY date DESC LIMIT 1))
UNION ALL
(SELECT id, sourceId, filepath, filename, date
FROM data
WHERE ".$this->getDatasourceIDsString($sourceId)."
AND date = (SELECT date
FROM data " . $this->_forceIndex($sourceId) . "
WHERE ".$this->getDatasourceIDsString($sourceId)."
FROM data WHERE ".$this->getDatasourceIDsString($sourceId)."
AND date >= '%s' ORDER BY date ASC LIMIT 1))
) t
ORDER BY
Expand All @@ -449,10 +457,12 @@ public function getDataFromDatabase($date, $sourceId) {
$this->_dbConnection->link->real_escape_string($datestr),
$this->_dbConnection->link->real_escape_string($datestr)
);

try {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -608,6 +618,7 @@ public function getClosestDataBeforeDate($date, $sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
error_log("Failed to get closest image before date: " . $e->getMessage());
return false;
}
Expand Down Expand Up @@ -654,6 +665,7 @@ public function getClosestDataAfterDate($date, $sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -685,6 +697,7 @@ private function _getDataSourceName($sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -783,6 +796,7 @@ public function getDataCount($start, $end, $sourceId, $switchSources = false) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -948,6 +962,7 @@ public function getDataMidPoint($start, $end, $mid, $sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1037,6 +1052,7 @@ public function getDatasourceInformationFromSourceId($sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1106,6 +1122,7 @@ public function getDatasourceInformationFromNames($property_array) {
catch (Exception $e) {
error_log(print_r($property_array, true));
error_log($e->getMessage());
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1168,6 +1185,7 @@ public function getDataSourceLabels($property_array) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1214,10 +1232,12 @@ public function getSourceId($property_array) {
try {
$result = $this->_dbConnection->query($sql);
if ( $result->num_rows != 1 ) {
Sentry::capture($e);
return false;
}
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand All @@ -1242,6 +1262,7 @@ public function getOldestData($sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1274,6 +1295,7 @@ public function getNewestData($sourceId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1304,6 +1326,7 @@ public function getObservatoryForInstrument(string $instrument) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1339,6 +1362,7 @@ public function getDataSourcesByInstrument() {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down Expand Up @@ -1579,6 +1603,7 @@ public function getDataFilePathFromId($dataId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand All @@ -1605,6 +1630,7 @@ public function getScreenshotMetadata($screenshotId) {
$result = $this->_dbConnection->query($sql);
}
catch (Exception $e) {
Sentry::capture($e);
return false;
}

Expand Down
1 change: 0 additions & 1 deletion src/Job/MovieBuilder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* Helioviewer.org Movie Builder Resque Job
*
Expand Down

0 comments on commit 322c6e0

Please sign in to comment.