问题
For some reason my application stopped working this morning. After submitting a job, when making a request for it's status, it only returns accepted
Here's the code I'm using to create and run the job:
$url = "https://batch.geocoder.api.here.com/6.2/jobs?action=run&app_code=".$app_code."&app_id=".$app_id."&mailto=stackoverflow@example.com&outcols=latitude,longitude,locationLabel&outputcombined=true&indelim=|&outdelim=|&language=hu-HU&header=true";
if($cURLHandler) {
curl_setopt($cURLHandler, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($cURLHandler, CURLOPT_BINARYTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POST, true);
curl_setopt($cURLHandler, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cURLHandler, CURLOPT_POSTFIELDS, file_get_contents($userFolderURL."/batchjob.txt"));
curl_setopt($cURLHandler, CURLOPT_URL, $url);
$cURLResults = curl_exec($cURLHandler);
curl_close($cURLHandler);
}
This is the content of an example batchjob.txt:
recId|searchText|country
1|"2120 Dunakeszi Barátság útja 18"|HUN
2|"2120 Dunakeszi Barátság útja 18"|HUN
3|"2120 Dunakeszi Baràtsàg útja 12"|HUN
4|"2120 Dunakeszi Barátság utja 49"|HUN
5|"2120 Dunakeszi Barátság útja 3"|HUN
6|"2120 Dunakeszi Barátság útja.30"|HUN
7|"2120 Dunakeszi Bátorkeszi utca 7."|HUN
8|"2120 Dunakeszi bercsényi u 27"|HUN
9|"2120 Dunakeszi Déli utca 12."|HUN
After creating and running a job I check it's status every 10 seconds with the following cURL request:
$url = "https://batch.geocoder.api.here.com/6.2/jobs/".$requestID."?action=status&app_code=".$app_code."&app_id=".$app_id;
$ch = curl_init();
if($ch) {
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain'));
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
curl_close($ch);
}
But it always returns the following xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1"><Response><MetaInfo><RequestId>REQUESTID ommited</RequestId></MetaInfo><Status>accepted</Status><TotalCount>0</TotalCount><ValidCount>0</ValidCount><InvalidCount>0</InvalidCount><ProcessedCount>0</ProcessedCount><PendingCount>0</PendingCount><SuccessCount>0</SuccessCount><ErrorCount>0</ErrorCount></Response></ns2:SearchBatch>
I double checked, my app code & app id are both valid, so I really don't see the reason to why this is happening.
According to the official docs, my 1st cURL request should create & start the job, however for some reason it seems that it never does? What may be the issue here?
回答1:
Status "accepted" means that your job has been queued and is waiting for a slot to execute. We at HERE are monitoring the queues to make sure that capacity is adjusted as needed.
So I guess that your application is ok and the bottleneck was probably on our side.
来源:https://stackoverflow.com/questions/46104628/here-api-never-runs-batch-job-always-returns-accepted-status