This commit is contained in:
Sarah Hoffmann 2013-10-03 22:22:50 +02:00
commit f054836e05

View File

@ -417,8 +417,9 @@
exec($sCMDCheckReplicationLag, $aReplicationLag, $iErrorLevel); exec($sCMDCheckReplicationLag, $aReplicationLag, $iErrorLevel);
} }
// There are new replication files - use osmosis to download the file // There are new replication files - use osmosis to download the file
echo "\nReplication Delay is ".$aReplicationLag[0]."\n"; echo "\n".date('Y-m-d H:i:s')." Replication Delay is ".$aReplicationLag[0]."\n";
} }
$fStartTime = time();
$fCMDStartTime = time(); $fCMDStartTime = time();
echo $sCMDDownload."\n"; echo $sCMDDownload."\n";
exec($sCMDDownload, $sJunk, $iErrorLevel); exec($sCMDDownload, $sJunk, $iErrorLevel);
@ -431,9 +432,10 @@
} }
$iFileSize = filesize($sImportFile); $iFileSize = filesize($sImportFile);
$sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory); $sBatchEnd = getosmosistimestamp($sOsmosisConfigDirectory);
echo "Completed for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
$sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osmosis')"; $sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osmosis')";
var_Dump($sSQL);
$oDB->query($sSQL); $oDB->query($sSQL);
echo date('Y-m-d H:i:s')." Completed osmosis step for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
} }
$iFileSize = filesize($sImportFile); $iFileSize = filesize($sImportFile);
@ -448,10 +450,10 @@
echo "Error: $iErrorLevel\n"; echo "Error: $iErrorLevel\n";
exit($iErrorLevel); exit($iErrorLevel);
} }
echo "Completed for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
$sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osm2pgsql')"; $sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','osm2pgsql')";
var_Dump($sSQL); var_Dump($sSQL);
$oDB->query($sSQL); $oDB->query($sSQL);
echo date('Y-m-d H:i:s')." Completed osm2pgsql step for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
// Archive for debug? // Archive for debug?
unlink($sImportFile); unlink($sImportFile);
@ -461,10 +463,10 @@
// Index file // Index file
$sThisIndexCmd = $sCMDIndex; $sThisIndexCmd = $sCMDIndex;
$fCMDStartTime = time();
if (!$aResult['no-npi']) if (!$aResult['no-npi'])
{ {
$fCMDStartTime = time();
$iFileID = $oDB->getOne('select nextval(\'file\')'); $iFileID = $oDB->getOne('select nextval(\'file\')');
if (PEAR::isError($iFileID)) if (PEAR::isError($iFileID))
{ {
@ -518,15 +520,16 @@
} }
} }
echo "Completed for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
$sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','index')"; $sSQL = "INSERT INTO import_osmosis_log values ('$sBatchEnd',$iFileSize,'".date('Y-m-d H:i:s',$fCMDStartTime)."','".date('Y-m-d H:i:s')."','index')";
var_Dump($sSQL);
$oDB->query($sSQL); $oDB->query($sSQL);
echo date('Y-m-d H:i:s')." Completed index step for $sBatchEnd in ".round((time()-$fCMDStartTime)/60,2)." minutes\n";
$sSQL = "update import_status set lastimportdate = '$sBatchEnd'"; $sSQL = "update import_status set lastimportdate = '$sBatchEnd'";
$oDB->query($sSQL); $oDB->query($sSQL);
$fDuration = time() - $fStartTime; $fDuration = time() - $fStartTime;
echo "Completed for $sBatchEnd in ".round($fDuration/60,2)."\n"; echo date('Y-m-d H:i:s')." Completed all for $sBatchEnd in ".round($fDuration/60,2)." minutes\n";
if (!$aResult['import-osmosis-all']) exit; if (!$aResult['import-osmosis-all']) exit;
if ( CONST_Replication_Update_Interval > 60 ) if ( CONST_Replication_Update_Interval > 60 )
@ -537,7 +540,7 @@
{ {
$iSleep = max(0,CONST_Replication_Update_Interval-$fDuration); $iSleep = max(0,CONST_Replication_Update_Interval-$fDuration);
} }
echo "Sleeping $iSleep seconds\n"; echo date('Y-m-d H:i:s')." Sleeping $iSleep seconds\n";
sleep($iSleep); sleep($iSleep);
} }