2

I have 2 service in the same project.

One service name is BAR One service name is FOO

I have cron on BAR and I have two environments "default" and "staging"

I can set Cron like this

- description: "STAGING: BAR"
  url: /en/cron
  schedule: 1 of month 07:00
  target: staging
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 5

- description: "PROD: BAR"
  url: /en/cron
  schedule: 1 of month 07:00
  target: default
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 5

I'd like to do this even with FOO I have two environments "foo" and "stagingfoo"

- description: "STAGING: FOO"
  url: /en/foo/cron
  schedule: 1 of month 07:00
  target: stagingfoo
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 5

- description: "PROD: FOO"
  url: /en/foo/cron
  schedule: 1 of month 07:00
  target: foo
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 5

But stagingfoo gave an error, maybe it doesn't find the route. I can't see any error from my console

> target: staging works 
> target: default works 
> target: foo works target:
> stagingfoo doesn't work

I have only one cron.yaml file in FOO root

Samuel N
  • 615
  • 5
  • 10
monkeyUser
  • 4,301
  • 7
  • 46
  • 95

1 Answers1

2

You have to specify "FOO" Target like this:

- description: "STAGING: FOO"
  url: /en/foo/cron
  schedule: 1 of month 07:00
  target: stagingfoo-dot-foo
  retry_parameters:
    min_backoff_seconds: 2.5
    max_doublings: 5
Barno
  • 3,271
  • 5
  • 28
  • 58
  • In addition to the answer already provided, let me reference this documentation [1] on the syntax for the cron.yaml configuration. You had to specify the ‘target:’ as ‘stagingfoo-dot-foo’ because the target URL is usually the name of the service. In your case the cron job needs to be routed to the URL in your app to which you want the Cron service to send job requests [2]. [1] https://cloud.google.com/appengine/docs/standard/java/config/cronref-yaml#cron_job_definitions [2] https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed#targeted_routing – Ying Li Jul 13 '18 at 18:19