我如何在Google应用引擎中运行一个名为"gcinfo“(带有firebase输出的网络爬虫)的Go程序?
我创建了一个projekt-ID,并用App上传了Go程序。按照cron.yaml中的定义,每15分钟执行一次cron作业。没有任何错误。但是我发现日志中没有输出,而消防队员没有写好。在对app.yaml、gcinfo.yaml和cron.yaml进行了大量更改之后,没有结果或错误,比如(错误代码204)。我现在完全困惑于yaml文件中的设置。
有人能给我或指出这些设置的一个简单的例子吗?我想每15分钟在应用程序引擎中作为一个cron运行一个Go程序。
我的projekt结构是:
app.yaml
application: myproject
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_appcron.yaml
cron:
- description: Ausfuehrung des tasks gcinfo
url: /gcinfo
schedule: every 15 minutes from 05:30 to 23:00
timezone: Europe/Berlin
target: gcinfogcinfo.yaml
application: myproject
module: gcinfo
#version: 1
runtime: go
api_version: go1
handlers:
- url: /gcinfo\.*
script: gcinfo\gcinfo.go我的gcinfo.go具有以下结构
package gcinfo
import (
...
)
....
func gcinfo() {
....
}这个配置在"goapp部署“中没有错误,应用引擎每15分钟响应6ms,但是go程序gcinfo没有输出。我已经试过用同样的结果制作gcinfo到main。
发布于 2015-01-14 18:30:16
我找到了一个解决方案,现在cron作业运行并在job中编写注释。
项目文件夹中的cron.yaml
cron:
- description: Ausfuehrung des tasks gcinfo
url: /gcinfo
schedule: every 15 minutes from 05:30 to 23:00
timezone: Europe/Berlin子文件夹gcinfo中的app.yaml
application: myproject
module: gcinfo
version: 1
runtime: go
api_version: go1
handlers:
- url: /gcinfo
script: _go_app 以及gcinfo.go (gcinfo子文件夹)中的关键更改
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)
...
}仅编写消防站引擎不适用于应用程序引擎。我得做更多的研究。
https://stackoverflow.com/questions/27843928
复制相似问题