문제

I have configured Google App Engine to record exception with ereporter.

The cron job is configured to run every 59 minutes. The cron.yaml is as follows

cron:
- description: Daily exception report
  url: /_ereporter?sender=xxx.xxx@gmail.com  # The sender must be an app admin.
  schedule: every 59 minutes

How to do I run this immediately.

What I am trying to do here is simulate a 500 HTTP error and see the stack trace delivered immediately via the cron job.

도움이 되었습니까?

해결책

Just go to the URL from your browser.

다른 팁

You can't using cron. Cron is a scheduling system, you could get it to run every minute.

Alternately you could wrap your entire handler in a try/except block and try to catch everything. (You can do this for some DeadlineExceededErrors for instance) then fire off a task which invokes ereporter handler, and then re-raise the Exception.

However in many cases Google infrastructure can be the cause of the Error 500 and you won't be able to catch the error. To be honest you are only likely to be able to cause an email sent for a subset of all possible Error 500's. The most reliable way probably be to have a process continuously monitor the logs, and email from there.

Mind you email isn't consider reliable or fast so a 1 min cron cycle is probably fast enough.

I came across this thread as I was trying to do this as well. A (hacky) solution I found was to add a curl command at the end of my cloudbuild.yaml file that triggers the file immediately per this thread. Hope this helps!

Make a curl request in Cloud Build CI/CD pipeline

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top