how to reuse config in cron.yaml?












0















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'}
})









share|improve this question

























  • 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











  • 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













  • 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
















0















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'}
})









share|improve this question

























  • 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











  • 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













  • 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














0












0








0








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'}
})









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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











  • @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



















  • 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











  • 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













  • 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












1 Answer
1






active

oldest

votes


















1














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.







share|improve this answer
























  • I updated my question. Please take a look. thanks

    – slideshowp2
    Nov 16 '18 at 2:16











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
});


}
});














draft saved

draft discarded


















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









1














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.







share|improve this answer
























  • I updated my question. Please take a look. thanks

    – slideshowp2
    Nov 16 '18 at 2:16
















1














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.







share|improve this answer
























  • I updated my question. Please take a look. thanks

    – slideshowp2
    Nov 16 '18 at 2:16














1












1








1







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.







share|improve this answer













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.








share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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