2015-01-08 1 views
0

"gcinfo"(firebase에서 출력되는 webcrawler)라는 단일 Go 프로그램을 Google App Engine의 cron으로 실행하려면 어떻게해야합니까?Google appengine에서 go programm (webcrawler)로 실행

나는 projekt-ID를 만들고 App SDK로 Go 프로그램을 업로드 할 수있었습니다. cron 작업은 매 15 분마다 cron.yaml에 정의 된대로 실행되었습니다. 오류가 없습니다. 그러나 나는 로그에서 아무 출력도 발견하지 않으며 firebase ist는 쓰지 않는다. app.yaml에서 많은 변경을 한 후 gcinfo.yaml 및 cron.yaml 결과가 없거나 (오류 코드 204)와 같은 오류가 발생했습니다. 이제 yaml-files의 설정에 대해 완전히 혼란 스럽습니다.

누군가이 설정에 대한 간단한 예를 들거나 알려 줄 수 있습니까? 나는 15 분마다 앱 엔진에서 하나의 Go 프로그램을 cron으로 실행하고 싶다.

내 PROJEKT의 structur은 다음과 같습니다

  • myproject라는 애플리케이션 제목을 가진 폴더가 hello.yaml와 함께 간단한 hello.go 예와
  • myproject라는 하위 폴더를 "안녕하세요"cron.yaml에 "Hello World!" gcinfo.yaml gcinfo.go과 함께
  • MyProject를 하위 "는 GcInfo"는 "

애플리케이션 제목

application: myproject 
version: 1 
runtime: go 
api_version: go1 

handlers: 
- url: /.* 
    script: _go_app 

cron.yaml

cron: 
- description: Ausfuehrung des tasks gcinfo 
url: /gcinfo 
schedule: every 15 minutes from 05:30 to 23:00 
timezone: Europe/Berlin 
target: gcinfo 
(중포 기지 출력과 webcrawler 이동)

gcinfo.yaml

application: myproject 
module: gcinfo 
#version: 1 
runtime: go 
api_version: go1 

handlers: 
- url: /gcinfo\.* 
script: gcinfo\gcinfo.go 

내 gcinfo.go는 "goapp에 배포"에서이 구성에 오류가없는 다음과 같은 구조

package gcinfo 

import (
... 
) 

.... 

func gcinfo() { 
.... 
} 

을 가지고 있으며에서 appengine는 6ms가 15 분마다 반응하지만, 이동의 programm에의 진 GcInfo에 대한 출력이 없습니다 . 나는 이미 동일한 결과로 main에 gcinfo를 만들려고 노력했다.

+1

코드 예제를 요구하지 마십시오. 관련 코드를 질문에 직접 포함하는 것이 좋습니다. [둘러보기] (http://stackoverflow.com/tour)를 읽으시 고 [질문하는 방법] (http://stackoverflow.com/questions/how-to-ask)을 읽으십시오. – honk

+0

힌트를 제공해 주셔서 감사합니다. 설명을 업데이트했습니다. –

답변

0

해결책을 찾았으며 이제는 cron 작업이 실행되고 작업 제어에 주석이 기록됩니다.

application: myproject 
module: gcinfo 
version: 1 
runtime: go 
api_version: go1 

handlers: 
- url: /gcinfo 
    script: _go_app 

및 gcinfo.go에 키 변경 (진 GcInfo 하위)는 GcInfo 하위 폴더

cron: 
- description: Ausfuehrung des tasks gcinfo 
url: /gcinfo 
schedule: every 15 minutes from 05:30 to 23:00 
timezone: Europe/Berlin 

애플리케이션 제목에 MyProject 폴더

cron.yaml

package gcinfo 

import (
"net/http" 
... 
"appengine" 
"appengine/urlfetch" 
) 

func init() { 
http.HandleFunc("/gcinfo", gcinfo) 
} 
... 

func gcinfo(w http.ResponseWriter, r *http.Request) { 
c := appengine.NewContext(r) 
... 
} 

firebase 엔진 작성은 appengine과 작동하지 않습니다. 나는 더 많은 연구를해야 할 것이다.

관련 문제