Want to build Jenkins job every after 15 seconds

3,559 views
Skip to first unread message

Swapnil Pawar

unread,
Jul 2, 2014, 4:42:27 AM7/2/14
to jenkins...@googlegroups.com
Hi,

Can you please tell me How I can schedule Jenkins Job which will execute every after 15 seconds.

Regards,
Swapnil

Matthew...@diamond.ac.uk

unread,
Jul 2, 2014, 4:56:49 AM7/2/14
to jenkins...@googlegroups.com

On the job configuration page, there is a section called “Build Triggers”. Select  “Build periodically” and enter your schedule. There is help text available.

 

--

Daniel Beck

unread,
Jul 2, 2014, 5:21:25 AM7/2/14
to jenkins...@googlegroups.com
You can't. Are you sure you're using the right tool for the job?

https://en.wiktionary.org/wiki/if_all_you_have_is_a_hammer,_everything_looks_like_a_nail

Stephen Connolly

unread,
Jul 2, 2014, 5:22:33 AM7/2/14
to jenkins...@googlegroups.com
You could write a custom plugin. It's not to hard. The built in triggers are checked once every minute so the best resolution you will get with those is once per minute. There is nothing stopping you from implementing a custom trigger that causes builds to be triggered every second or every 15 seconds.


is an example of a plugin that does job scheduling if you want a reasonable starting point (though that plugin is serving a different use case)


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Stephen Connolly

unread,
Jul 2, 2014, 5:25:15 AM7/2/14
to jenkins...@googlegroups.com
I agree that it does sound like somebody trying to solve the wrong problem... we'll see which road he takes... does he push back on the "requirement" and find a better solution that does not involve running a job every 15 seconds... or does he get his feet wet and write a custom plugin (and a month or two down the road end up pushing back on the "requirement" because building jobs 4 times per minute is stupid)


Rob Mandeville

unread,
Jul 2, 2014, 8:06:04 AM7/2/14
to jenkins...@googlegroups.com

Not sure that running a job 4 times per minute is stupid without more information; one use case would be polling an unusual USB input device, like a thermometer or a strain gauge or other scientific/engineering instrument.  I would agree that Jenkins is probably the wrong thing to do this on.  Sure, you could write a plugin, but you can write a plugin for anything.  With enough ingenuity for writing plugins, I’m sure you could turn Jenkins into a perfectly horrible fly-by-wire system.  If somebody does this, please let me know which planes it’s installed on, so I can avoid them in my travel plans. ;*)

 

If you want to run a job at sub-minute intervals, neither Jenkins nor Cron are your friend.  You want to write another program or script something that will loop through launching your app and waiting the appropriate time.

 

Some interesting questions:

1: Do you want each job to launch 15 seconds after the previous one launched, or after the previous one finished?

2: If a job somehow runs longer than 15 seconds, do you want to kill it, launch a second job so that you have two running, or stop running jobs until the one that you have is finished?

 

If you want to use Jenkins to track each run of the job (so that you can see the output),  see https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs.  Basically, your job can run on its own and report into Jenkins without Jenkins being responsible for running it.

 

That being said, if you’re either running a job via Jenkins every 15 seconds or just using Jenkins to monitor it, you will need a lot of memory for your Jenkins JVM and will probably want to use the ‘discard old builds’ checkbox.  Jenkins loads the metadata for each job it “remembers” (not artifacts, not logs, but the other information like run times and success/failure) into memory.

 

--Rob

Click here to report this email as spam.



This e-mail and the information, including any attachments it contains, are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

Swapnil Pawar

unread,
Jul 2, 2014, 8:23:19 AM7/2/14
to jenkins...@googlegroups.com
Hi Rob,

1: Do you want each job to launch 15 seconds after the previous one launched, or after the previous one finished? - yes..have to laucnh the after previous one finished


Context : I am executing the Jmeter scripts after every 15 seconds through the Jenkins to check the health of API. 


- Swapnil

Rob Mandeville

unread,
Jul 2, 2014, 9:16:49 AM7/2/14
to jenkins...@googlegroups.com

Right, so you have a good reason to launch every 15 seconds from Jenkins.  Presumably, you want to use the Performance Plugin, and want it to run every 15 seconds.

 

So build your Jmeter job, adding a “Trigger builds remotely (e.g., from scripts)” trigger.  That will give you a URL to use to call it.

 

Install a command-line HTTP client, such as curl or wget, where one of your build nodes can reach it.

 

Make a second job that runs on said build node(s), launches every minute, and use a shell or windows batch step.

 

Write a shell script or batch file that:

1: Hits the JMeter job URL via the HTTP client you installed.

2: Sleeps for 15 seconds.

3: hits the JMeter job

4: sleeps

5: hits the JMeter job

6: sleeps

7: hits the JMeter job

 

This way, even if the job dies somewhere along the way, Jenkins will bring it back.  If you truly want to shut it down, disable this job to keep it from running.

 

--Rob

 

 

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Swapnil Pawar
Sent: Wednesday, July 02, 2014 8:23 AM
To: jenkins...@googlegroups.com
Subject: Re: Want to build Jenkins job every after 15 seconds

 

Hi Rob,

--

You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Click here to report this email as spam.

Geoff Cummings

unread,
Jul 2, 2014, 11:53:56 AM7/2/14
to jenkins...@googlegroups.com

how accurate to the 15 seconds does it need to be?

If it is only between job finishing and starting again, you could have it trigger itself again in a post build action to setup the running loop.
then set the quiet period to 15 seconds to get the delay between finished and started.

Geoff

ath...@exotel.in

unread,
Aug 22, 2018, 7:52:38 AM8/22/18
to Jenkins Users
You may run two Jenkins job with the same code .Say, a master and slave job. Configure the "quiet period" as 15 seconds for both the jobs and Set the Master job to build after slave and Slave job to build after Master using the Build Trigger setings. Now start the Master job. Both the jobs will do the same task in the frequency of 15 seconds now. Hope this solves your problem.

Robert Rajendra

unread,
Aug 22, 2018, 2:45:55 PM8/22/18
to jenkins...@googlegroups.com
Configure a build schedule in jenkins or set a cron under pol scm to run the job

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Robert Rajendra

Associate Network/Server Support Engineer

India +91.863.087.3094

IT Hands offers Technology Solutions to Grow your Business.

ath...@exotel.in

unread,
Aug 23, 2018, 12:32:06 AM8/23/18
to Jenkins Users
However, the build schedule cron in Jenkins can have a minimum value of 1 minute. As far as I know, it won't help for frequency less than a minute.
Reply all
Reply to author
Forward
0 new messages