How to reset MAJA failed L2A products?
Sometimes, due to various problems like disk free space not available or failure of the share where /mnt/archive is mounted or failure of reading the input products, MAJA could fail and will mark the product as not available. Although a retry mechanism is implemented (in such cases, the product will be retried every day, for 3 days), still such products can occur in the database and they should be reprocessed once the external problem is solved.
In order to force reprocessing of the failed L2A products the following commands could be executed in the command line:
psql -U admin sen4cap -c "delete from l1_tile_history where downloader_history_id in (select id from downloader_history where status_id in (6,7))"
psql -U admin sen4cap -c "update downloader_history set status_id = 2 where status_id in (6,7)"
Please note that this will reset all the products that failed, even if the failure was due to high percentage of clouds or number of invalid pixels. This means that the products that previously failed from these reasons, will be marked as failed also at the next execution.
If ALL the products need to be re-processed (for example, due to a replacing the wrong version of MAJA that creates products in native format with a good one that creates products in MUSCATE format), in the list of status_id should be added also value 5 i.e replacing :
where status_id in (6,7)
where status_id in (5, 6,7)
and additionally, delete also the already processed L2A products from the product table with:
psql -U admin sen4cap -c "delete from product where product_type_id = 1 and satellite_id = 1"
IMPORTANT NOTE: The removal of all S2 L2A products in the database should be made with care and only in the cases when this is justified (like changing MAJA installation) otherwise an unnecessary reprocessing will be performed
If the reset is desired only for a certain site or satellite, additional filters can be added in the queries above. For example, if only the products from the satellite S2 need to be reset the following queries can be used:
psql -U admin sen4cap -c "delete from l1_tile_history where downloader_history_id in (select id from downloader_history where status_id in (6,7) and satellite_id = 1)"
psql -U admin sen4cap -c "update downloader_history set status_id = 2 where status_id in (6,7) and satellite_id = 1"
Similarly, a filter on site_id can be added after at the end by appending
" and site_id = <YOUR_SITE_ID>"
where <YOUR_SITE_ID> is the id of your site that you want to be reset.
The list of sites can be viewed using the following command:
psql -U admin sen4cap -c "select id, name, short_name from site"