GithubHelp home page GithubHelp logo

guniorobot / stupid_background Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 81 KB

Periodically call some methods which calculates things and then stores them to the database - in a Rails application, in the background.

Home Page: http://stupid.fetmab.net

License: BSD 3-Clause "New" or "Revised" License

stupid_background's Introduction

StupidBackground
================

This is a very simple background scheduler for periodical tasks to be performed
in your rails application.

Take the name as the spirit behind this small piece of software! There is no
fancy threading action going on and you should not use this if your life in
any way to an exact timing of one of your jobs. 

The intervals you configure
are meant as "at least this time is BETWEEN two runs of the job".
So if you have a interval of 5 seconds and your tasks takes 30 seconds to run
it behaves this way:

Second 0: Your Task
...
Second 30: Your Task finishes
Second 30: Another run of your job

If your task takes only 2 seconds to run it would look like this:

Second 0: Your Task
...
Second 2: Your Task finishes
...
Second 5: Another run of your job
...

But there is a way to run more than one "runner" at the same time.
Maybe you have some very long running tasks and some very quick ones. Then
you can specify a runner with:

  use_runner :some_fancy_name

in your worker class and this worker will be decoupled from the other ones.
If you specify the same name at two worker classes these classes will run in
one worker. Easy, isn't it ;)

If you need a more versatile solution you should have look at BackgrounDRB and
if you only need background tasks that do not repeat check the 
backgroundFu Plugin.

Credits
=======
I'm using the Daemonize Library from Travis Whitton, which could be 
found at http://grub.ath.cx/daemonize/ .

This library is released under the LGPL.
Thanks a lot for this cute peace of software Travis!

Also kudos to the #ruby-de IRC channel on freenode.org, those guys are great and
very helpful!

Example
=======
Start the background server:
rake background:start

Stop the background server:
rake background:stop

Start the server with an alternative Jobs YAMl File
(The default Jobs YAML file is at config/background_jobs.yml)
rake background:start jobs_file=/tmp/some_jobs.yml

Status of your runners:
rake backgrund:status

Contact
=======
Contact Thorben, the creator of this little plugin: [email protected]


Copyright (c) 2007-2009  FEtMab - Die Browserspiele-Manufaktur, released under the BSD license

stupid_background's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.