how to reuse config in cron.yaml?
I have a lot of cron jobs with same config. I want to use vars to reuse some configs.
Here is my try.
cron.yaml:
cron:
- description: 'a'
url: /cron/events/a/b
schedule: &schedule every 1 hours
target: &target reuse-cron-config
- description: 'b'
url: /cron/events/a/c
schedule: *schedule
target: *target
But when I ran gcloud app deploy ./cron.yaml. It thrown an error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml]
Anchors not supported in this handler
in "/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml", line 4, column 15
All of my cron jobs have same target and schedule. How can I solve this? thanks.
update
I have a route like this to get params for each cron url:
app.get('/cron/events/:topic/:retryTopic', (req, res) => {
console.log(req.params); // {topic: 'a', retryTopic: 'b'}
})
google-app-engine
|
show 2 more comments
I have a lot of cron jobs with same config. I want to use vars to reuse some configs.
Here is my try.
cron.yaml:
cron:
- description: 'a'
url: /cron/events/a/b
schedule: &schedule every 1 hours
target: &target reuse-cron-config
- description: 'b'
url: /cron/events/a/c
schedule: *schedule
target: *target
But when I ran gcloud app deploy ./cron.yaml. It thrown an error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml]
Anchors not supported in this handler
in "/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml", line 4, column 15
All of my cron jobs have same target and schedule. How can I solve this? thanks.
update
I have a route like this to get params for each cron url:
app.get('/cron/events/:topic/:retryTopic', (req, res) => {
console.log(req.params); // {topic: 'a', retryTopic: 'b'}
})
google-app-engine
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
@JeffO'Neill I think this case has a little different. I usereq.paramsto geta,bandc. So, I have to declare every url incron.yamlfile.
– slideshowp2
Nov 3 '18 at 2:24
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
@JeffO'Neill. Yeah. My point is to reusetargetandschedule. that's it. I don't want to declare them in each cron job. Like declare avar
– slideshowp2
Nov 3 '18 at 13:52
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27
|
show 2 more comments
I have a lot of cron jobs with same config. I want to use vars to reuse some configs.
Here is my try.
cron.yaml:
cron:
- description: 'a'
url: /cron/events/a/b
schedule: &schedule every 1 hours
target: &target reuse-cron-config
- description: 'b'
url: /cron/events/a/c
schedule: *schedule
target: *target
But when I ran gcloud app deploy ./cron.yaml. It thrown an error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml]
Anchors not supported in this handler
in "/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml", line 4, column 15
All of my cron jobs have same target and schedule. How can I solve this? thanks.
update
I have a route like this to get params for each cron url:
app.get('/cron/events/:topic/:retryTopic', (req, res) => {
console.log(req.params); // {topic: 'a', retryTopic: 'b'}
})
google-app-engine
I have a lot of cron jobs with same config. I want to use vars to reuse some configs.
Here is my try.
cron.yaml:
cron:
- description: 'a'
url: /cron/events/a/b
schedule: &schedule every 1 hours
target: &target reuse-cron-config
- description: 'b'
url: /cron/events/a/c
schedule: *schedule
target: *target
But when I ran gcloud app deploy ./cron.yaml. It thrown an error:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml]
Anchors not supported in this handler
in "/Users/ldu020/workspace/nodejs-gcp/src/app-engine/standard-environment/reuse-cron-config/cron.yaml", line 4, column 15
All of my cron jobs have same target and schedule. How can I solve this? thanks.
update
I have a route like this to get params for each cron url:
app.get('/cron/events/:topic/:retryTopic', (req, res) => {
console.log(req.params); // {topic: 'a', retryTopic: 'b'}
})
google-app-engine
google-app-engine
edited Nov 16 '18 at 2:14
slideshowp2
asked Nov 2 '18 at 7:43
slideshowp2slideshowp2
2,56512465
2,56512465
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
@JeffO'Neill I think this case has a little different. I usereq.paramsto geta,bandc. So, I have to declare every url incron.yamlfile.
– slideshowp2
Nov 3 '18 at 2:24
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
@JeffO'Neill. Yeah. My point is to reusetargetandschedule. that's it. I don't want to declare them in each cron job. Like declare avar
– slideshowp2
Nov 3 '18 at 13:52
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27
|
show 2 more comments
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
@JeffO'Neill I think this case has a little different. I usereq.paramsto geta,bandc. So, I have to declare every url incron.yamlfile.
– slideshowp2
Nov 3 '18 at 2:24
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
@JeffO'Neill. Yeah. My point is to reusetargetandschedule. that's it. I don't want to declare them in each cron job. Like declare avar
– slideshowp2
Nov 3 '18 at 13:52
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
@JeffO'Neill I think this case has a little different. I use
req.params to get a, b and c. So, I have to declare every url in cron.yaml file.– slideshowp2
Nov 3 '18 at 2:24
@JeffO'Neill I think this case has a little different. I use
req.params to get a, b and c. So, I have to declare every url in cron.yaml file.– slideshowp2
Nov 3 '18 at 2:24
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
@JeffO'Neill. Yeah. My point is to reuse
target and schedule. that's it. I don't want to declare them in each cron job. Like declare a var– slideshowp2
Nov 3 '18 at 13:52
@JeffO'Neill. Yeah. My point is to reuse
target and schedule. that's it. I don't want to declare them in each cron job. Like declare a var– slideshowp2
Nov 3 '18 at 13:52
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27
|
show 2 more comments
1 Answer
1
active
oldest
votes
You could wrap up all of these cron entries into a single entry called 'Hourly tasks' or 'daily tasks' and then the request handler could then launch all of these tasks via the task queue.
This would also help you stay well under the the cap imposed on the total number of cron tasks youre allowed to have
https://cloud.google.com/appengine/docs/standard/python/config/cronref#limits
Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53114512%2fhow-to-reuse-config-in-cron-yaml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could wrap up all of these cron entries into a single entry called 'Hourly tasks' or 'daily tasks' and then the request handler could then launch all of these tasks via the task queue.
This would also help you stay well under the the cap imposed on the total number of cron tasks youre allowed to have
https://cloud.google.com/appengine/docs/standard/python/config/cronref#limits
Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
add a comment |
You could wrap up all of these cron entries into a single entry called 'Hourly tasks' or 'daily tasks' and then the request handler could then launch all of these tasks via the task queue.
This would also help you stay well under the the cap imposed on the total number of cron tasks youre allowed to have
https://cloud.google.com/appengine/docs/standard/python/config/cronref#limits
Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
add a comment |
You could wrap up all of these cron entries into a single entry called 'Hourly tasks' or 'daily tasks' and then the request handler could then launch all of these tasks via the task queue.
This would also help you stay well under the the cap imposed on the total number of cron tasks youre allowed to have
https://cloud.google.com/appengine/docs/standard/python/config/cronref#limits
Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
You could wrap up all of these cron entries into a single entry called 'Hourly tasks' or 'daily tasks' and then the request handler could then launch all of these tasks via the task queue.
This would also help you stay well under the the cap imposed on the total number of cron tasks youre allowed to have
https://cloud.google.com/appengine/docs/standard/python/config/cronref#limits
Free applications can have up to 20 scheduled tasks. Paid applications can have up to 250 scheduled tasks.
answered Nov 3 '18 at 0:02
AlexAlex
1,719412
1,719412
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
add a comment |
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
I updated my question. Please take a look. thanks
– slideshowp2
Nov 16 '18 at 2:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53114512%2fhow-to-reuse-config-in-cron-yaml%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
See this question: stackoverflow.com/q/53061394/136598
– Jeff O'Neill
Nov 2 '18 at 12:51
@JeffO'Neill I think this case has a little different. I use
req.paramsto geta,bandc. So, I have to declare every url incron.yamlfile.– slideshowp2
Nov 3 '18 at 2:24
the linked question can work for you. Your cron request handler can process the url to get the a, b, c params.
– Jeff O'Neill
Nov 3 '18 at 12:45
@JeffO'Neill. Yeah. My point is to reuse
targetandschedule. that's it. I don't want to declare them in each cron job. Like declare avar– slideshowp2
Nov 3 '18 at 13:52
You can't have variables in cron.yaml so the only solution is to reduce the number of entries in cron.yaml and use one handler to process multiple cron jobs.
– Jeff O'Neill
Nov 3 '18 at 14:27