나는 urllib2.urlopen와 느린 서버에서 14메가바이트 주위 크기의 파일을 요청하고있어, 그것은 데이터를 얻기 위해 60 초 이상을 보내고, 나는 오류 받고 있어요 : 여기urllib2.urlopen에서 GAE로 60 초 제한을 피할 수 있습니까?
Deadline exceeded while waiting for HTTP response from URL: http://bigfile.zip?type=CSV
을 내 코드 :
class CronChargeBT(webapp2.RequestHandler):
def get(self):
taskqueue.add(queue_name = 'optimized-queue', url='/cronChargeBTB')
class CronChargeBTB(webapp2.RequestHandler):
def post(self):
url = "http://bigfile.zip?type=CSV"
url_request = urllib2.Request(url)
url_request.add_header('Accept-encoding', 'gzip')
urlfetch.set_default_fetch_deadline(300)
response = urllib2.urlopen(url_request, timeout=300)
buf = StringIO(response.read())
f = gzip.GzipFile(fileobj=buf)
...work with the data insiste the file...
나는 CronChargeBT를 호출하는 cron 작업을 만듭니다. 여기에 cron.yaml :
- description: cargar BlueTomato
url: /cronChargeBT
target: charge
schedule: every wed,sun 01:00
하고 새 작업을 생성하고 큐에 삽입, 여기에 대기열 구성 : 제한 시간 coursethat의
- name: optimized-queue
rate: 40/s
bucket_size: 60
max_concurrent_requests: 10
retry_parameters:
task_retry_limit: 1
min_backoff_seconds: 10
max_backoff_seconds: 200
= 300은 60초 때문에 작동하지 않습니다 제한 GAE하지만 나는 일을 사용하여 그것을 피할 수 yhat 생각 ... 아무도 내가이 시간을 피하는 파일에서 데이터를 얻을 수있는 방법을 알고.
감사합니다.
감사합니다. @kanghj, 나는 시간 초과 오류가 urllib2.request, cron 작업과 관련이 있다고 생각합니다. 컴퓨터에서 파일을 다운로드 할 수있는 시간은 10 분이 안되며 3 분 정도 걸리며 코드는 내 개발 시스템에서 정상적으로 작동합니다. –
https://cloud.google.com/appengine/docs/java/outbound- # request_timeouts를 요청하면 cron 작업 요청의 최대 마감 시간은 60 초입니다. 여기서 병목이 될 수 있습니다. 그것은 당신이 관찰하고있는 것입니까? – kanghj91
실제로 GAE 자체가 부과 한 한계 때문에 주위를 둘러 볼 수 없습니다. – kanghj91