{"id":2058,"date":"2019-03-11T17:12:25","date_gmt":"2019-03-11T21:12:25","guid":{"rendered":"https:\/\/blogs.mathworks.com\/developer\/?p=2058"},"modified":"2019-03-11T17:12:25","modified_gmt":"2019-03-11T21:12:25","slug":"parameterized-scheduler","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/developer\/2019\/03\/11\/parameterized-scheduler\/","title":{"rendered":"Kick the Buckets"},"content":{"rendered":"\r\n<div class=\"content\"><p>OK, quick follow up to <a href=\"https:\/\/blogs.mathworks.com\/developer\/2019\/02\/11\/parameterized-build\/\">last post<\/a>. Having a parameterized build is great, but it presents us with one problem. I can guarantee you I will pretty much never click the button to kick off builds manually for other parameters.<\/p><p>Well, never fear since you can use the <a href=\"https:\/\/github.com\/jenkinsci\/parameterized-scheduler-plugin\">parameterized scheduler plugin<\/a> to get that additional feature. This will allow you to still have the build parameters as specified with one default build, but then you can schedule additional values based on the cron-like scheduling grammar. So, if we'd like to run our Standard tests on every commit, our Performance tests nightly, and our Deferred tests once a week, just install the parameterized plugin and set up your schedule to look something like this:<\/p><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/developer\/files\/y2019ParamSchedule.png\" alt=\"\"> <\/p><p>In this example, we are polling the SCM system every 5 minutes for our standard job. Since \"Standard\" is the default parameter we don't need to specify it at all. Then the parameterized scheduler allows us to specify a single hashed minute and hour (this is what the \"H\" means in the specification) for the Performance tests and a single hashed minute, hour, and day of the week for the Deferred tests. We could just as easily specify the specific time of day and day of week that we'd like these to run, but the hashing feature is a way to attempt a bit of load balancing on the Jenkins server by letting Jenkins choose the time to run based on a hash of the project. This is useful because we don't want all jobs to get scheduled at typical times humans tend to schedule things (like midnight, etc).<\/p><p>There we go, now my system is set up to test my MATLAB and Simulink projects with reckless abandon!<\/p><p>On another note. We talk a lot of Jenkins on this blog, but its definitely not the only CI system out there, and definitely not the only one we support and are working to improve. Are you using something else? If so, what are you using? Do you have any questions about how to set up a build for another system? Definitely open to hear your experiences.<\/p><script language=\"JavaScript\"> <!-- \r\n    function grabCode_78d57f6b18264be5b96c608f3df97dc4() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='78d57f6b18264be5b96c608f3df97dc4 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 78d57f6b18264be5b96c608f3df97dc4';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_78d57f6b18264be5b96c608f3df97dc4()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><\/div><!--\r\n78d57f6b18264be5b96c608f3df97dc4 ##### SOURCE BEGIN #####\r\n%%\r\n% OK, quick follow up to\r\n% <https:\/\/blogs.mathworks.com\/developer\/2019\/02\/11\/parameterized-build\/\r\n% last post>. Having a parameterized build is great, but it presents us\r\n% with one problem. I can guarantee you I will pretty much never click the\r\n% button to kick off builds manually for other parameters.\r\n%\r\n% Well, never fear since you can use the\r\n% <https:\/\/github.com\/jenkinsci\/parameterized-scheduler-plugin parameterized\r\n% scheduler plugin> to get that additional feature. This will allow you to\r\n% still have the build parameters as specified with one default build, but\r\n% then you can schedule additional values based on the cron-like scheduling\r\n% grammar. So, if we'd like to run our Standard tests on every commit, our\r\n% Performance tests nightly, and our Deferred tests once a week, just\r\n% install the parameterized plugin and set up your schedule to look\r\n% something like this:\r\n%\r\n% <<y2019ParamSchedule.png>>\r\n% \r\n% In this example, we are polling the SCM system every 5 minutes for our\r\n% standard job. Since \"Standard\" is the default parameter we don't need to\r\n% specify it at all. Then the parameterized scheduler allows us to specify\r\n% a single hashed minute and hour (this is what the \"H\" means in the\r\n% specification) for the Performance tests and a single hashed minute,\r\n% hour, and day of the week for the Deferred tests. We could just as easily\r\n% specify the specific time of day and day of week that we'd like these to\r\n% run, but the hashing feature is a way to attempt a bit of load balancing\r\n% on the Jenkins server by letting Jenkins choose the time to run based on\r\n% a hash of the project. This is useful because we don't want all jobs to\r\n% get scheduled at typical times humans tend to schedule things (like\r\n% midnight, etc).\r\n%\r\n% There we go, now my system is set up to test my MATLAB and Simulink\r\n% projects with reckless abandon!\r\n% \r\n% On another note. We talk a lot of Jenkins on this blog, but its\r\n% definitely not the only CI system out there, and definitely not the only\r\n% one we support and are working to improve. Are you using something else?\r\n% If so, what are you using? Do you have any questions about how to set up\r\n% a build for another system? Definitely open to hear your experiences.\r\n##### SOURCE END ##### 78d57f6b18264be5b96c608f3df97dc4\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/developer\/files\/y2019ParamSchedule.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\nOK, quick follow up to last post. Having a parameterized build is great, but it presents us with one problem. I can guarantee you I will pretty much never click the button to kick off builds... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/developer\/2019\/03\/11\/parameterized-scheduler\/\">read more >><\/a><\/p>","protected":false},"author":90,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/2058"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/users\/90"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/comments?post=2058"}],"version-history":[{"count":2,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/2058\/revisions"}],"predecessor-version":[{"id":2062,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/posts\/2058\/revisions\/2062"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/media?parent=2058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/categories?post=2058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/developer\/wp-json\/wp\/v2\/tags?post=2058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}